X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=Ada95%2Fgen%2Fgen.c;h=11ba3d73706a4417fcf966bf57183896043bfc3a;hp=0a093cf8cd7b2bfbfb0125cea644003abd21cde2;hb=refs%2Ftags%2Fv5.3;hpb=0eb88fc5281804773e2a0c7a488a4452463535ce diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c index 0a093cf8..11ba3d73 100644 --- a/Ada95/gen/gen.c +++ b/Ada95/gen/gen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -27,12 +27,13 @@ ****************************************************************************/ /**************************************************************************** - * Author: Juergen Pfeifer 1996 * + * Author: Juergen Pfeifer, 1996 * + * Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en * ****************************************************************************/ /* Version Control - $Revision: 1.29 $ + $Revision: 1.35 $ --------------------------------------------------------------------------*/ /* This program generates various record structures and constants from the @@ -170,7 +171,7 @@ static void gen_chtype_rep(const char *name) chtype_rep("Ch",A_CHARTEXT); chtype_rep("Color",A_COLOR); chtype_rep("Attr",(A_ATTRIBUTES&~A_COLOR)); - printf(" end record;\n for %s'Size use %d;\n",name,8*sizeof(chtype)); + printf(" end record;\n for %s'Size use %ld;\n", name, (long)(8*sizeof(chtype))); printf(" -- Please note: this rep. clause is generated and may be\n"); printf(" -- different on your system.\n"); } @@ -218,50 +219,53 @@ static void gen_mrep_rep(const char *name) 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. + */ static const name_attribute_pair nap[] = { -#ifdef A_STANDOUT +#if A_STANDOUT {"Stand_Out", A_STANDOUT}, #endif -#ifdef A_UNDERLINE +#if A_UNDERLINE {"Under_Line", A_UNDERLINE}, #endif -#ifdef A_REVERSE +#if A_REVERSE {"Reverse_Video", A_REVERSE}, #endif -#ifdef A_BLINK +#if A_BLINK {"Blink", A_BLINK}, #endif -#ifdef A_DIM +#if A_DIM {"Dim_Character", A_DIM}, #endif -#ifdef A_BOLD +#if A_BOLD {"Bold_Character", A_BOLD}, #endif -#ifdef A_ALTCHARSET +#if A_ALTCHARSET {"Alternate_Character_Set", A_ALTCHARSET}, #endif -#ifdef A_INVIS +#if A_INVIS {"Invisible_Character", A_INVIS}, #endif -#ifdef A_PROTECT +#if A_PROTECT {"Protected_Character", A_PROTECT}, #endif -#ifdef A_HORIZONTAL +#if A_HORIZONTAL {"Horizontal", A_HORIZONTAL}, #endif -#ifdef A_LEFT +#if A_LEFT {"Left", A_LEFT}, #endif -#ifdef A_LOW +#if A_LOW {"Low", A_LOW}, #endif -#ifdef A_RIGHT +#if A_RIGHT {"Right", A_RIGHT}, #endif -#ifdef A_TOP +#if A_TOP {"Top", A_TOP}, #endif -#ifdef A_VERTICAL +#if A_VERTICAL {"Vertical", A_VERTICAL}, #endif {(char *)0, 0} @@ -282,6 +286,26 @@ static void gen_attr_set( const char *name ) gen_reps (nap, name, (len+7)/8, little_endian?start:0); } +static void gen_trace(const char *name) +{ + static const name_attribute_pair nap[] = { + {"Times", TRACE_TIMES}, + {"Tputs", TRACE_TPUTS}, + {"Update", TRACE_UPDATE}, + {"Cursor_Move", TRACE_MOVE}, + {"Character_Output", TRACE_CHARPUT}, + {"Calls", TRACE_CALLS}, + {"Virtual_Puts", TRACE_VIRTPUT}, + {"Input_Events", TRACE_IEVENT}, + {"TTY_State", TRACE_BITS}, + {"Internal_Calls", TRACE_ICALLS}, + {"Character_Calls", TRACE_CCALLS}, + {"Termcap_TermInfo", TRACE_DATABASE}, + {(char *)0, 0} + }; + gen_reps(nap,name,sizeof(int),0); +} + static void gen_menu_opt_rep(const char *name) { static const name_attribute_pair nap[] = { @@ -934,6 +958,9 @@ void gen_mouse_events(void) #ifdef BUTTON_ALT GEN_MEVENT(BUTTON_ALT); #endif +#ifdef REPORT_MOUSE_POSITION + GEN_MEVENT(REPORT_MOUSE_POSITION); +#endif #ifdef ALL_MOUSE_EVENTS GEN_MEVENT(ALL_MOUSE_EVENTS); #endif @@ -1009,14 +1036,19 @@ static void mouse_basedefs(void) */ static void color_def (const char *name, int value) { - printf(" %-8s : constant Color_Number := %d;\n",name,value); + printf(" %-16s : constant Color_Number := %d;\n",name,value); } +#define HAVE_USE_DEFAULT_COLORS 1 + /* * Generate all color definitions */ static void gen_color (void) { +#ifdef HAVE_USE_DEFAULT_COLORS + color_def ("Default_Color",-1); +#endif #ifdef COLOR_BLACK color_def ("Black",COLOR_BLACK); #endif @@ -1048,7 +1080,6 @@ static void gen_color (void) */ static void gen_linkopts (void) { - printf(" pragma Linker_Options (\"-lAdaCurses%s\");\n", model); printf(" pragma Linker_Options (\"-lncurses%s\");\n", model); } @@ -1101,19 +1132,19 @@ eti_gen(char*buf, int code, const char* name, int* etimin, int* etimax) return strlen(buf); } -#define GEN_OFFSET(member,itype) \ - if (sizeof(((WINDOW*)0)->member)==sizeof(itype)) { \ - o = offsetof(WINDOW, member); \ - if ((o%sizeof(itype) == 0)) { \ - printf(" Offset%-*s : constant Natural := %2d; -- %s\n", \ - 8, #member, o/sizeof(itype),#itype); \ - } \ +#define GEN_OFFSET(member,itype) \ + if (sizeof(((WINDOW*)0)->member)==sizeof(itype)) { \ + o = offsetof(WINDOW, member); \ + if ((o%sizeof(itype) == 0)) { \ + printf(" Offset%-*s : constant Natural := %2ld; -- %s\n", \ + 12, #member, o/sizeof(itype),#itype); \ + } \ } static void gen_offsets(void) { - int o; + long o; const char* s_bool = ""; GEN_OFFSET(_maxy,short); @@ -1126,22 +1157,46 @@ gen_offsets(void) GEN_OFFSET(_pary,int); GEN_OFFSET(_parx,int); if (sizeof(bool) == sizeof(char)) { + GEN_OFFSET(_notimeout,char); + GEN_OFFSET(_clear,char); + GEN_OFFSET(_leaveok,char); GEN_OFFSET(_scroll,char); + GEN_OFFSET(_idlok,char); + GEN_OFFSET(_idcok,char); + GEN_OFFSET(_immed,char); + GEN_OFFSET(_sync,char); + GEN_OFFSET(_use_keypad,char); s_bool = "char"; } else if (sizeof(bool) == sizeof(short)) { + GEN_OFFSET(_notimeout,short); + GEN_OFFSET(_clear,short); + GEN_OFFSET(_leaveok,short); GEN_OFFSET(_scroll,short); + GEN_OFFSET(_idlok,short); + GEN_OFFSET(_idcok,short); + GEN_OFFSET(_immed,short); + GEN_OFFSET(_sync,short); + GEN_OFFSET(_use_keypad,short); s_bool = "short"; } else if (sizeof(bool) == sizeof(int)) { + GEN_OFFSET(_notimeout,int); + GEN_OFFSET(_clear,int); + GEN_OFFSET(_leaveok,int); GEN_OFFSET(_scroll,int); + GEN_OFFSET(_idlok,int); + GEN_OFFSET(_idcok,int); + GEN_OFFSET(_immed,int); + GEN_OFFSET(_sync,int); + GEN_OFFSET(_use_keypad,int); s_bool = "int"; } - printf(" Sizeof%-*s : constant Natural := %2d; -- %s\n", - 8, "_bool",sizeof(bool),"bool"); + 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", - 8, "_XY",1,"int"); + 12, "_XY",1,"int"); printf("\n"); printf(" type Curses_Bool is mod 2 ** Interfaces.C.%s'Size;\n",s_bool); } @@ -1210,6 +1265,9 @@ int main(int argc, char *argv[]) case 'V': /* generate version info */ gen_version_info(); break; + case 'T': /* generate the Trace info */ + gen_trace("Trace_Attribute_Set"); + break; default: break; }