ncursesw-morphos/Ada95/gen/gen.c

1536 lines
38 KiB
C
Raw Normal View History

1998-03-01 12:21:12 +08:00
/****************************************************************************
* Copyright (c) 1998,2009,2010 Free Software Foundation, Inc. *
1998-03-01 12:21:12 +08:00
* *
* 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. *
****************************************************************************/
/****************************************************************************
2002-10-13 11:35:53 +08:00
* Author: Juergen Pfeifer, 1996 *
1998-03-01 12:21:12 +08:00
****************************************************************************/
/*
1997-05-15 12:00:00 +08:00
Version Control
$Id: gen.c,v 1.52 2010/02/20 21:59:56 tom Exp $
1997-05-15 12:00:00 +08:00
--------------------------------------------------------------------------*/
/*
This program generates various record structures and constants from the
ncurses header file for the Ada95 packages. Essentially it produces
Ada95 source on stdout, which is then merged using m4 into a template
to produce the real source.
*/
#ifdef HAVE_CONFIG_H
#include <ncurses_cfg.h>
#else
#include <ncurses.h>
#define HAVE_USE_DEFAULT_COLORS 1
#endif
1999-10-24 12:32:42 +08:00
#include <stdlib.h>
#include <stddef.h>
1997-05-15 12:00:00 +08:00
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <menu.h>
#include <form.h>
#define RES_NAME "Reserved"
1999-10-24 12:32:42 +08:00
static const char *model = "";
1997-05-15 12:00:00 +08:00
static int little_endian = 0;
2005-10-10 02:41:57 +08:00
typedef struct
{
const char *name;
unsigned long attr;
}
name_attribute_pair;
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
static int
find_pos(char *s, unsigned len, int *low, int *high)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
unsigned int i, j;
1997-05-15 12:00:00 +08:00
int l = 0;
*high = -1;
*low = (int)(8 * len);
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
for (i = 0; i < len; i++, s++)
1997-05-15 12:00:00 +08:00
{
if (*s)
{
2005-10-10 02:41:57 +08:00
for (j = 0; j < 8 * sizeof(char); j++)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
if (((little_endian && ((*s) & 0x01)) ||
(!little_endian && ((*s) & 0x80))))
1997-05-15 12:00:00 +08:00
{
if (l > *high)
*high = l;
if (l < *low)
*low = l;
}
l++;
if (little_endian)
{
*s >>= 1;
}
1997-05-15 12:00:00 +08:00
else
{
*s = (char)(*s << 1);
}
1997-05-15 12:00:00 +08:00
}
}
else
l += 8;
}
return (*high >= 0 && (*low <= *high)) ? *low : -1;
}
1998-03-01 12:21:12 +08:00
/*
* This helper routine generates a representation clause for a
* record type defined in the binding.
* We are only dealing with record types which are of 32 or 16
* bit size, i.e. they fit into an (u)int or a (u)short.
*/
1999-10-24 12:32:42 +08:00
static void
gen_reps(
const name_attribute_pair * nap, /* array of name_attribute_pair records */
const char *name, /* name of the represented record type */
int len, /* size of the record in bytes */
int bias)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
int i, n, l, cnt = 0, low, high;
1999-10-24 12:32:42 +08:00
int width = strlen(RES_NAME) + 3;
unsigned long a;
unsigned long mask = 0;
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
assert(nap != NULL);
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
for (i = 0; nap[i].name != (char *)0; i++)
1997-05-15 12:00:00 +08:00
{
cnt++;
l = (int)strlen(nap[i].name);
2005-10-10 02:41:57 +08:00
if (l > width)
1997-05-15 12:00:00 +08:00
width = l;
}
2005-10-10 02:41:57 +08:00
assert(width > 0);
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
printf(" type %s is\n", name);
1997-05-15 12:00:00 +08:00
printf(" record\n");
2005-10-10 02:41:57 +08:00
for (i = 0; nap[i].name != (char *)0; i++)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
printf(" %-*s : Boolean;\n", width, nap[i].name);
1997-05-15 12:00:00 +08:00
}
printf(" end record;\n");
2005-10-10 02:41:57 +08:00
printf(" pragma Convention (C, %s);\n\n", name);
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
printf(" for %s use\n", name);
1997-05-15 12:00:00 +08:00
printf(" record\n");
2005-10-10 02:41:57 +08:00
for (i = 0; nap[i].name != (char *)0; i++)
1997-05-15 12:00:00 +08:00
{
a = nap[i].attr;
mask |= a;
2005-10-10 02:41:57 +08:00
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);
1997-05-15 12:00:00 +08:00
}
2005-10-10 02:41:57 +08:00
i = 1;
n = cnt;
1997-05-15 12:00:00 +08:00
printf(" end record;\n");
2005-10-10 02:41:57 +08:00
printf(" for %s'Size use %d;\n", name, 8 * len);
1997-05-15 12:00:00 +08:00
printf(" -- Please note: this rep. clause is generated and may be\n");
printf(" -- different on your system.");
}
2005-10-10 02:41:57 +08:00
static void
chtype_rep(const char *name, attr_t mask)
1997-05-15 12:00:00 +08:00
{
attr_t x = (attr_t)-1;
1999-10-24 12:32:42 +08:00
attr_t t = x & mask;
1997-05-15 12:00:00 +08:00
int low, high;
2005-10-10 02:41:57 +08:00
int l = find_pos((char *)&t, sizeof(t), &low, &high);
if (l >= 0)
printf(" %-5s at 0 range %2d .. %2d;\n", name, low, high);
1997-05-15 12:00:00 +08:00
}
2005-10-10 02:41:57 +08:00
static void
gen_chtype_rep(const char *name)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
printf(" for %s use\n record\n", 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 %ld;\n",
name, (long)(8 * sizeof(chtype)));
1997-05-15 12:00:00 +08:00
printf(" -- Please note: this rep. clause is generated and may be\n");
printf(" -- different on your system.\n");
}
2005-10-10 02:41:57 +08:00
static void
mrep_rep(const char *name, void *rec)
1997-05-15 12:00:00 +08:00
{
int low, high;
int l = find_pos((char *)rec, sizeof(MEVENT), &low, &high);
2005-10-10 02:41:57 +08:00
if (l >= 0)
printf(" %-7s at 0 range %3d .. %3d;\n", name, low, high);
}
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
static void
gen_mrep_rep(const char *name)
1997-05-15 12:00:00 +08:00
{
MEVENT x;
2005-10-10 02:41:57 +08:00
printf(" for %s use\n record\n", name);
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
memset(&x, 0, sizeof(x));
1997-05-15 12:00:00 +08:00
x.id = -1;
2005-10-10 02:41:57 +08:00
mrep_rep("Id", &x);
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
memset(&x, 0, sizeof(x));
1997-05-15 12:00:00 +08:00
x.x = -1;
2005-10-10 02:41:57 +08:00
mrep_rep("X", &x);
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
memset(&x, 0, sizeof(x));
1997-05-15 12:00:00 +08:00
x.y = -1;
2005-10-10 02:41:57 +08:00
mrep_rep("Y", &x);
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
memset(&x, 0, sizeof(x));
1997-05-15 12:00:00 +08:00
x.z = -1;
2005-10-10 02:41:57 +08:00
mrep_rep("Z", &x);
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
memset(&x, 0, sizeof(x));
x.bstate = (mmask_t) - 1;
2005-10-10 02:41:57 +08:00
mrep_rep("Bstate", &x);
1997-05-15 12:00:00 +08:00
printf(" end record;\n");
printf(" -- Please note: this rep. clause is generated and may be\n");
printf(" -- different on your system.\n");
}
2005-10-10 02:41:57 +08:00
static void
gen_attr_set(const char *name)
1997-05-15 12:00:00 +08:00
{
2000-07-09 10:46:08 +08:00
/* All of the A_xxx symbols are defined in ncurses, but not all are nonzero
* if "configure --enable-widec" is specified.
*/
2005-10-10 02:41:57 +08:00
static const name_attribute_pair nap[] =
{
2000-07-09 10:46:08 +08:00
#if A_STANDOUT
2005-10-10 02:41:57 +08:00
{"Stand_Out", A_STANDOUT},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_UNDERLINE
2005-10-10 02:41:57 +08:00
{"Under_Line", A_UNDERLINE},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_REVERSE
2005-10-10 02:41:57 +08:00
{"Reverse_Video", A_REVERSE},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_BLINK
2005-10-10 02:41:57 +08:00
{"Blink", A_BLINK},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_DIM
2005-10-10 02:41:57 +08:00
{"Dim_Character", A_DIM},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_BOLD
2005-10-10 02:41:57 +08:00
{"Bold_Character", A_BOLD},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_ALTCHARSET
1997-05-15 12:00:00 +08:00
{"Alternate_Character_Set", A_ALTCHARSET},
#endif
2000-07-09 10:46:08 +08:00
#if A_INVIS
2005-10-10 02:41:57 +08:00
{"Invisible_Character", A_INVIS},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_PROTECT
2005-10-10 02:41:57 +08:00
{"Protected_Character", A_PROTECT},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_HORIZONTAL
2005-10-10 02:41:57 +08:00
{"Horizontal", A_HORIZONTAL},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_LEFT
2005-10-10 02:41:57 +08:00
{"Left", A_LEFT},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_LOW
2005-10-10 02:41:57 +08:00
{"Low", A_LOW},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_RIGHT
2005-10-10 02:41:57 +08:00
{"Right", A_RIGHT},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_TOP
2005-10-10 02:41:57 +08:00
{"Top", A_TOP},
1997-05-15 12:00:00 +08:00
#endif
2000-07-09 10:46:08 +08:00
#if A_VERTICAL
2005-10-10 02:41:57 +08:00
{"Vertical", A_VERTICAL},
1997-05-15 12:00:00 +08:00
#endif
2005-10-10 02:41:57 +08:00
{(char *)0, 0}
1997-05-15 12:00:00 +08:00
};
1999-10-24 12:32:42 +08:00
chtype attr = A_ATTRIBUTES & ~A_COLOR;
2005-10-10 02:41:57 +08:00
int start = -1;
int len = 0;
int i;
chtype set;
2005-10-10 02:41:57 +08:00
for (i = 0; i < (int)(8 * sizeof(chtype)); i++)
{
set = (attr & 1);
2005-10-10 02:41:57 +08:00
if (set)
{
if (start < 0)
start = i;
if (start >= 0)
{
len++;
}
}
attr = attr >> 1;
1999-10-24 12:32:42 +08:00
}
2005-10-10 02:41:57 +08:00
gen_reps(nap, name, (len + 7) / 8, little_endian ? start : 0);
1997-05-15 12:00:00 +08:00
}
2005-10-10 02:41:57 +08:00
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}
2002-10-13 11:35:53 +08:00
};
2005-10-10 02:41:57 +08:00
gen_reps(nap, name, sizeof(int), 0);
2002-10-13 11:35:53 +08:00
}
2005-10-10 02:41:57 +08:00
static void
gen_menu_opt_rep(const char *name)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
static const name_attribute_pair nap[] =
{
1997-05-15 12:00:00 +08:00
#ifdef O_ONEVALUE
{"One_Valued", O_ONEVALUE},
#endif
#ifdef O_SHOWDESC
{"Show_Descriptions", O_SHOWDESC},
#endif
#ifdef O_ROWMAJOR
{"Row_Major_Order", O_ROWMAJOR},
#endif
#ifdef O_IGNORECASE
{"Ignore_Case", O_IGNORECASE},
#endif
#ifdef O_SHOWMATCH
{"Show_Matches", O_SHOWMATCH},
#endif
#ifdef O_NONCYCLIC
{"Non_Cyclic", O_NONCYCLIC},
#endif
{(char *)0, 0}
};
2005-10-10 02:41:57 +08:00
gen_reps(nap, name, sizeof(int), 0);
1997-05-15 12:00:00 +08:00
}
2005-10-10 02:41:57 +08:00
static void
gen_item_opt_rep(const char *name)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
static const name_attribute_pair nap[] =
{
1997-05-15 12:00:00 +08:00
#ifdef O_SELECTABLE
{"Selectable", O_SELECTABLE},
#endif
2005-10-10 02:41:57 +08:00
{(char *)0, 0}
1999-10-24 12:32:42 +08:00
};
2005-10-10 02:41:57 +08:00
gen_reps(nap, name, sizeof(int), 0);
1997-05-15 12:00:00 +08:00
}
2005-10-10 02:41:57 +08:00
static void
gen_form_opt_rep(const char *name)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
static const name_attribute_pair nap[] =
{
1997-05-15 12:00:00 +08:00
#ifdef O_NL_OVERLOAD
{"NL_Overload", O_NL_OVERLOAD},
#endif
#ifdef O_BS_OVERLOAD
{"BS_Overload", O_BS_OVERLOAD},
#endif
2005-10-10 02:41:57 +08:00
{(char *)0, 0}
1997-05-15 12:00:00 +08:00
};
2005-10-10 02:41:57 +08:00
gen_reps(nap, name, sizeof(int), 0);
1997-05-15 12:00:00 +08:00
}
1998-03-01 12:21:12 +08:00
/*
* Generate the representation clause for the Field_Option_Set record
*/
2005-10-10 02:41:57 +08:00
static void
gen_field_opt_rep(const char *name)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
static const name_attribute_pair nap[] =
{
1997-05-15 12:00:00 +08:00
#ifdef O_VISIBLE
2005-10-10 02:41:57 +08:00
{"Visible", O_VISIBLE},
1997-05-15 12:00:00 +08:00
#endif
#ifdef O_ACTIVE
2005-10-10 02:41:57 +08:00
{"Active", O_ACTIVE},
1997-05-15 12:00:00 +08:00
#endif
#ifdef O_PUBLIC
2005-10-10 02:41:57 +08:00
{"Public", O_PUBLIC},
1997-05-15 12:00:00 +08:00
#endif
#ifdef O_EDIT
2005-10-10 02:41:57 +08:00
{"Edit", O_EDIT},
1997-05-15 12:00:00 +08:00
#endif
#ifdef O_WRAP
2005-10-10 02:41:57 +08:00
{"Wrap", O_WRAP},
1997-05-15 12:00:00 +08:00
#endif
#ifdef O_BLANK
2005-10-10 02:41:57 +08:00
{"Blank", O_BLANK},
1997-05-15 12:00:00 +08:00
#endif
#ifdef O_AUTOSKIP
2005-10-10 02:41:57 +08:00
{"Auto_Skip", O_AUTOSKIP},
1997-05-15 12:00:00 +08:00
#endif
#ifdef O_NULLOK
2005-10-10 02:41:57 +08:00
{"Null_Ok", O_NULLOK},
1997-05-15 12:00:00 +08:00
#endif
#ifdef O_PASSOK
2005-10-10 02:41:57 +08:00
{"Pass_Ok", O_PASSOK},
1997-05-15 12:00:00 +08:00
#endif
#ifdef O_STATIC
2005-10-10 02:41:57 +08:00
{"Static", O_STATIC},
1997-05-15 12:00:00 +08:00
#endif
{(char *)0, 0}
};
2005-10-10 02:41:57 +08:00
gen_reps(nap, name, sizeof(int), 0);
1997-05-15 12:00:00 +08:00
}
1998-03-01 12:21:12 +08:00
/*
* Generate a single key code constant definition.
*/
2005-10-10 02:41:57 +08:00
static void
keydef(const char *name, const char *old_name, int value, int mode)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
if (mode == 0) /* Generate the new name */
printf(" %-30s : constant Special_Key_Code := 8#%3o#;\n", name, value);
1997-05-15 12:00:00 +08:00
else
2005-10-10 02:41:57 +08:00
{ /* generate the old name, but only if it doesn't conflict with the old
* name (Ada95 isn't case sensitive!)
*/
const char *s = old_name;
const char *t = name;
while (*s && *t && (toupper(*s++) == toupper(*t++)));
1997-05-15 12:00:00 +08:00
if (*s || *t)
2005-10-10 02:41:57 +08:00
printf(" %-16s : Special_Key_Code renames %s;\n", old_name, name);
1997-05-15 12:00:00 +08:00
}
}
1999-10-24 12:32:42 +08:00
1998-03-01 12:21:12 +08:00
/*
* Generate constants for the key codes. When called with mode==0, a
* complete list with nice constant names in proper casing style will
* be generated. Otherwise a list of old (i.e. C-style) names will be
* generated, given that the name wasn't already defined in the "nice"
* list.
*/
2005-10-10 02:41:57 +08:00
static void
gen_keydefs(int mode)
1997-05-15 12:00:00 +08:00
{
char buf[16];
char obuf[16];
int i;
#ifdef KEY_CODE_YES
2005-10-10 02:41:57 +08:00
keydef("Key_Code_Yes", "KEY_CODE_YES", KEY_CODE_YES, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_MIN
2005-10-10 02:41:57 +08:00
keydef("Key_Min", "KEY_MIN", KEY_MIN, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_BREAK
2005-10-10 02:41:57 +08:00
keydef("Key_Break", "KEY_BREAK", KEY_BREAK, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_DOWN
2005-10-10 02:41:57 +08:00
keydef("Key_Cursor_Down", "KEY_DOWN", KEY_DOWN, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_UP
2005-10-10 02:41:57 +08:00
keydef("Key_Cursor_Up", "KEY_UP", KEY_UP, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_LEFT
2005-10-10 02:41:57 +08:00
keydef("Key_Cursor_Left", "KEY_LEFT", KEY_LEFT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_RIGHT
2005-10-10 02:41:57 +08:00
keydef("Key_Cursor_Right", "KEY_RIGHT", KEY_RIGHT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_HOME
2005-10-10 02:41:57 +08:00
keydef("Key_Home", "KEY_HOME", KEY_HOME, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_BACKSPACE
2005-10-10 02:41:57 +08:00
keydef("Key_Backspace", "KEY_BACKSPACE", KEY_BACKSPACE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_F0
2005-10-10 02:41:57 +08:00
keydef("Key_F0", "KEY_F0", KEY_F0, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_F
2005-10-10 02:41:57 +08:00
for (i = 1; i <= 24; i++)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
sprintf(buf, "Key_F%d", i);
sprintf(obuf, "KEY_F%d", i);
keydef(buf, obuf, KEY_F(i), mode);
1997-05-15 12:00:00 +08:00
}
#endif
#ifdef KEY_DL
2005-10-10 02:41:57 +08:00
keydef("Key_Delete_Line", "KEY_DL", KEY_DL, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_IL
2005-10-10 02:41:57 +08:00
keydef("Key_Insert_Line", "KEY_IL", KEY_IL, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_DC
2005-10-10 02:41:57 +08:00
keydef("Key_Delete_Char", "KEY_DC", KEY_DC, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_IC
2005-10-10 02:41:57 +08:00
keydef("Key_Insert_Char", "KEY_IC", KEY_IC, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_EIC
2005-10-10 02:41:57 +08:00
keydef("Key_Exit_Insert_Mode", "KEY_EIC", KEY_EIC, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_CLEAR
2005-10-10 02:41:57 +08:00
keydef("Key_Clear_Screen", "KEY_CLEAR", KEY_CLEAR, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_EOS
2005-10-10 02:41:57 +08:00
keydef("Key_Clear_End_Of_Screen", "KEY_EOS", KEY_EOS, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_EOL
2005-10-10 02:41:57 +08:00
keydef("Key_Clear_End_Of_Line", "KEY_EOL", KEY_EOL, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SF
2005-10-10 02:41:57 +08:00
keydef("Key_Scroll_1_Forward", "KEY_SF", KEY_SF, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SR
2005-10-10 02:41:57 +08:00
keydef("Key_Scroll_1_Backward", "KEY_SR", KEY_SR, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_NPAGE
2005-10-10 02:41:57 +08:00
keydef("Key_Next_Page", "KEY_NPAGE", KEY_NPAGE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_PPAGE
2005-10-10 02:41:57 +08:00
keydef("Key_Previous_Page", "KEY_PPAGE", KEY_PPAGE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_STAB
2005-10-10 02:41:57 +08:00
keydef("Key_Set_Tab", "KEY_STAB", KEY_STAB, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_CTAB
2005-10-10 02:41:57 +08:00
keydef("Key_Clear_Tab", "KEY_CTAB", KEY_CTAB, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_CATAB
2005-10-10 02:41:57 +08:00
keydef("Key_Clear_All_Tabs", "KEY_CATAB", KEY_CATAB, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_ENTER
2005-10-10 02:41:57 +08:00
keydef("Key_Enter_Or_Send", "KEY_ENTER", KEY_ENTER, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SRESET
2005-10-10 02:41:57 +08:00
keydef("Key_Soft_Reset", "KEY_SRESET", KEY_SRESET, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_RESET
2005-10-10 02:41:57 +08:00
keydef("Key_Reset", "KEY_RESET", KEY_RESET, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_PRINT
2005-10-10 02:41:57 +08:00
keydef("Key_Print", "KEY_PRINT", KEY_PRINT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_LL
2005-10-10 02:41:57 +08:00
keydef("Key_Bottom", "KEY_LL", KEY_LL, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_A1
2005-10-10 02:41:57 +08:00
keydef("Key_Upper_Left_Of_Keypad", "KEY_A1", KEY_A1, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_A3
2005-10-10 02:41:57 +08:00
keydef("Key_Upper_Right_Of_Keypad", "KEY_A3", KEY_A3, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_B2
2005-10-10 02:41:57 +08:00
keydef("Key_Center_Of_Keypad", "KEY_B2", KEY_B2, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_C1
2005-10-10 02:41:57 +08:00
keydef("Key_Lower_Left_Of_Keypad", "KEY_C1", KEY_C1, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_C3
2005-10-10 02:41:57 +08:00
keydef("Key_Lower_Right_Of_Keypad", "KEY_C3", KEY_C3, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_BTAB
2005-10-10 02:41:57 +08:00
keydef("Key_Back_Tab", "KEY_BTAB", KEY_BTAB, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_BEG
2005-10-10 02:41:57 +08:00
keydef("Key_Beginning", "KEY_BEG", KEY_BEG, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_CANCEL
2005-10-10 02:41:57 +08:00
keydef("Key_Cancel", "KEY_CANCEL", KEY_CANCEL, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_CLOSE
2005-10-10 02:41:57 +08:00
keydef("Key_Close", "KEY_CLOSE", KEY_CLOSE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_COMMAND
2005-10-10 02:41:57 +08:00
keydef("Key_Command", "KEY_COMMAND", KEY_COMMAND, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_COPY
2005-10-10 02:41:57 +08:00
keydef("Key_Copy", "KEY_COPY", KEY_COPY, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_CREATE
2005-10-10 02:41:57 +08:00
keydef("Key_Create", "KEY_CREATE", KEY_CREATE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_END
2005-10-10 02:41:57 +08:00
keydef("Key_End", "KEY_END", KEY_END, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_EXIT
2005-10-10 02:41:57 +08:00
keydef("Key_Exit", "KEY_EXIT", KEY_EXIT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_FIND
2005-10-10 02:41:57 +08:00
keydef("Key_Find", "KEY_FIND", KEY_FIND, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_HELP
2005-10-10 02:41:57 +08:00
keydef("Key_Help", "KEY_HELP", KEY_HELP, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_MARK
2005-10-10 02:41:57 +08:00
keydef("Key_Mark", "KEY_MARK", KEY_MARK, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_MESSAGE
2005-10-10 02:41:57 +08:00
keydef("Key_Message", "KEY_MESSAGE", KEY_MESSAGE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_MOVE
2005-10-10 02:41:57 +08:00
keydef("Key_Move", "KEY_MOVE", KEY_MOVE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_NEXT
2005-10-10 02:41:57 +08:00
keydef("Key_Next", "KEY_NEXT", KEY_NEXT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_OPEN
2005-10-10 02:41:57 +08:00
keydef("Key_Open", "KEY_OPEN", KEY_OPEN, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_OPTIONS
2005-10-10 02:41:57 +08:00
keydef("Key_Options", "KEY_OPTIONS", KEY_OPTIONS, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_PREVIOUS
2005-10-10 02:41:57 +08:00
keydef("Key_Previous", "KEY_PREVIOUS", KEY_PREVIOUS, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_REDO
2005-10-10 02:41:57 +08:00
keydef("Key_Redo", "KEY_REDO", KEY_REDO, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_REFERENCE
2005-10-10 02:41:57 +08:00
keydef("Key_Reference", "KEY_REFERENCE", KEY_REFERENCE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_REFRESH
2005-10-10 02:41:57 +08:00
keydef("Key_Refresh", "KEY_REFRESH", KEY_REFRESH, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_REPLACE
2005-10-10 02:41:57 +08:00
keydef("Key_Replace", "KEY_REPLACE", KEY_REPLACE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_RESTART
2005-10-10 02:41:57 +08:00
keydef("Key_Restart", "KEY_RESTART", KEY_RESTART, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_RESUME
2005-10-10 02:41:57 +08:00
keydef("Key_Resume", "KEY_RESUME", KEY_RESUME, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SAVE
2005-10-10 02:41:57 +08:00
keydef("Key_Save", "KEY_SAVE", KEY_SAVE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SBEG
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Begin", "KEY_SBEG", KEY_SBEG, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SCANCEL
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Cancel", "KEY_SCANCEL", KEY_SCANCEL, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SCOMMAND
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Command", "KEY_SCOMMAND", KEY_SCOMMAND, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SCOPY
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Copy", "KEY_SCOPY", KEY_SCOPY, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SCREATE
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Create", "KEY_SCREATE", KEY_SCREATE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SDC
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Delete_Char", "KEY_SDC", KEY_SDC, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SDL
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Delete_Line", "KEY_SDL", KEY_SDL, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SELECT
2005-10-10 02:41:57 +08:00
keydef("Key_Select", "KEY_SELECT", KEY_SELECT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SEND
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_End", "KEY_SEND", KEY_SEND, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SEOL
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Clear_End_Of_Line", "KEY_SEOL", KEY_SEOL, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SEXIT
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Exit", "KEY_SEXIT", KEY_SEXIT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SFIND
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Find", "KEY_SFIND", KEY_SFIND, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SHELP
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Help", "KEY_SHELP", KEY_SHELP, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SHOME
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Home", "KEY_SHOME", KEY_SHOME, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SIC
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Insert_Char", "KEY_SIC", KEY_SIC, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SLEFT
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Cursor_Left", "KEY_SLEFT", KEY_SLEFT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SMESSAGE
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Message", "KEY_SMESSAGE", KEY_SMESSAGE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SMOVE
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Move", "KEY_SMOVE", KEY_SMOVE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SNEXT
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Next_Page", "KEY_SNEXT", KEY_SNEXT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SOPTIONS
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Options", "KEY_SOPTIONS", KEY_SOPTIONS, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SPREVIOUS
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Previous_Page", "KEY_SPREVIOUS", KEY_SPREVIOUS, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SPRINT
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Print", "KEY_SPRINT", KEY_SPRINT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SREDO
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Redo", "KEY_SREDO", KEY_SREDO, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SREPLACE
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Replace", "KEY_SREPLACE", KEY_SREPLACE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SRIGHT
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Cursor_Right", "KEY_SRIGHT", KEY_SRIGHT, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SRSUME
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Resume", "KEY_SRSUME", KEY_SRSUME, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SSAVE
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Save", "KEY_SSAVE", KEY_SSAVE, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SSUSPEND
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Suspend", "KEY_SSUSPEND", KEY_SSUSPEND, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SUNDO
2005-10-10 02:41:57 +08:00
keydef("Key_Shift_Undo", "KEY_SUNDO", KEY_SUNDO, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_SUSPEND
2005-10-10 02:41:57 +08:00
keydef("Key_Suspend", "KEY_SUSPEND", KEY_SUSPEND, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_UNDO
2005-10-10 02:41:57 +08:00
keydef("Key_Undo", "KEY_UNDO", KEY_UNDO, mode);
1997-05-15 12:00:00 +08:00
#endif
#ifdef KEY_MOUSE
2005-10-10 02:41:57 +08:00
keydef("Key_Mouse", "KEY_MOUSE", KEY_MOUSE, mode);
1999-10-24 12:32:42 +08:00
#endif
1998-03-01 12:21:12 +08:00
#ifdef KEY_RESIZE
2005-10-10 02:41:57 +08:00
keydef("Key_Resize", "KEY_RESIZE", KEY_RESIZE, mode);
1999-10-24 12:32:42 +08:00
#endif
1997-05-15 12:00:00 +08:00
}
1998-03-01 12:21:12 +08:00
/*
* Generate a constant with the given name. The second parameter
* is a reference to the ACS character in the acs_map[] array and
* will be translated into an index.
*/
2005-10-10 02:41:57 +08:00
static void
acs_def(const char *name, chtype *a)
1997-05-15 12:00:00 +08:00
{
int c = a - &acs_map[0];
2005-10-10 02:41:57 +08:00
printf(" %-24s : constant Character := ", name);
if (isprint(c) && (c != '`'))
printf("'%c';\n", c);
1997-05-15 12:00:00 +08:00
else
2005-10-10 02:41:57 +08:00
printf("Character'Val (%d);\n", c);
1997-05-15 12:00:00 +08:00
}
1998-03-01 12:21:12 +08:00
/*
* Generate the constants for the ACS characters
*/
2005-10-10 02:41:57 +08:00
static void
gen_acs(void)
1997-05-15 12:00:00 +08:00
{
printf(" type C_ACS_Map is array (Character'Val (0) .. Character'Val (127))\n");
printf(" of Attributed_Character;\n");
#if USE_REENTRANT || BROKEN_LINKER
2007-04-08 09:10:28 +08:00
printf(" type C_ACS_Ptr is access C_ACS_Map;\n");
printf(" function ACS_Map return C_ACS_Ptr;\n");
printf(" pragma Import (C, ACS_Map, \""
NCURSES_WRAP_PREFIX
"acs_map\");\n");
#else
printf(" ACS_Map : C_ACS_Map;\n");
printf(" pragma Import (C, ACS_Map, \"acs_map\");\n");
#endif
printf(" --\n");
printf(" --\n");
printf(" -- Constants for several characters from the Alternate Character Set\n");
printf(" -- You must use these constants as indices into the ACS_Map array\n");
printf(" -- to get the corresponding attributed character at runtime.\n");
printf(" --\n");
1997-05-15 12:00:00 +08:00
#ifdef ACS_ULCORNER
2005-10-10 02:41:57 +08:00
acs_def("ACS_Upper_Left_Corner", &ACS_ULCORNER);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_LLCORNER
2005-10-10 02:41:57 +08:00
acs_def("ACS_Lower_Left_Corner", &ACS_LLCORNER);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_URCORNER
2005-10-10 02:41:57 +08:00
acs_def("ACS_Upper_Right_Corner", &ACS_URCORNER);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_LRCORNER
2005-10-10 02:41:57 +08:00
acs_def("ACS_Lower_Right_Corner", &ACS_LRCORNER);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_LTEE
2005-10-10 02:41:57 +08:00
acs_def("ACS_Left_Tee", &ACS_LTEE);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_RTEE
2005-10-10 02:41:57 +08:00
acs_def("ACS_Right_Tee", &ACS_RTEE);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_BTEE
2005-10-10 02:41:57 +08:00
acs_def("ACS_Bottom_Tee", &ACS_BTEE);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_TTEE
2005-10-10 02:41:57 +08:00
acs_def("ACS_Top_Tee", &ACS_TTEE);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_HLINE
2005-10-10 02:41:57 +08:00
acs_def("ACS_Horizontal_Line", &ACS_HLINE);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_VLINE
2005-10-10 02:41:57 +08:00
acs_def("ACS_Vertical_Line", &ACS_VLINE);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_PLUS
2005-10-10 02:41:57 +08:00
acs_def("ACS_Plus_Symbol", &ACS_PLUS);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_S1
2005-10-10 02:41:57 +08:00
acs_def("ACS_Scan_Line_1", &ACS_S1);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_S9
2005-10-10 02:41:57 +08:00
acs_def("ACS_Scan_Line_9", &ACS_S9);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_DIAMOND
2005-10-10 02:41:57 +08:00
acs_def("ACS_Diamond", &ACS_DIAMOND);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_CKBOARD
2005-10-10 02:41:57 +08:00
acs_def("ACS_Checker_Board", &ACS_CKBOARD);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_DEGREE
2005-10-10 02:41:57 +08:00
acs_def("ACS_Degree", &ACS_DEGREE);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_PLMINUS
2005-10-10 02:41:57 +08:00
acs_def("ACS_Plus_Minus", &ACS_PLMINUS);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_BULLET
2005-10-10 02:41:57 +08:00
acs_def("ACS_Bullet", &ACS_BULLET);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_LARROW
2005-10-10 02:41:57 +08:00
acs_def("ACS_Left_Arrow", &ACS_LARROW);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_RARROW
2005-10-10 02:41:57 +08:00
acs_def("ACS_Right_Arrow", &ACS_RARROW);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_DARROW
2005-10-10 02:41:57 +08:00
acs_def("ACS_Down_Arrow", &ACS_DARROW);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_UARROW
2005-10-10 02:41:57 +08:00
acs_def("ACS_Up_Arrow", &ACS_UARROW);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_BOARD
2005-10-10 02:41:57 +08:00
acs_def("ACS_Board_Of_Squares", &ACS_BOARD);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_LANTERN
2005-10-10 02:41:57 +08:00
acs_def("ACS_Lantern", &ACS_LANTERN);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_BLOCK
2005-10-10 02:41:57 +08:00
acs_def("ACS_Solid_Block", &ACS_BLOCK);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_S3
2005-10-10 02:41:57 +08:00
acs_def("ACS_Scan_Line_3", &ACS_S3);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_S7
2005-10-10 02:41:57 +08:00
acs_def("ACS_Scan_Line_7", &ACS_S7);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_LEQUAL
2005-10-10 02:41:57 +08:00
acs_def("ACS_Less_Or_Equal", &ACS_LEQUAL);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_GEQUAL
2005-10-10 02:41:57 +08:00
acs_def("ACS_Greater_Or_Equal", &ACS_GEQUAL);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_PI
2005-10-10 02:41:57 +08:00
acs_def("ACS_PI", &ACS_PI);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_NEQUAL
2005-10-10 02:41:57 +08:00
acs_def("ACS_Not_Equal", &ACS_NEQUAL);
1997-05-15 12:00:00 +08:00
#endif
#ifdef ACS_STERLING
2005-10-10 02:41:57 +08:00
acs_def("ACS_Sterling", &ACS_STERLING);
1997-05-15 12:00:00 +08:00
#endif
}
1999-10-24 12:32:42 +08:00
#define GEN_EVENT(name,value) \
printf(" %-25s : constant Event_Mask := 8#%011lo#;\n", \
#name, value)
#define GEN_MEVENT(name) \
printf(" %-25s : constant Event_Mask := 8#%011lo#;\n", \
#name, name)
static void
2005-10-10 02:41:57 +08:00
gen_mouse_events(void)
1999-10-24 12:32:42 +08:00
{
mmask_t all1 = 0;
mmask_t all2 = 0;
mmask_t all3 = 0;
mmask_t all4 = 0;
#ifdef BUTTON1_RELEASED
GEN_MEVENT(BUTTON1_RELEASED);
all1 |= BUTTON1_RELEASED;
#endif
#ifdef BUTTON1_PRESSED
GEN_MEVENT(BUTTON1_PRESSED);
all1 |= BUTTON1_PRESSED;
#endif
#ifdef BUTTON1_CLICKED
GEN_MEVENT(BUTTON1_CLICKED);
all1 |= BUTTON1_CLICKED;
#endif
#ifdef BUTTON1_DOUBLE_CLICKED
GEN_MEVENT(BUTTON1_DOUBLE_CLICKED);
all1 |= BUTTON1_DOUBLE_CLICKED;
#endif
#ifdef BUTTON1_TRIPLE_CLICKED
GEN_MEVENT(BUTTON1_TRIPLE_CLICKED);
all1 |= BUTTON1_TRIPLE_CLICKED;
#endif
#ifdef BUTTON1_RESERVED_EVENT
GEN_MEVENT(BUTTON1_RESERVED_EVENT);
all1 |= BUTTON1_RESERVED_EVENT;
#endif
#ifdef BUTTON2_RELEASED
GEN_MEVENT(BUTTON2_RELEASED);
all2 |= BUTTON2_RELEASED;
#endif
#ifdef BUTTON2_PRESSED
GEN_MEVENT(BUTTON2_PRESSED);
all2 |= BUTTON2_PRESSED;
#endif
#ifdef BUTTON2_CLICKED
GEN_MEVENT(BUTTON2_CLICKED);
all2 |= BUTTON2_CLICKED;
#endif
#ifdef BUTTON2_DOUBLE_CLICKED
GEN_MEVENT(BUTTON2_DOUBLE_CLICKED);
all2 |= BUTTON2_DOUBLE_CLICKED;
#endif
#ifdef BUTTON2_TRIPLE_CLICKED
GEN_MEVENT(BUTTON2_TRIPLE_CLICKED);
all2 |= BUTTON2_TRIPLE_CLICKED;
#endif
#ifdef BUTTON2_RESERVED_EVENT
GEN_MEVENT(BUTTON2_RESERVED_EVENT);
all2 |= BUTTON2_RESERVED_EVENT;
#endif
#ifdef BUTTON3_RELEASED
GEN_MEVENT(BUTTON3_RELEASED);
all3 |= BUTTON3_RELEASED;
#endif
#ifdef BUTTON3_PRESSED
GEN_MEVENT(BUTTON3_PRESSED);
all3 |= BUTTON3_PRESSED;
#endif
#ifdef BUTTON3_CLICKED
GEN_MEVENT(BUTTON3_CLICKED);
all3 |= BUTTON3_CLICKED;
#endif
#ifdef BUTTON3_DOUBLE_CLICKED
GEN_MEVENT(BUTTON3_DOUBLE_CLICKED);
all3 |= BUTTON3_DOUBLE_CLICKED;
#endif
#ifdef BUTTON3_TRIPLE_CLICKED
GEN_MEVENT(BUTTON3_TRIPLE_CLICKED);
all3 |= BUTTON3_TRIPLE_CLICKED;
#endif
#ifdef BUTTON3_RESERVED_EVENT
GEN_MEVENT(BUTTON3_RESERVED_EVENT);
all3 |= BUTTON3_RESERVED_EVENT;
#endif
#ifdef BUTTON4_RELEASED
GEN_MEVENT(BUTTON4_RELEASED);
all4 |= BUTTON4_RELEASED;
#endif
#ifdef BUTTON4_PRESSED
GEN_MEVENT(BUTTON4_PRESSED);
all4 |= BUTTON4_PRESSED;
#endif
#ifdef BUTTON4_CLICKED
GEN_MEVENT(BUTTON4_CLICKED);
all4 |= BUTTON4_CLICKED;
#endif
#ifdef BUTTON4_DOUBLE_CLICKED
GEN_MEVENT(BUTTON4_DOUBLE_CLICKED);
all4 |= BUTTON4_DOUBLE_CLICKED;
#endif
#ifdef BUTTON4_TRIPLE_CLICKED
GEN_MEVENT(BUTTON4_TRIPLE_CLICKED);
all4 |= BUTTON4_TRIPLE_CLICKED;
#endif
#ifdef BUTTON4_RESERVED_EVENT
GEN_MEVENT(BUTTON4_RESERVED_EVENT);
all4 |= BUTTON4_RESERVED_EVENT;
#endif
#ifdef BUTTON_CTRL
GEN_MEVENT(BUTTON_CTRL);
#endif
#ifdef BUTTON_SHIFT
GEN_MEVENT(BUTTON_SHIFT);
#endif
#ifdef BUTTON_ALT
GEN_MEVENT(BUTTON_ALT);
#endif
2002-10-13 11:35:53 +08:00
#ifdef REPORT_MOUSE_POSITION
GEN_MEVENT(REPORT_MOUSE_POSITION);
2005-10-10 02:41:57 +08:00
#endif
1999-10-24 12:32:42 +08:00
#ifdef ALL_MOUSE_EVENTS
GEN_MEVENT(ALL_MOUSE_EVENTS);
#endif
2005-10-10 02:41:57 +08:00
GEN_EVENT(BUTTON1_EVENTS, all1);
GEN_EVENT(BUTTON2_EVENTS, all2);
GEN_EVENT(BUTTON3_EVENTS, all3);
GEN_EVENT(BUTTON4_EVENTS, all4);
1999-10-24 12:32:42 +08:00
}
static void
wrap_one_var(const char *c_var,
const char *c_type,
const char *ada_func,
const char *ada_type)
{
#if USE_REENTRANT
/* must wrap variables */
printf("\n");
printf(" function %s return %s\n", ada_func, ada_type);
printf(" is\n");
printf(" function Result return %s;\n", c_type);
printf(" pragma Import (C, Result, \"" NCURSES_WRAP_PREFIX "%s\");\n", c_var);
printf(" begin\n");
if (strcmp(c_type, ada_type))
printf(" return %s (Result);\n", ada_type);
else
printf(" return Result;\n");
printf(" end %s;\n", ada_func);
#else
/* global variables are really global */
printf("\n");
printf(" function %s return %s\n", ada_func, ada_type);
printf(" is\n");
printf(" Result : %s;\n", c_type);
printf(" pragma Import (C, Result, \"%s\");\n", c_var);
printf(" begin\n");
if (strcmp(c_type, ada_type))
printf(" return %s (Result);\n", ada_type);
else
printf(" return Result;\n");
printf(" end %s;\n", ada_func);
#endif
}
#define GEN_PUBLIC_VAR(c_var, c_type, ada_func, ada_type) \
wrap_one_var(#c_var, #c_type, #ada_func, #ada_type)
static void
gen_public_vars(void)
{
GEN_PUBLIC_VAR(stdscr, Window, Standard_Window, Window);
GEN_PUBLIC_VAR(curscr, Window, Current_Window, Window);
GEN_PUBLIC_VAR(LINES, C_Int, Lines, Line_Count);
GEN_PUBLIC_VAR(COLS, C_Int, Columns, Column_Count);
GEN_PUBLIC_VAR(TABSIZE, C_Int, Tab_Size, Natural);
GEN_PUBLIC_VAR(COLORS, C_Int, Number_Of_Colors, Natural);
GEN_PUBLIC_VAR(COLOR_PAIRS, C_Int, Number_Of_Color_Pairs, Natural);
}
1998-03-01 12:21:12 +08:00
/*
* Output some comment lines indicating that the file is generated.
* The name parameter is the name of the facility to be used in
* the comment.
*/
2005-10-10 02:41:57 +08:00
static void
prologue(const char *name)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
printf("-- %s binding.\n", name);
1997-05-15 12:00:00 +08:00
printf("-- This module is generated. Please don't change it manually!\n");
printf("-- Run the generator instead.\n-- |");
1999-10-24 12:32:42 +08:00
printf("define(`M4_BIT_ORDER',`%s_Order_First')",
2005-10-10 02:41:57 +08:00
little_endian ? "Low" : "High");
1997-05-15 12:00:00 +08:00
}
1998-03-01 12:21:12 +08:00
/*
* Write the prologue for the curses facility and make sure that
* KEY_MIN and KEY_MAX are defined for the rest of this source.
*/
2005-10-10 02:41:57 +08:00
static void
basedefs(void)
1997-05-15 12:00:00 +08:00
{
prologue("curses");
#ifndef KEY_MAX
# define KEY_MAX 0777
#endif
2005-10-10 02:41:57 +08:00
printf("define(`M4_KEY_MAX',`8#%o#')", KEY_MAX);
1997-05-15 12:00:00 +08:00
#ifndef KEY_MIN
# define KEY_MIN 0401
#endif
2005-10-10 02:41:57 +08:00
if (KEY_MIN == 256)
{
fprintf(stderr, "Unexpected value for KEY_MIN: %d\n", KEY_MIN);
exit(1);
}
printf("define(`M4_SPECIAL_FIRST',`8#%o#')", KEY_MIN - 1);
1997-05-15 12:00:00 +08:00
}
1998-03-01 12:21:12 +08:00
/*
* Write out the comment lines for the menu facility
*/
2005-10-10 02:41:57 +08:00
static void
menu_basedefs(void)
1997-05-15 12:00:00 +08:00
{
prologue("menu");
}
1998-03-01 12:21:12 +08:00
/*
* Write out the comment lines for the form facility
*/
2005-10-10 02:41:57 +08:00
static void
form_basedefs(void)
1997-05-15 12:00:00 +08:00
{
prologue("form");
}
1998-03-01 12:21:12 +08:00
/*
* Write out the comment lines for the mouse facility
*/
2005-10-10 02:41:57 +08:00
static void
mouse_basedefs(void)
1997-05-15 12:00:00 +08:00
{
prologue("mouse");
}
1998-03-01 12:21:12 +08:00
/*
* Write the definition of a single color
*/
2005-10-10 02:41:57 +08:00
static void
color_def(const char *name, int value)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
printf(" %-16s : constant Color_Number := %d;\n", name, value);
1997-05-15 12:00:00 +08:00
}
1998-03-01 12:21:12 +08:00
/*
* Generate all color definitions
*/
2005-10-10 02:41:57 +08:00
static void
gen_color(void)
1997-05-15 12:00:00 +08:00
{
#if HAVE_USE_DEFAULT_COLORS
2005-10-10 02:41:57 +08:00
color_def("Default_Color", -1);
2002-10-13 11:35:53 +08:00
#endif
1997-05-15 12:00:00 +08:00
#ifdef COLOR_BLACK
2005-10-10 02:41:57 +08:00
color_def("Black", COLOR_BLACK);
1997-05-15 12:00:00 +08:00
#endif
#ifdef COLOR_RED
2005-10-10 02:41:57 +08:00
color_def("Red", COLOR_RED);
1997-05-15 12:00:00 +08:00
#endif
#ifdef COLOR_GREEN
2005-10-10 02:41:57 +08:00
color_def("Green", COLOR_GREEN);
1997-05-15 12:00:00 +08:00
#endif
#ifdef COLOR_YELLOW
2005-10-10 02:41:57 +08:00
color_def("Yellow", COLOR_YELLOW);
1997-05-15 12:00:00 +08:00
#endif
#ifdef COLOR_BLUE
2005-10-10 02:41:57 +08:00
color_def("Blue", COLOR_BLUE);
1997-05-15 12:00:00 +08:00
#endif
#ifdef COLOR_MAGENTA
2005-10-10 02:41:57 +08:00
color_def("Magenta", COLOR_MAGENTA);
1997-05-15 12:00:00 +08:00
#endif
#ifdef COLOR_CYAN
2005-10-10 02:41:57 +08:00
color_def("Cyan", COLOR_CYAN);
1997-05-15 12:00:00 +08:00
#endif
#ifdef COLOR_WHITE
2005-10-10 02:41:57 +08:00
color_def("White", COLOR_WHITE);
1997-05-15 12:00:00 +08:00
#endif
}
1998-03-01 12:21:12 +08:00
/*
* Generate the linker options for the base facility
*/
2005-10-10 02:41:57 +08:00
static void
gen_linkopts(void)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
printf(" pragma Linker_Options (\"-lncurses%s\");\n", model);
1997-05-15 12:00:00 +08:00
}
1998-03-01 12:21:12 +08:00
/*
* Generate the linker options for the menu facility
*/
2005-10-10 02:41:57 +08:00
static void
gen_menu_linkopts(void)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
printf(" pragma Linker_Options (\"-lmenu%s\");\n", model);
1997-05-15 12:00:00 +08:00
}
1998-03-01 12:21:12 +08:00
/*
* Generate the linker options for the form facility
*/
2005-10-10 02:41:57 +08:00
static void
gen_form_linkopts(void)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
printf(" pragma Linker_Options (\"-lform%s\");\n", model);
1997-05-15 12:00:00 +08:00
}
1998-03-01 12:21:12 +08:00
/*
* Generate the linker options for the panel facility
*/
2005-10-10 02:41:57 +08:00
static void
gen_panel_linkopts(void)
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
printf(" pragma Linker_Options (\"-lpanel%s\");\n", model);
1997-05-15 12:00:00 +08:00
}
2005-10-10 02:41:57 +08:00
static void
gen_version_info(void)
1998-03-01 12:21:12 +08:00
{
2005-10-10 02:41:57 +08:00
static const char *v1 =
" NC_Major_Version : constant := %d; -- Major version of the library\n";
static const char *v2 =
" NC_Minor_Version : constant := %d; -- Minor version of the library\n";
static const char *v3 =
" NC_Version : constant String := %c%d.%d%c; -- Version of library\n";
1999-10-24 12:32:42 +08:00
printf(v1, NCURSES_VERSION_MAJOR);
printf(v2, NCURSES_VERSION_MINOR);
2005-10-10 02:41:57 +08:00
printf(v3, '"', NCURSES_VERSION_MAJOR, NCURSES_VERSION_MINOR, '"');
1999-10-24 12:32:42 +08:00
}
static int
2005-10-10 02:41:57 +08:00
eti_gen(char *buf, int code, const char *name, int *etimin, int *etimax)
1999-10-24 12:32:42 +08:00
{
2005-10-10 02:41:57 +08:00
sprintf(buf, " E_%-16s : constant Eti_Error := %d;\n", name, code);
1999-10-24 12:32:42 +08:00
if (code < *etimin)
*etimin = code;
if (code > *etimax)
*etimax = code;
return (int)strlen(buf);
1999-10-24 12:32:42 +08:00
}
static void
gen_offsets(void)
{
2005-10-10 02:41:57 +08:00
const char *s_bool = "";
if (sizeof(bool) == sizeof(char))
{
s_bool = "char";
}
else if (sizeof(bool) == sizeof(short))
{
s_bool = "short";
}
else if (sizeof(bool) == sizeof(int))
{
s_bool = "int";
}
2000-10-21 12:42:11 +08:00
printf(" Sizeof%-*s : constant Natural := %2ld; -- %s\n",
2005-10-10 02:41:57 +08:00
12, "_bool", (long)sizeof(bool), "bool");
1999-10-24 12:32:42 +08:00
/* In ncurses _maxy and _maxx needs an offset for the "public"
* value
*/
printf(" Offset%-*s : constant Natural := %2d; -- %s\n",
2005-10-10 02:41:57 +08:00
12, "_XY", 1, "int");
1999-10-24 12:32:42 +08:00
printf("\n");
2005-10-10 02:41:57 +08:00
printf(" type Curses_Bool is mod 2 ** Interfaces.C.%s'Size;\n", s_bool);
1998-03-01 12:21:12 +08:00
}
1997-05-15 12:00:00 +08:00
1998-03-01 12:21:12 +08:00
/*
* main() expects two arguments on the commandline, both single characters.
* The first character denotes the facility for which we generate output.
* Possible values are
* B - Base
* M - Menus
* F - Forms
* P - Pointer Device (Mouse)
1999-10-24 12:32:42 +08:00
* E - ETI base definitions
1998-03-01 12:21:12 +08:00
*
* The second character then denotes the specific output that should be
* generated for the selected facility.
*/
2005-10-10 02:41:57 +08:00
int
main(int argc, char *argv[])
1997-05-15 12:00:00 +08:00
{
int x = 0x12345678;
char *s = (char *)&x;
if (*s == 0x78)
little_endian = 1;
2005-10-10 02:41:57 +08:00
if (argc != 4)
1997-05-15 12:00:00 +08:00
exit(1);
1999-10-24 12:32:42 +08:00
model = *++argv;
1997-05-15 12:00:00 +08:00
2005-10-10 02:41:57 +08:00
switch (argv[1][0])
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
/* --------------------------------------------------------------- */
case 'B': /* The Base facility */
switch (argv[2][0])
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
case 'A': /* chtype translation into Ada95 record type */
1997-05-15 12:00:00 +08:00
gen_attr_set("Character_Attribute_Set");
break;
2005-10-10 02:41:57 +08:00
case 'B': /* write some initial comment lines */
1997-05-15 12:00:00 +08:00
basedefs();
break;
2005-10-10 02:41:57 +08:00
case 'C': /* generate color constants */
1997-05-15 12:00:00 +08:00
gen_color();
break;
2005-10-10 02:41:57 +08:00
case 'D': /* generate displacements of fields in WINDOW struct. */
1999-10-24 12:32:42 +08:00
gen_offsets();
break;
2005-10-10 02:41:57 +08:00
case 'E': /* generate Mouse Event codes */
1999-10-24 12:32:42 +08:00
gen_mouse_events();
break;
case 'K': /* translation of keycodes */
gen_keydefs(0);
1997-05-15 12:00:00 +08:00
break;
2005-10-10 02:41:57 +08:00
case 'L': /* generate the Linker_Options pragma */
1997-05-15 12:00:00 +08:00
gen_linkopts();
break;
case 'M': /* generate constants for the ACS characters */
gen_acs();
break;
2005-10-10 02:41:57 +08:00
case 'O': /* generate definitions of the old key code names */
1997-05-15 12:00:00 +08:00
gen_keydefs(1);
break;
case 'P': /* generate definitions of the public variables */
gen_public_vars();
break;
2005-10-10 02:41:57 +08:00
case 'R': /* generate representation clause for Attributed character */
1997-05-15 12:00:00 +08:00
gen_chtype_rep("Attributed_Character");
break;
2005-10-10 02:41:57 +08:00
case 'T': /* generate the Trace info */
2002-10-13 11:35:53 +08:00
gen_trace("Trace_Attribute_Set");
break;
case 'V': /* generate version info */
gen_version_info();
break;
1997-05-15 12:00:00 +08:00
default:
break;
}
break;
2005-10-10 02:41:57 +08:00
/* --------------------------------------------------------------- */
case 'M': /* The Menu facility */
switch (argv[2][0])
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
case 'R': /* generate representation clause for Menu_Option_Set */
1997-05-15 12:00:00 +08:00
gen_menu_opt_rep("Menu_Option_Set");
break;
2005-10-10 02:41:57 +08:00
case 'B': /* write some initial comment lines */
1997-05-15 12:00:00 +08:00
menu_basedefs();
break;
2005-10-10 02:41:57 +08:00
case 'L': /* generate the Linker_Options pragma */
1997-05-15 12:00:00 +08:00
gen_menu_linkopts();
break;
2005-10-10 02:41:57 +08:00
case 'I': /* generate representation clause for Item_Option_Set */
1997-05-15 12:00:00 +08:00
gen_item_opt_rep("Item_Option_Set");
break;
default:
break;
}
break;
2005-10-10 02:41:57 +08:00
/* --------------------------------------------------------------- */
case 'F': /* The Form facility */
switch (argv[2][0])
1997-05-15 12:00:00 +08:00
{
2005-10-10 02:41:57 +08:00
case 'R': /* generate representation clause for Form_Option_Set */
1997-05-15 12:00:00 +08:00
gen_form_opt_rep("Form_Option_Set");
break;
2005-10-10 02:41:57 +08:00
case 'B': /* write some initial comment lines */
1997-05-15 12:00:00 +08:00
form_basedefs();
break;
2005-10-10 02:41:57 +08:00
case 'L': /* generate the Linker_Options pragma */
1997-05-15 12:00:00 +08:00
gen_form_linkopts();
break;
2005-10-10 02:41:57 +08:00
case 'I': /* generate representation clause for Field_Option_Set */
1997-05-15 12:00:00 +08:00
gen_field_opt_rep("Field_Option_Set");
break;
default:
break;
}
break;
2005-10-10 02:41:57 +08:00
/* --------------------------------------------------------------- */
case 'P': /* The Pointer(=Mouse) facility */
switch (argv[2][0])
{
case 'B': /* write some initial comment lines */
1997-05-15 12:00:00 +08:00
mouse_basedefs();
break;
2005-10-10 02:41:57 +08:00
case 'M': /* generate representation clause for Mouse_Event */
1997-05-15 12:00:00 +08:00
gen_mrep_rep("Mouse_Event");
break;
2005-10-10 02:41:57 +08:00
case 'L': /* generate the Linker_Options pragma */
1997-05-15 12:00:00 +08:00
gen_panel_linkopts();
break;
default:
break;
}
2005-10-10 02:41:57 +08:00
break;
/* --------------------------------------------------------------- */
case 'E': /* chtype size detection */
switch (argv[2][0])
1999-10-24 12:32:42 +08:00
{
2005-10-10 02:41:57 +08:00
case 'C':
{
const char *fmt = " type C_Chtype is new %s;\n";
const char *afmt = " type C_AttrType is new %s;\n";
if (sizeof(chtype) == sizeof(int))
{
if (sizeof(int) == sizeof(long))
printf(fmt, "C_ULong");
else
printf(fmt, "C_UInt");
}
else if (sizeof(chtype) == sizeof(long))
{
printf(fmt, "C_ULong");
}
1999-10-24 12:32:42 +08:00
else
2005-10-10 02:41:57 +08:00
printf("Error\n");
if (sizeof(attr_t) == sizeof(int))
{
if (sizeof(int) == sizeof(long))
printf(afmt, "C_ULong");
else
printf(afmt, "C_UInt");
}
else if (sizeof(attr_t) == sizeof(long))
{
printf(afmt, "C_ULong");
}
1999-10-24 12:32:42 +08:00
else
2005-10-10 02:41:57 +08:00
printf("Error\n");
1999-10-24 12:32:42 +08:00
2005-10-10 02:41:57 +08:00
printf("define(`CF_CURSES_OK',`%d')", OK);
printf("define(`CF_CURSES_ERR',`%d')", ERR);
printf("define(`CF_CURSES_TRUE',`%d')", TRUE);
printf("define(`CF_CURSES_FALSE',`%d')", FALSE);
}
break;
case 'E':
{
char *buf = (char *)malloc(2048);
char *p = buf;
int etimin = E_OK;
int etimax = E_OK;
if (p)
{
p += eti_gen(p, E_OK, "Ok", &etimin, &etimax);
p += eti_gen(p, E_SYSTEM_ERROR, "System_Error", &etimin, &etimax);
p += eti_gen(p, E_BAD_ARGUMENT, "Bad_Argument", &etimin, &etimax);
p += eti_gen(p, E_POSTED, "Posted", &etimin, &etimax);
p += eti_gen(p, E_CONNECTED, "Connected", &etimin, &etimax);
p += eti_gen(p, E_BAD_STATE, "Bad_State", &etimin, &etimax);
p += eti_gen(p, E_NO_ROOM, "No_Room", &etimin, &etimax);
p += eti_gen(p, E_NOT_POSTED, "Not_Posted", &etimin, &etimax);
p += eti_gen(p, E_UNKNOWN_COMMAND,
"Unknown_Command", &etimin, &etimax);
p += eti_gen(p, E_NO_MATCH, "No_Match", &etimin, &etimax);
p += eti_gen(p, E_NOT_SELECTABLE,
"Not_Selectable", &etimin, &etimax);
p += eti_gen(p, E_NOT_CONNECTED,
"Not_Connected", &etimin, &etimax);
p += eti_gen(p, E_REQUEST_DENIED,
"Request_Denied", &etimin, &etimax);
p += eti_gen(p, E_INVALID_FIELD,
"Invalid_Field", &etimin, &etimax);
p += eti_gen(p, E_CURRENT,
"Current", &etimin, &etimax);
}
printf(" subtype Eti_Error is C_Int range %d .. %d;\n\n",
etimin, etimax);
printf(buf);
1999-10-24 12:32:42 +08:00
}
2005-10-10 02:41:57 +08:00
break;
default:
break;
1999-10-24 12:32:42 +08:00
}
break;
2005-10-10 02:41:57 +08:00
/* --------------------------------------------------------------- */
case 'V': /* plain version dump */
1999-10-24 12:32:42 +08:00
{
2005-10-10 02:41:57 +08:00
switch (argv[2][0])
{
case '1': /* major version */
1999-10-24 12:32:42 +08:00
#ifdef NCURSES_VERSION_MAJOR
2005-10-10 02:41:57 +08:00
printf("%d", NCURSES_VERSION_MAJOR);
1999-10-24 12:32:42 +08:00
#endif
2005-10-10 02:41:57 +08:00
break;
case '2': /* minor version */
1999-10-24 12:32:42 +08:00
#ifdef NCURSES_VERSION_MINOR
2005-10-10 02:41:57 +08:00
printf("%d", NCURSES_VERSION_MINOR);
1999-10-24 12:32:42 +08:00
#endif
2005-10-10 02:41:57 +08:00
break;
case '3': /* patch level */
1999-10-24 12:32:42 +08:00
#ifdef NCURSES_VERSION_PATCH
2005-10-10 02:41:57 +08:00
printf("%d", NCURSES_VERSION_PATCH);
1999-10-24 12:32:42 +08:00
#endif
2005-10-10 02:41:57 +08:00
break;
default:
break;
}
1999-10-24 12:32:42 +08:00
}
break;
2005-10-10 02:41:57 +08:00
/* --------------------------------------------------------------- */
1997-05-15 12:00:00 +08:00
default:
break;
}
return 0;
}