X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=Ada95%2Fgen%2Fgen.c;h=682f7101236a99390f47d0cfeca34a3ff32d90c6;hp=86d3b69748476865fdba05fabda165435c5b0d9f;hb=c3e8eb8e7407c4173394c2f52c635ed86327edc6;hpb=9817912d803dae0223ada5ab28c6df521800d4bb diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c index 86d3b697..682f7101 100644 --- a/Ada95/gen/gen.c +++ b/Ada95/gen/gen.c @@ -32,7 +32,7 @@ /* Version Control - $Id: gen.c,v 1.55 2011/03/05 20:24:22 tom Exp $ + $Id: gen.c,v 1.60 2011/04/30 19:47:19 Nicolas.Boulenguez Exp $ --------------------------------------------------------------------------*/ /* This program generates various record structures and constants from the @@ -124,19 +124,15 @@ gen_reps( int len, /* size of the record in bytes */ int bias) { - const char *unused_name = "Unused"; - int long_bits = (8 * (int)sizeof(unsigned long)); - int len_bits = (8 * len); - int i, j, 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; @@ -147,32 +143,8 @@ gen_reps( printf(" record\n"); for (i = 0; nap[i].name != (char *)0; i++) { - mask |= nap[i].attr; printf(" %-*s : Boolean;\n", width, nap[i].name); } - - /* - * Compute a mask for the unused bits in this target. - */ - mask = ~mask; - /* - * Bits in the biased area are unused by the target. - */ - for (j = 0; j < bias; ++j) - { - mask &= (unsigned long)(~(1L << j)); - } - /* - * Bits past the target's size are really unused. - */ - for (j = len_bits + bias; j < long_bits; ++j) - { - mask &= (unsigned long)(~(1L << j)); - } - if (mask != 0) - { - printf(" %-*s : Boolean;\n", width, unused_name); - } printf(" end record;\n"); printf(" pragma Convention (C, %s);\n\n", name); @@ -187,17 +159,10 @@ gen_reps( printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name, low - bias, high - bias); } - if (mask != 0) - { - l = find_pos((char *)&mask, sizeof(mask), &low, &high); - if (l >= 0) - printf(" %-*s at 0 range %2d .. %2d;\n", width, unused_name, - low - bias, high - bias); - } - i = 1; - n = cnt; printf(" end record;\n"); + 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."); } @@ -274,7 +239,10 @@ 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[] = { @@ -365,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); @@ -803,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 != '`')) @@ -1311,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); }