1 ##############################################################################
2 # Copyright (c) 1998-2000,2006 Free Software Foundation, Inc. #
4 # Permission is hereby granted, free of charge, to any person obtaining a #
5 # copy of this software and associated documentation files (the "Software"), #
6 # to deal in the Software without restriction, including without limitation #
7 # the rights to use, copy, modify, merge, publish, distribute, distribute #
8 # with modifications, sublicense, and/or sell copies of the Software, and to #
9 # permit persons to whom the Software is furnished to do so, subject to the #
10 # following conditions: #
12 # The above copyright notice and this permission notice shall be included in #
13 # all copies or substantial portions of the Software. #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
18 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
20 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
21 # DEALINGS IN THE SOFTWARE. #
23 # Except as contained in this notice, the name(s) of the above copyright #
24 # holders shall not be used in advertising or otherwise to promote the sale, #
25 # use or other dealings in this Software without prior written #
27 ##############################################################################
28 # $Id: MKnames.awk,v 1.12 2006/04/22 21:46:17 tom Exp $
30 print "/* This file was generated by MKnames.awk */" > "namehdr"
32 print "#include <curses.priv.h>" > "namehdr"
34 print "#define IT NCURSES_CONST char * const" > "namehdr"
36 print "#if BROKEN_LINKER" > "namehdr"
37 print "#include <term.h>" > "namehdr"
38 print "#define DCL(it) static IT data##it[]" > "namehdr"
39 print "#else" > "namehdr"
40 print "#define DCL(it) NCURSES_EXPORT_VAR(IT) it[]" > "namehdr"
41 print "#endif" > "namehdr"
43 print "/*" > "boolnames"
44 print " * names.c - Arrays of capability names and codes" > "boolnames"
45 print " *" > "boolnames"
46 print " */" > "boolnames"
47 print "" > "boolnames"
48 print "DCL(boolnames) = {" > "boolnames"
49 print "DCL(boolfnames) = {" > "boolfnames"
50 print "DCL(boolcodes) = {" > "boolcodes"
51 print "DCL(numnames) = {" > "numnames"
52 print "DCL(numfnames) = {" > "numfnames"
53 print "DCL(numcodes) = {" > "numcodes"
54 print "DCL(strnames) = {" > "strnames"
55 print "DCL(strfnames) = {" > "strfnames"
56 print "DCL(strcodes) = {" > "strcodes"
61 $1 == "SKIPWARN" {next;}
64 printf "\t\t\"%s\",\n", $2 > "boolnames"
65 printf "\t\t\"%s\",\n", $1 > "boolfnames"
66 printf "\t\t\"%s\",\n", $4 > "boolcodes"
70 printf "\t\t\"%s\",\n", $2 > "numnames"
71 printf "\t\t\"%s\",\n", $1 > "numfnames"
72 printf "\t\t\"%s\",\n", $4 > "numcodes"
76 printf "\t\t\"%s\",\n", $2 > "strnames"
77 printf "\t\t\"%s\",\n", $1 > "strfnames"
78 printf "\t\t\"%s\",\n", $4 > "strcodes"
82 print "\t\t(NCURSES_CONST char *)0," > "boolnames"
83 print "};" > "boolnames"
84 print "" > "boolnames"
85 print "\t\t(NCURSES_CONST char *)0," > "boolfnames"
86 print "};" > "boolfnames"
87 print "" > "boolfnames"
88 print "\t\t(NCURSES_CONST char *)0," > "boolcodes"
89 print "};" > "boolcodes"
90 print "" > "boolcodes"
91 print "\t\t(NCURSES_CONST char *)0," > "numnames"
92 print "};" > "numnames"
94 print "\t\t(NCURSES_CONST char *)0," > "numfnames"
95 print "};" > "numfnames"
96 print "" > "numfnames"
97 print "\t\t(NCURSES_CONST char *)0," > "numcodes"
98 print "};" > "numcodes"
100 print "\t\t(NCURSES_CONST char *)0," > "strnames"
101 print "};" > "strnames"
102 print "" > "strnames"
103 print "\t\t(NCURSES_CONST char *)0," > "strfnames"
104 print "};" > "strfnames"
105 print "" > "strfnames"
106 print "\t\t(NCURSES_CONST char *)0," > "strcodes"
107 print "};" > "strcodes"
108 print "" > "strcodes"
109 print "#if BROKEN_LINKER" > "nameftr"
110 print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "nameftr"
111 print "FIX(boolnames)" > "nameftr"
112 print "FIX(boolfnames)" > "nameftr"
113 print "FIX(numnames)" > "nameftr"
114 print "FIX(numfnames)" > "nameftr"
115 print "FIX(strnames)" > "nameftr"
116 print "FIX(strfnames)" > "nameftr"
117 print "#endif /* BROKEN_LINKER */" > "nameftr"
119 print "#if BROKEN_LINKER" > "codeftr"
120 print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "codeftr"
121 print "FIX(boolcodes)" > "codeftr"
122 print "FIX(numcodes)" > "codeftr"
123 print "FIX(strcodes)" > "codeftr"
124 print "#endif /* BROKEN_LINKER */" > "codeftr"