From: Thomas E. Dickey Date: Sun, 7 Jan 2007 01:32:36 +0000 (+0000) Subject: ncurses 5.6 - patch 20070106 X-Git-Tag: v5.7~88 X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=7eb4be765b131f00ac3da7ce8cfd3bc6759d26c5 ncurses 5.6 - patch 20070106 + change MKunctrl.awk to reduce relocation table for unctrl.o + change MKkeyname.awk to reduce relocation table for keyname.o (patch by Miroslav Lichvar). --- diff --git a/NEWS b/NEWS index b3bd9bfe..6af0b960 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.1063 2006/12/31 00:11:42 tom Exp $ +-- $Id: NEWS,v 1.1064 2007/01/06 22:55:02 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,11 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20070106 + + change MKunctrl.awk to reduce relocation table for unctrl.o + + change MKkeyname.awk to reduce relocation table for keyname.o + (patch by Miroslav Lichvar). + 20061230 + modify configure check for libtool's version to trim blank lines (report by sci-fi@hush.ai). diff --git a/dist.mk b/dist.mk index 76e0dbec..f21d0cf1 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.570 2006/12/30 15:49:50 tom Exp $ +# $Id: dist.mk,v 1.571 2007/01/06 17:55:39 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 NCURSES_MINOR = 6 -NCURSES_PATCH = 20061230 +NCURSES_PATCH = 20070106 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/include/tic.h b/include/tic.h index 7d9e9d5b..94b224ee 100644 --- a/include/tic.h +++ b/include/tic.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,2007 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 * @@ -33,7 +33,7 @@ ****************************************************************************/ /* - * $Id: tic.h,v 1.55 2006/08/19 14:17:49 tom Exp $ + * $Id: tic.h,v 1.57 2007/01/06 23:17:38 tom Exp $ * tic.h - Global variables and structures for the terminfo * compiler. */ @@ -167,7 +167,7 @@ extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; * List of keynames with their corresponding code. */ struct kn { - const char *name; + int offset; int code; }; @@ -189,7 +189,7 @@ extern NCURSES_EXPORT(struct tinfo_fkeys *) _nc_tinfo_fkeysf (void); #else -extern NCURSES_EXPORT_VAR(struct tinfo_fkeys) _nc_tinfo_fkeys[]; +extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[]; #endif diff --git a/ncurses/base/MKkeyname.awk b/ncurses/base/MKkeyname.awk index 11dcfe5c..2d449271 100644 --- a/ncurses/base/MKkeyname.awk +++ b/ncurses/base/MKkeyname.awk @@ -1,6 +1,6 @@ -# $Id: MKkeyname.awk,v 1.30 2006/05/20 17:35:30 tom Exp $ +# $Id: MKkeyname.awk,v 1.31 2007/01/06 21:19:44 Miroslav.Lichvar Exp $ ############################################################################## -# Copyright (c) 1999-2005,2006 Free Software Foundation, Inc. # +# Copyright (c) 1999-2006,2007 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"), # @@ -37,11 +37,15 @@ BEGIN { } /^[^#]/ { - printf "\t{ \"%s\", %s },\n", $1, $1; + printf "\t{ %d, %s },\n", offset, $1 + offset += length($1) + 1 + names = names"\n\t\""$1"\\0\"" } END { - printf "\t{ 0, 0 }};\n" + printf "\t{ -1, 0 }};\n" + print "" + print "static const char key_names[] = "names";" print "" print "#define SIZEOF_TABLE 256" print "static char **keyname_table;" @@ -56,9 +60,9 @@ END { print " if (c == -1) {" print " result = \"-1\";" print " } else {" - print " for (i = 0; _nc_key_names[i].name != 0; i++) {" + print " for (i = 0; _nc_key_names[i].offset != -1; i++) {" print " if (_nc_key_names[i].code == c) {" - print " result = (NCURSES_CONST char *)_nc_key_names[i].name;" + print " result = (NCURSES_CONST char *)key_names + _nc_key_names[i].offset;" print " break;" print " }" print " }" diff --git a/ncurses/base/MKunctrl.awk b/ncurses/base/MKunctrl.awk index 0104298f..78ab53d3 100644 --- a/ncurses/base/MKunctrl.awk +++ b/ncurses/base/MKunctrl.awk @@ -1,6 +1,6 @@ -# $Id: MKunctrl.awk,v 1.12 2006/12/30 18:12:12 tom Exp $ +# $Id: MKunctrl.awk,v 1.13 2007/01/06 22:52:02 tom Exp $ ############################################################################## -# Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. # +# Copyright (c) 1998-2006,2007 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"), # @@ -42,49 +42,67 @@ END { print "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (register chtype ch)" print "{" - printf "static const char* const unctrl_table[] = {" + blob="" + offset=0 + printf "static const short unctrl_table[] = {" for ( ch = 0; ch < 256; ch++ ) { gap = "," - if ((ch % 8) == 0) + part="" + if ((ch % 8) == 0) { printf "\n " + if (ch != 0) + blob = blob "\"" + blob = blob "\n \"" + } + printf "%4d%s", offset, gap; if (ch < 32) { - printf "\"^\\%03o\"", ch + 64 + part = sprintf ("^\\%03o\\0", ch + 64); + offset = offset + 3; } else if (ch == 127) { - printf "\"^?\"" + part = "^?\\0"; + offset = offset + 3; } else if (ch >= 128 && ch < 160) { - printf "\"~\\%03o\"", ch - 64 + part = sprintf("~\\%03o\\0", ch - 64); + offset = offset + 3; } else { - printf "\"\\%03o\"", ch gap = gap " " + part = sprintf("\\%03o\\0", ch); + offset = offset + 2; } + blob = blob part if (ch == 255) gap = "\n" else if (((ch + 1) % 8) != 0) gap = gap " " - printf "%s", gap } print "};" + blob = blob "\""; print "" print "#if NCURSES_EXT_FUNCS" - printf "static const char* const unctrl_c1[] = {" + blob = blob "\n#if NCURSES_EXT_FUNCS" + printf "static const short unctrl_c1[] = {" for ( ch = 128; ch < 160; ch++ ) { gap = "," - if ((ch % 8) == 0) + if ((ch % 8) == 0) { + if (ch != 128) + blob = blob "\"" printf "\n " - if (ch >= 128 && ch < 160) { - printf "\"\\%03o\"", ch - gap = gap " " + blob = blob "\n \"" } - if (ch == 255) - gap = "\n" - else if (((ch + 1) % 8) != 0) + printf "%4d%s", offset, gap; + part = sprintf("\\%03o\\0", ch); + blob = blob part + offset = offset + 2; + if (((ch + 1) % 8) != 0) gap = gap " " - printf "%s", gap } print "};" print "#endif /* NCURSES_EXT_FUNCS */" + blob = blob "\"\n#endif /* NCURSES_EXT_FUNCS */\n" + print "" + print "static const char unctrl_blob[] = "blob";" print "" print "\tint check = ChCharOf(ch);" print "\tconst char *result;" @@ -95,10 +113,10 @@ END { print "\t\t && (SP->_legacy_coding > 1)" print "\t\t && (check >= 128)" print "\t\t && (check < 160))" - print "\t\t\tresult = unctrl_c1[check - 128];" + print "\t\t\tresult = unctrl_blob + unctrl_c1[check - 128];" print "\t\telse" print "#endif /* NCURSES_EXT_FUNCS */" - print "\t\t\tresult = unctrl_table[check];" + print "\t\t\tresult = unctrl_blob + unctrl_table[check];" print "\t} else {" print "\t\tresult = 0;" print "\t}" diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 68308a01..cc3c4498 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,2007 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 * @@ -34,7 +34,7 @@ /* - * $Id: curses.priv.h,v 1.317 2006/12/30 21:36:59 tom Exp $ + * $Id: curses.priv.h,v 1.319 2007/01/06 21:16:26 tom Exp $ * * curses.priv.h * @@ -408,11 +408,11 @@ struct screen { int _checkfd; /* filedesc for typeahead check */ TERMINAL *_term; /* terminal type information */ TTY _saved_tty; /* savetty/resetty information */ - short _lines; /* screen lines */ - short _columns; /* screen columns */ + NCURSES_SIZE_T _lines; /* screen lines */ + NCURSES_SIZE_T _columns; /* screen columns */ - short _lines_avail; /* lines available for stdscr */ - short _topstolen; /* lines stolen from top */ + NCURSES_SIZE_T _lines_avail; /* lines available for stdscr */ + NCURSES_SIZE_T _topstolen; /* lines stolen from top */ ripoff_t _rippedoff[5]; /* list of lines stolen */ int _rip_count; /* ...and total lines stolen */ diff --git a/ncurses/tinfo/make_keys.c b/ncurses/tinfo/make_keys.c index 8f6243c9..00367185 100644 --- a/ncurses/tinfo/make_keys.c +++ b/ncurses/tinfo/make_keys.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2005,2007 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 * @@ -39,7 +39,7 @@ #define USE_TERMLIB 1 #include -MODULE_ID("$Id: make_keys.c,v 1.12 2005/08/20 19:58:18 tom Exp $") +MODULE_ID("$Id: make_keys.c,v 1.13 2007/01/07 00:00:14 tom Exp $") #include @@ -113,7 +113,7 @@ main(int argc, char *argv[]) "#if BROKEN_LINKER", "static", "#endif", - "struct tinfo_fkeys _nc_tinfo_fkeys[] = {", + "const struct tinfo_fkeys _nc_tinfo_fkeys[] = {", 0 }; static const char *suffix[] = diff --git a/test/chgat.c b/test/chgat.c index f55b94eb..06a27d73 100644 --- a/test/chgat.c +++ b/test/chgat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006 Free Software Foundation, Inc. * + * Copyright (c) 2006,2007 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: chgat.c,v 1.5 2006/07/15 22:48:27 tom Exp $ + * $Id: chgat.c,v 1.6 2007/01/06 23:28:46 tom Exp $ * * test-driver for chgat/wchgat/mvchgat/mvwchgat */ @@ -50,22 +50,22 @@ typedef struct { int pair, attr; int count; int ch; - char *c_msg; - char *v_msg; + const char *c_msg; + const char *v_msg; int y_val; int x_val; int y_beg, x_beg; int y_max, x_max; } STATUS; -static char * +static const char * color_params(unsigned state, int *pair) { /* *INDENT-OFF* */ static struct { int pair; int fg, bg; - char *msg; + const char *msg; } table[] = { { 0, COLOR_DEFAULT, COLOR_DEFAULT, "default" }, { 1, COLOR_RED, COLOR_BLACK, "red/black" }, @@ -74,7 +74,7 @@ color_params(unsigned state, int *pair) /* *INDENT-ON* */ static bool first = TRUE; - char *result = 0; + const char *result = 0; if (has_colors()) { if (first) { @@ -93,13 +93,13 @@ color_params(unsigned state, int *pair) return result; } -static char * +static const char * video_params(unsigned state, int *attr) { /* *INDENT-OFF* */ static struct { int attr; - char *msg; + const char *msg; } table[] = { { A_NORMAL, "normal" }, { A_BOLD, "bold" }, @@ -109,7 +109,7 @@ video_params(unsigned state, int *attr) }; /* *INDENT-ON* */ - char *result = 0; + const char *result = 0; if (state < SIZEOF(table)) { *attr = table[state].attr; diff --git a/test/movewindow.c b/test/movewindow.c index 6e37bfe2..e102b667 100644 --- a/test/movewindow.c +++ b/test/movewindow.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006 Free Software Foundation, Inc. * + * Copyright (c) 2006,2007 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: movewindow.c,v 1.19 2006/06/17 17:43:22 tom Exp $ + * $Id: movewindow.c,v 1.20 2007/01/06 23:28:53 tom Exp $ * * Demonstrate move functions for windows and derived windows from the curses * library. @@ -63,14 +63,14 @@ typedef struct { WINDOW *child; /* the actual value */ } FRAME; -static void head_line(char *fmt,...) GCC_PRINTFLIKE(1, 2); -static void tail_line(char *fmt,...) GCC_PRINTFLIKE(1, 2); +static void head_line(const char *fmt,...) GCC_PRINTFLIKE(1, 2); +static void tail_line(const char *fmt,...) GCC_PRINTFLIKE(1, 2); static unsigned num_windows; static FRAME *all_windows; static void -message(int lineno, char *fmt, va_list argp) +message(int lineno, const char *fmt, va_list argp) { int y, x; @@ -93,7 +93,7 @@ message(int lineno, char *fmt, va_list argp) } static void -head_line(char *fmt,...) +head_line(const char *fmt,...) { va_list argp; @@ -103,7 +103,7 @@ head_line(char *fmt,...) } static void -tail_line(char *fmt,...) +tail_line(const char *fmt,...) { va_list argp; @@ -511,7 +511,7 @@ show_help(WINDOW *current) /* *INDENT-OFF* */ static struct { int key; - char * msg; + const char * msg; } help[] = { { '?', "Show this screen" }, { 'b', "Draw a box inside the current window" }, diff --git a/test/ncurses.c b/test/ncurses.c index c1790c89..f6090f43 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,2007 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 * @@ -40,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.280 2006/12/10 00:13:15 tom Exp $ +$Id: ncurses.c,v 1.281 2007/01/06 23:32:00 tom Exp $ ***************************************************************************/ @@ -3124,7 +3124,7 @@ show_utf8_chars(attr_t attr, short pair) /* *INDENT-OFF* */ static struct { attr_t attr; - char *name; + const char *name; } attrs_to_cycle[] = { { A_NORMAL, "normal" }, { A_BOLD, "bold" },