]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/MKunctrl.awk
ncurses 5.5
[ncurses.git] / ncurses / base / MKunctrl.awk
index 0f4419242a9957b4b26c92765eed22ffc476c727..79ca5fc56733df954e5b1660cf1bd56bac9b925e 100644 (file)
@@ -1,6 +1,6 @@
-# $Id: MKunctrl.awk,v 1.6 1998/06/06 18:18:07 tom Exp $
+# $Id: MKunctrl.awk,v 1.10 2004/04/03 22:50:37 tom Exp $
 ##############################################################################
-# Copyright (c) 1998 Free Software Foundation, Inc.                          #
+# Copyright (c) 1998,2001,2004 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -39,7 +39,7 @@ BEGIN {
                print ""
        }
 END    {
-               print "NCURSES_CONST char *unctrl(register chtype ch)"
+               print "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (register chtype ch)"
                print "{"
                printf "static const char* const table[] = {"
                for ( ch = 0; ch < 256; ch++ ) {
@@ -50,6 +50,8 @@ END   {
                                printf "\"^\\%03o\"", ch + 64
                        } else if (ch == 127) {
                                printf "\"^?\""
+                       } else if (ch >= 128 && ch < 160) {
+                               printf "\"~\\%03o\"", ch - 64
                        } else {
                                printf "\"\\%03o\"", ch
                                gap = gap " "
@@ -61,7 +63,10 @@ END  {
                        printf "%s", gap
                }
                print "};"
+               print "int check = ChCharOf(ch);"
                print ""
-               print "\treturn (NCURSES_CONST char *)table[TextOf(ch)];"
+               print "\tif (check < 0 || check >= (int)SIZEOF(table)) return 0;"
+               print ""
+               print "\treturn (NCURSES_CONST char *)table[check];"
                print "}"
        }