ncurses 5.3
[ncurses.git] / ncurses / tinfo / MKnames.awk
1 # $Id: MKnames.awk,v 1.11 2000/12/09 23:46:13 tom Exp $
2 BEGIN           {
3                         print  "/* This file was generated by MKnames.awk */" > "namehdr"
4                         print  ""                               > "namehdr"
5                         print  "#include <curses.priv.h>"       > "namehdr"
6                         print  ""                               > "namehdr"
7                         print  "#define IT NCURSES_CONST char * const"  > "namehdr"
8                         print  ""                               > "namehdr"
9                         print  "#if BROKEN_LINKER"              > "namehdr"
10                         print  "#include <term.h>"              > "namehdr"
11                         print  "#define DCL(it) static IT data##it[]" > "namehdr"
12                         print  "#else"                          > "namehdr"
13                         print  "#define DCL(it) NCURSES_EXPORT_VAR(IT) it[]"    > "namehdr"
14                         print  "#endif"                         > "namehdr"
15                         print  ""                               > "namehdr"
16                         print  "/*"                             > "boolnames"
17                         print  " *      names.c - Arrays of capability names and codes"  > "boolnames"
18                         print  " *"                             > "boolnames"
19                         print  " */"                            > "boolnames"
20                         print  ""                               > "boolnames"
21                         print  "DCL(boolnames)  = {"            > "boolnames"
22                         print  "DCL(boolfnames) = {"            > "boolfnames"
23                         print  "DCL(boolcodes)  = {"            > "boolcodes"
24                         print  "DCL(numnames)   = {"            > "numnames"
25                         print  "DCL(numfnames)  = {"            > "numfnames"
26                         print  "DCL(numcodes)   = {"            > "numcodes"
27                         print  "DCL(strnames)   = {"            > "strnames"
28                         print  "DCL(strfnames)  = {"            > "strfnames"
29                         print  "DCL(strcodes)   = {"            > "strcodes"
30                 }
31
32 $1 ~ /^#/               {next;}
33
34 $1 == "SKIPWARN"        {next;}
35
36 $3 == "bool"    {
37                         printf "\t\t\"%s\",\n", $2 > "boolnames"
38                         printf "\t\t\"%s\",\n", $1 > "boolfnames"
39                         printf "\t\t\"%s\",\n", $4 > "boolcodes"
40                 }
41
42 $3 == "num"     {
43                         printf "\t\t\"%s\",\n", $2 > "numnames"
44                         printf "\t\t\"%s\",\n", $1 > "numfnames"
45                         printf "\t\t\"%s\",\n", $4 > "numcodes"
46                 }
47
48 $3 == "str"     {
49                         printf "\t\t\"%s\",\n", $2 > "strnames"
50                         printf "\t\t\"%s\",\n", $1 > "strfnames"
51                         printf "\t\t\"%s\",\n", $4 > "strcodes"
52                 }
53
54 END             {
55                         print  "\t\t(NCURSES_CONST char *)0," > "boolnames"
56                         print  "};" > "boolnames"
57                         print  "" > "boolnames"
58                         print  "\t\t(NCURSES_CONST char *)0," > "boolfnames"
59                         print  "};" > "boolfnames"
60                         print  "" > "boolfnames"
61                         print  "\t\t(NCURSES_CONST char *)0," > "boolcodes"
62                         print  "};" > "boolcodes"
63                         print  "" > "boolcodes"
64                         print  "\t\t(NCURSES_CONST char *)0," > "numnames"
65                         print  "};" > "numnames"
66                         print  "" > "numnames"
67                         print  "\t\t(NCURSES_CONST char *)0," > "numfnames"
68                         print  "};" > "numfnames"
69                         print  "" > "numfnames"
70                         print  "\t\t(NCURSES_CONST char *)0," > "numcodes"
71                         print  "};" > "numcodes"
72                         print  "" > "numcodes"
73                         print  "\t\t(NCURSES_CONST char *)0," > "strnames"
74                         print  "};" > "strnames"
75                         print  "" > "strnames"
76                         print  "\t\t(NCURSES_CONST char *)0," > "strfnames"
77                         print  "};" > "strfnames"
78                         print  "" > "strfnames"
79                         print  "\t\t(NCURSES_CONST char *)0," > "strcodes"
80                         print  "};"                             > "strcodes"
81                         print  ""                               > "strcodes"
82                         print  "#if BROKEN_LINKER"              > "nameftr"
83                         print  "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "nameftr"
84                         print  "FIX(boolnames)"                 > "nameftr"
85                         print  "FIX(boolfnames)"                > "nameftr"
86                         print  "FIX(numnames)"                  > "nameftr"
87                         print  "FIX(numfnames)"                 > "nameftr"
88                         print  "FIX(strnames)"                  > "nameftr"
89                         print  "FIX(strfnames)"                 > "nameftr"
90                         print  "#endif /* BROKEN_LINKER */"     > "nameftr"
91                         print  ""                               > "codeftr"
92                         print  "#if BROKEN_LINKER"              > "codeftr"
93                         print  "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "codeftr"
94                         print  "FIX(boolcodes)"                 > "codeftr"
95                         print  "FIX(numcodes)"                  > "codeftr"
96                         print  "FIX(strcodes)"                  > "codeftr"
97                         print  "#endif /* BROKEN_LINKER */"     > "codeftr"
98                 }