ncurses 5.7 - patch 20100116
[ncurses.git] / ncurses / base / MKunctrl.awk
index 1ba511d72323bf2ffcffe39293c2f8cde1ca99c5..2140900e8c3be185b4df4f959f2bc71005c36fe4 100644 (file)
@@ -1,6 +1,6 @@
-# $Id: MKunctrl.awk,v 1.21 2008/02/03 20:24:30 tom Exp $
+# $Id: MKunctrl.awk,v 1.26 2009/07/04 22:05:15 Clemens.Ladisch Exp $
 ##############################################################################
-# Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2008,2009 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"), #
@@ -36,19 +36,12 @@ BEGIN       {
                print "#include <curses.priv.h>"
                print "#include <ctype.h>"
                print ""
-               print "#if USE_WIDEC_SUPPORT"
-               print "#if HAVE_WCTYPE_H"
-               print "#include <wctype.h>"
-               print "#endif"
-               print "#endif"
-               print ""
                print "#undef unctrl"
                print ""
        }
 END    {
-               print "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (register chtype ch)"
+               print "NCURSES_EXPORT(NCURSES_CONST char *) safe_unctrl(SCREEN *sp, chtype ch)"
                print "{"
-
                blob=""
                offset=0
                if (bigstrings) {
@@ -101,6 +94,7 @@ END  {
                blob = blob "\"";
 
                print ""
+               printf "#if NCURSES_EXT_FUNCS\n";
                if (bigstrings) {
                        blob = blob "\n/* printable values in 128-255 range */"
                        printf "static const short unctrl_c1[] = {"
@@ -135,6 +129,7 @@ END {
                        }
                }
                print "};"
+               print "#endif /* NCURSES_EXT_FUNCS */"
                blob = blob "\"\n"
 
                print ""
@@ -150,31 +145,20 @@ END       {
                print  ""
                print  "\tif (check >= 0 && check < (int)SIZEOF(unctrl_table)) {"
                print  "#if NCURSES_EXT_FUNCS"
-               print  "\t\tif ((SP != 0)"
-               print  "\t\t && (SP->_legacy_coding > 1)"
+               print  "\t\tif ((sp != 0)"
+               print  "\t\t && (sp->_legacy_coding > 1)"
                print  "\t\t && (check >= 128)"
                print  "\t\t && (check < 160))"
                printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
                print  "\t\telse"
-               print  "#if USE_WIDEC_SUPPORT"
-               print  "\t\tif ((check >= 160)"
-               print  "\t\t && (check < 256)"
-               print  "\t\t && ((SP != 0)"
-               print  "\t\t  && ((SP->_legacy_coding > 0)"
-               print  "\t\t   || (SP->_legacy_coding == 0"
-               print  "\t\t       && (isprint(check) || iswprint(check))))))"
-               printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
-               print  "\t\telse"
-               print  "#else"
                print  "\t\tif ((check >= 160)"
                print  "\t\t && (check < 256)"
-               print  "\t\t && ((SP != 0)"
-               print  "\t\t  && ((SP->_legacy_coding > 0)"
-               print  "\t\t   || (SP->_legacy_coding == 0"
+               print  "\t\t && ((sp != 0)"
+               print  "\t\t  && ((sp->_legacy_coding > 0)"
+               print  "\t\t   || (sp->_legacy_coding == 0"
                print  "\t\t       && isprint(check)))))"
                printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
                print  "\t\telse"
-               print  "#endif /* USE_WIDEC_SUPPORT */"
                print  "#endif /* NCURSES_EXT_FUNCS */"
                printf "\t\t\tresult = %s_table[check];\n", stringname;
                print  "\t} else {"
@@ -182,4 +166,9 @@ END {
                print  "\t}"
                print  "\treturn (NCURSES_CONST char *)result;"
                print  "}"
+               print  ""
+               print  "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype ch)"
+               print  "{"
+               print  "\treturn safe_unctrl(CURRENT_SCREEN, ch);"
+               print  "}"
        }