X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Flib_traceatr.c;h=c6023b2b53060a1dd0233f53c9d01ca4fb9e5a5a;hp=13d96a4376b1aac07740138e4af4c26bbfced1de;hb=refs%2Ftags%2Fv4.2;hpb=3a9b6a3bf0269231bef7de74757a910dedd04e0c diff --git a/ncurses/lib_traceatr.c b/ncurses/lib_traceatr.c index 13d96a43..c6023b2b 100644 --- a/ncurses/lib_traceatr.c +++ b/ncurses/lib_traceatr.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ @@ -32,42 +44,10 @@ #include #include /* acs_chars */ -MODULE_ID("$Id: lib_traceatr.c,v 1.20 1997/05/06 11:07:27 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.25 1998/02/11 12:14:00 tom Exp $") #define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name) -char * _nc_trace_buf(int bufnum, size_t want) -{ - static struct { - char *text; - size_t size; - } *list; - static size_t have; - - if (bufnum < 0) - bufnum = 0; - - if ((size_t)(bufnum+1) > have) { - size_t need = (bufnum + 1) * 2; - size_t used = sizeof(*list) * need; - list = (list == 0) ? malloc(used) : realloc(list, used); - while (need > have) - list[have++].text = 0; - } - - if (list[bufnum].text == 0) - { - list[bufnum].text = malloc(want); - list[bufnum].size = want; - } - else if (want > list[bufnum].size) { - list[bufnum].text = realloc(list[bufnum].text, want); - list[bufnum].size = want; - } - *(list[bufnum].text) = '\0'; - return list[bufnum].text; -} - char *_traceattr2(int bufnum, attr_t newmode) { char *buf = _nc_trace_buf(bufnum, BUFSIZ); @@ -105,7 +85,7 @@ unsigned save_nc_tracing = _nc_tracing; strcpy(tmp++, "{"); - for (n = 0; n < sizeof(names)/sizeof(names[0]); n++) { + for (n = 0; n < SIZEOF(names); n++) { if ((newmode & names[n].val) != 0) { if (buf[1] != '\0') strcat(tmp, "|"); @@ -144,6 +124,13 @@ char *_traceattr(attr_t newmode) return _traceattr2(0, newmode); } +/* Trace 'int' return-values */ +attr_t _nc_retrace_attr_t(attr_t code) +{ + T((T_RETURN("%s"), _traceattr(code))); + return code; +} + char *_tracechtype2(int bufnum, chtype ch) { char *buf = _nc_trace_buf(bufnum, BUFSIZ); @@ -179,7 +166,7 @@ char *found = 0; {'.', "ACS_DARROW"}, /* arrow pointing down */ {'-', "ACS_UARROW"}, /* arrow pointing up */ {'h', "ACS_BOARD"}, /* board of squares */ - {'I', "ACS_LANTERN"}, /* lantern symbol */ + {'i', "ACS_LANTERN"}, /* lantern symbol */ {'0', "ACS_BLOCK"}, /* solid square block */ {'p', "ACS_S3"}, /* scan line 3 */ {'r', "ACS_S7"}, /* scan line 7 */