1
# $Id: MKkeyname.awk,v 1.28 2005/04/30 19:26:25 tom Exp $
1
# $Id: MKkeyname.awk,v 1.30 2006/05/20 17:35:30 tom Exp $
2
2
##############################################################################
3
# Copyright (c) 1999-2002,2005 Free Software Foundation, Inc. #
3
# Copyright (c) 1999-2005,2006 Free Software Foundation, Inc. #
5
5
# Permission is hereby granted, free of charge, to any person obtaining a #
6
6
# copy of this software and associated documentation files (the "Software"), #
64
print " if (result == 0 && (c >= 0 && c < 256)) {"
65
print " if (table == 0)"
66
print " table = typeCalloc(char *, 256);"
67
print " if (table != 0) {"
68
print " if (table[c] == 0) {"
66
print " if (result == 0 && (c >= 0 && c < SIZEOF_TABLE)) {"
67
print " if (keyname_table == 0)"
68
print " keyname_table = typeCalloc(char *, SIZEOF_TABLE);"
69
print " if (keyname_table != 0) {"
70
print " if (keyname_table[c] == 0) {"
70
print " if (c >= 128) {"
73
print " if (cc >= 128) {"
71
74
print " strcpy(p, \"M-\");"
76
print " sprintf(p, \"^%c\", c + '@');"
77
print " else if (c == 127)"
79
print " sprintf(p, \"^%c\", cc + '@');"
80
print " else if (cc == 127)"
78
81
print " strcpy(p, \"^?\");"
80
print " sprintf(p, \"%c\", c);"
81
print " table[c] = strdup(name);"
83
print " sprintf(p, \"%c\", cc);"
84
print " keyname_table[c] = strdup(name);"
83
print " result = table[c];"
86
print " result = keyname_table[c];"
85
88
print "#if NCURSES_EXT_FUNCS && NCURSES_XNAMES"
86
89
print " } else if (result == 0 && cur_term != 0) {"
115
119
print " return result;"
124
print "void _nc_keyname_leaks(void)"
127
print " if (keyname_table != 0) {"
128
print " for (j = 0; j < SIZEOF_TABLE; ++j) {"
129
print " FreeIfNeeded(keyname_table[j]);"
131
print " FreeAndNull(keyname_table);"
134
print "#endif /* NO_LEAKS */"