ncurses 5.6 - patch 20070421
[ncurses.git] / ncurses / base / MKkeyname.awk
index 2d449271fd194ed9bd8df085e5581ee6f06d4615..b27eb75ab8b6ddbf0f954b375cde2ba62b3bfb7b 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: MKkeyname.awk,v 1.31 2007/01/06 21:19:44 Miroslav.Lichvar Exp $
+# $Id: MKkeyname.awk,v 1.32 2007/04/21 23:01:49 tom Exp $
 ##############################################################################
 # Copyright (c) 1999-2006,2007 Free Software Foundation, Inc.                #
 #                                                                            #
@@ -48,7 +48,7 @@ END {
        print "static const char key_names[] = "names";"
        print ""
        print "#define SIZEOF_TABLE 256"
-       print "static char **keyname_table;"
+       print "#define MyTable _nc_globals.keyname_table"
        print ""
        print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)"
        print "{"
@@ -68,10 +68,10 @@ END {
        print "         }"
        print ""
        print "         if (result == 0 && (c >= 0 && c < SIZEOF_TABLE)) {"
-       print "                 if (keyname_table == 0)"
-       print "                         keyname_table = typeCalloc(char *, SIZEOF_TABLE);"
-       print "                 if (keyname_table != 0) {"
-       print "                         if (keyname_table[c] == 0) {"
+       print "                 if (MyTable == 0)"
+       print "                         MyTable = typeCalloc(char *, SIZEOF_TABLE);"
+       print "                 if (MyTable != 0) {"
+       print "                         if (MyTable[c] == 0) {"
        print "                                 int cc = c;"
        print "                                 p = name;"
        print "                                 if (cc >= 128) {"
@@ -85,9 +85,9 @@ END {
        print "                                         strcpy(p, \"^?\");"
        print "                                 else"
        print "                                         sprintf(p, \"%c\", cc);"
-       print "                                 keyname_table[c] = strdup(name);"
+       print "                                 MyTable[c] = strdup(name);"
        print "                         }"
-       print "                         result = keyname_table[c];"
+       print "                         result = MyTable[c];"
        print "                 }"
        print "#if NCURSES_EXT_FUNCS && NCURSES_XNAMES"
        print "         } else if (result == 0 && cur_term != 0) {"
@@ -128,11 +128,11 @@ END {
        print "void _nc_keyname_leaks(void)"
        print "{"
        print " int j;"
-       print " if (keyname_table != 0) {"
+       print " if (MyTable != 0) {"
        print "         for (j = 0; j < SIZEOF_TABLE; ++j) {"
-       print "                 FreeIfNeeded(keyname_table[j]);"
+       print "                 FreeIfNeeded(MyTable[j]);"
        print "         }"
-       print "         FreeAndNull(keyname_table);"
+       print "         FreeAndNull(MyTable);"
        print " }"
        print "}"
        print "#endif /* NO_LEAKS */"