X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=Ada95%2Fgen%2Fgen.c;h=c105c495987c95bc8e739182f3f0a664da6502e3;hp=31391864d1b0f98e1fc66ef02279bf87ee39d78c;hb=7bffc4856038714ab0ce0999986d25bb8ca1b890;hpb=275aeb5889b10a51796b311f3773aeaea4d0a754 diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c index 31391864..c105c495 100644 --- a/Ada95/gen/gen.c +++ b/Ada95/gen/gen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2013 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 * @@ -32,7 +32,7 @@ /* Version Control - $Id: gen.c,v 1.54 2010/09/04 21:19:50 tom Exp $ + $Id: gen.c,v 1.61 2013/08/24 23:30:46 tom Exp $ --------------------------------------------------------------------------*/ /* This program generates various record structures and constants from the @@ -124,16 +124,15 @@ gen_reps( int len, /* size of the record in bytes */ int bias) { - int i, n, l, cnt = 0, low, high; + const int len_bits = (8 * len); + int i, l, low, high; int width = strlen(RES_NAME) + 3; unsigned long a; - unsigned long mask = 0; assert(nap != NULL); for (i = 0; nap[i].name != (char *)0; i++) { - cnt++; l = (int)strlen(nap[i].name); if (l > width) width = l; @@ -155,16 +154,15 @@ gen_reps( for (i = 0; nap[i].name != (char *)0; i++) { a = nap[i].attr; - mask |= a; l = find_pos((char *)&a, sizeof(a), &low, &high); if (l >= 0) printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name, low - bias, high - bias); } - i = 1; - n = cnt; printf(" end record;\n"); - printf(" for %s'Size use %d;\n", name, 8 * len); + printf(" pragma Warnings (Off);"); + printf(" for %s'Size use %d;\n", name, len_bits); + printf(" pragma Warnings (On);\n"); printf(" -- Please note: this rep. clause is generated and may be\n"); printf(" -- different on your system."); } @@ -241,53 +239,56 @@ static void gen_attr_set(const char *name) { /* All of the A_xxx symbols are defined in ncurses, but not all are nonzero - * if "configure --enable-widec" is specified. + * if "configure --enable-widec" is not specified. Originally (in + * 1999-2000), the ifdef's also were needed since the proposed bit-layout + * for wide characters allocated 16-bits for A_CHARTEXT, leaving too few + * bits for a few of the A_xxx symbols. */ static const name_attribute_pair nap[] = { -#if A_STANDOUT +#ifdef A_STANDOUT {"Stand_Out", A_STANDOUT}, #endif -#if A_UNDERLINE +#ifdef A_UNDERLINE {"Under_Line", A_UNDERLINE}, #endif -#if A_REVERSE +#ifdef A_REVERSE {"Reverse_Video", A_REVERSE}, #endif -#if A_BLINK +#ifdef A_BLINK {"Blink", A_BLINK}, #endif -#if A_DIM +#ifdef A_DIM {"Dim_Character", A_DIM}, #endif -#if A_BOLD +#ifdef A_BOLD {"Bold_Character", A_BOLD}, #endif -#if A_ALTCHARSET +#ifdef A_ALTCHARSET {"Alternate_Character_Set", A_ALTCHARSET}, #endif -#if A_INVIS +#ifdef A_INVIS {"Invisible_Character", A_INVIS}, #endif -#if A_PROTECT +#ifdef A_PROTECT {"Protected_Character", A_PROTECT}, #endif -#if A_HORIZONTAL +#ifdef A_HORIZONTAL {"Horizontal", A_HORIZONTAL}, #endif -#if A_LEFT +#ifdef A_LEFT {"Left", A_LEFT}, #endif -#if A_LOW +#ifdef A_LOW {"Low", A_LOW}, #endif -#if A_RIGHT +#ifdef A_RIGHT {"Right", A_RIGHT}, #endif -#if A_TOP +#ifdef A_TOP {"Top", A_TOP}, #endif -#if A_VERTICAL +#ifdef A_VERTICAL {"Vertical", A_VERTICAL}, #endif {(char *)0, 0} @@ -332,6 +333,7 @@ gen_trace(const char *name) {"Internal_Calls", TRACE_ICALLS}, {"Character_Calls", TRACE_CCALLS}, {"Termcap_TermInfo", TRACE_DATABASE}, + {"Attributes_And_Colors", TRACE_ATTRS}, {(char *)0, 0} }; gen_reps(nap, name, sizeof(int), 0); @@ -770,7 +772,7 @@ gen_keydefs(int mode) static void acs_def(const char *name, chtype *a) { - int c = a - &acs_map[0]; + int c = (int)(a - &acs_map[0]); printf(" %-24s : constant Character := ", name); if (isprint(UChar(c)) && (c != '`')) @@ -1278,12 +1280,6 @@ gen_offsets(void) printf(" Sizeof%-*s : constant Natural := %2ld; -- %s\n", 12, "_bool", (long)sizeof(bool), "bool"); - /* In ncurses _maxy and _maxx needs an offset for the "public" - * value - */ - printf(" Offset%-*s : constant Natural := %2d; -- %s\n", - 12, "_XY", 1, "int"); - printf("\n"); printf(" type Curses_Bool is mod 2 ** Interfaces.C.%s'Size;\n", s_bool); }