X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2FMKunctrl.awk;h=79ca5fc56733df954e5b1660cf1bd56bac9b925e;hp=0f4419242a9957b4b26c92765eed22ffc476c727;hb=55ccd2b959766810cf7db8d1c4462f338ce0afc8;hpb=0eb88fc5281804773e2a0c7a488a4452463535ce diff --git a/ncurses/base/MKunctrl.awk b/ncurses/base/MKunctrl.awk index 0f441924..79ca5fc5 100644 --- a/ncurses/base/MKunctrl.awk +++ b/ncurses/base/MKunctrl.awk @@ -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 "}" }