aboutsummaryrefslogtreecommitdiff
path: root/Ada95/gen
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2020-02-07 08:36:41 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2020-02-07 08:36:41 +0000
commitf0179cb6083cc92e5947ae56e6a0a5c5328aead0 (patch)
treebcee0ba9c2149b71f0bfc036df1e61e3105bf980 /Ada95/gen
parentcea297eb34d2361e79529034397465068ae34ecd (diff)
downloadsrc-f0179cb6083cc92e5947ae56e6a0a5c5328aead0.tar.gz
src-f0179cb6083cc92e5947ae56e6a0a5c5328aead0.zip
Vendor import ncurses 6.1-20200118vendor/ncurses/6.1-20200118
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=357645 svn path=/vendor/ncurses/6.1-20200118/; revision=357646; tag=vendor/ncurses/6.1-20200118
Diffstat (limited to 'Ada95/gen')
-rw-r--r--Ada95/gen/Makefile.in174
-rw-r--r--Ada95/gen/adacurses-config.in25
-rw-r--r--Ada95/gen/gen.c1822
-rw-r--r--Ada95/gen/html.m46
-rw-r--r--Ada95/gen/terminal_interface-curses-aux.ads.m475
-rw-r--r--Ada95/gen/terminal_interface-curses-forms-field_types.ads.m410
-rw-r--r--Ada95/gen/terminal_interface-curses-forms.ads.m469
-rw-r--r--Ada95/gen/terminal_interface-curses-menus.ads.m454
-rw-r--r--Ada95/gen/terminal_interface-curses-mouse.ads.m449
-rw-r--r--Ada95/gen/terminal_interface-curses-panels.ads.m410
-rw-r--r--Ada95/gen/terminal_interface-curses-trace.ads.m454
-rw-r--r--Ada95/gen/terminal_interface-curses.adb.m4282
-rw-r--r--Ada95/gen/terminal_interface-curses.ads.m4507
13 files changed, 1368 insertions, 1769 deletions
diff --git a/Ada95/gen/Makefile.in b/Ada95/gen/Makefile.in
index 302ad94f4424..4e649d1c36e0 100644
--- a/Ada95/gen/Makefile.in
+++ b/Ada95/gen/Makefile.in
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2018,2019 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"), #
@@ -28,11 +28,11 @@
#
# Author: Juergen Pfeifer, 1996
#
-# $Id: Makefile.in,v 1.77 2012/10/06 18:58:48 tom Exp $
+# $Id: Makefile.in,v 1.89 2019/08/31 15:44:14 tom Exp $
#
.SUFFIXES:
-SHELL = /bin/sh
+SHELL = @SHELL@
VPATH = @srcdir@
THIS = Makefile
@@ -46,8 +46,8 @@ exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
-INSTALL = @INSTALL@
-INSTALL_PROG = @INSTALL_PROGRAM@
+INSTALL = @INSTALL@ @INSTALL_OPT_O@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_DATA = @INSTALL_DATA@
AWK = @AWK@
@@ -55,12 +55,15 @@ LN_S = @LN_S@
CC = @CC@
HOST_CC = @BUILD_CC@
+
CFLAGS = @CFLAGS@
+HOST_CFLAGS = @BUILD_CFLAGS@
-CPPFLAGS = @ACPPFLAGS@ @CPPFLAGS@ \
+CPPFLAGS = @CPPFLAGS@
+HOST_CPPFLAGS = @ACPPFLAGS@ @BUILD_CPPFLAGS@ \
-DHAVE_CONFIG_H -I$(srcdir)
-CCFLAGS = $(CPPFLAGS) $(CFLAGS)
+CCFLAGS = $(HOST_CPPFLAGS) $(HOST_CFLAGS)
CFLAGS_NORMAL = $(CCFLAGS)
CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE
CFLAGS_PROFILE = $(CCFLAGS) -pg
@@ -73,19 +76,29 @@ ABI_VERSION = @cf_cv_abi_version@
LOCAL_LIBDIR = @top_builddir@/lib
LINK = $(HOST_CC)
-LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @TINFO_LDFLAGS2@ @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) @TINFO_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+
+# For the wide-character configuration combined with broken_linker, we need
+# addresses of ACS_xxx constants, which requires linking with the newly built
+# ncurses library. If cross-compiling, the developer has to fill in a workable
+# native library for this purpose.
+NATIVE_LDFLAGS = @LD_MODEL@ $(LOCAL_LIBS) @TINFO_LDFLAGS2@ $(LDFLAGS) @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) @TINFO_LIBS@
+CROSS_LDFLAGS = @BUILD_LDFLAGS@ @BUILD_LIBS@
+
+ACTUAL_LDFLAGS = @ADAGEN_LDFLAGS@
RANLIB = @RANLIB@
M4 = m4
M4FLAGS = -DNCURSES_EXT_FUNCS=@NCURSES_EXT_FUNCS@
-ADACURSES_CONFIG = adacurses@DFT_ARG_SUFFIX@-config
+ADACURSES_CONFIG = adacurses@USE_CFG_SUFFIX@-config
WRAPPER = @NCURSES_SHLIB2@
PROG_GENERATE = ./generate$x
-GENERATE = $(PROG_GENERATE) '@DFT_ARG_SUFFIX@'
+GENERATE = $(PROG_GENERATE) '@USE_ARG_SUFFIX@'
DEL_ADAMODE = sed -e '/^\-\-\ \ \-\*\-\ ada\ \-\*\-.*/d'
GNATHTML = `type -p gnathtml || type -p gnathtml.pl 2>/dev/null`
@@ -97,39 +110,6 @@ ABASE = $(ALIB)-curses
ADA_SRCDIR = ../src
-GEN_FILES0 = Base_Defs
-
-GEN_FILES1 = ACS_Map \
- AC_Rep \
- Base_Defs \
- Character_Attribute_Set_Rep \
- Color_Defs \
- Key_Definitions \
- Linker_Options \
- Old_Keys \
- Public_Variables \
- Trace_Defs \
- Version_Info \
- Window_Offsets
-
-GEN_FILES2 = Menu_Opt_Rep \
- Menu_Base_Defs \
- Menu_Linker_Options \
- Item_Rep
-
-GEN_FILES3 = Form_Opt_Rep \
- Form_Base_Defs \
- Form_Linker_Options \
- Field_Rep
-
-GEN_FILES4 = Mouse_Base_Defs \
- Mouse_Event_Rep \
- Mouse_Events \
- Panel_Linker_Options
-
-GEN_FILES5 = Chtype_Def \
- Eti_Defs
-
GEN_TARGETS = $(ADA_SRCDIR)/$(ABASE).ads \
$(ADA_SRCDIR)/$(ABASE).adb \
$(ADA_SRCDIR)/$(ABASE)-aux.ads \
@@ -143,7 +123,8 @@ GEN_TARGETS = $(ADA_SRCDIR)/$(ABASE).ads \
$(ADA_SRCDIR)/$(ABASE)-forms-form_user_data.ads \
$(ADA_SRCDIR)/$(ABASE)-forms-field_types.ads \
$(ADA_SRCDIR)/$(ABASE)-forms-field_user_data.ads \
- $(ADA_SRCDIR)/$(ABASE)-panels-user_data.ads
+ $(ADA_SRCDIR)/$(ABASE)-panels-user_data.ads \
+ $(ADA_SRCDIR)/$(ABASE)_constants.ads
GEN_SRC = $(srcdir)/$(ABASE).ads.m4 \
$(srcdir)/$(ABASE).adb.m4 \
@@ -172,140 +153,64 @@ $(DESTDIR)$(bindir) :
install \
install.libs :: $(DESTDIR)$(bindir) $(ADACURSES_CONFIG)
- $(INSTALL_PROG) $(ADACURSES_CONFIG) $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG)
+ $(INSTALL_SCRIPT) $(ADACURSES_CONFIG) $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG)
uninstall \
uninstall.libs ::
-rm -f $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG)
$(PROG_GENERATE): gen.o
- @ECHO_LD@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@
+ @ECHO_LD@ $(LINK) $(CFLAGS_NORMAL) gen.o $(ACTUAL_LDFLAGS) -o $@
gen.o: $(srcdir)/gen.c
$(HOST_CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/gen.c
-################################################################################
-Character_Attribute_Set_Rep: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B A" >$@
-
-Base_Defs: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B B" >$@
-
-Color_Defs: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B C" >$@
-
-Window_Offsets: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B D" >$@
-
-Key_Definitions: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B K" >$@
-
-Linker_Options: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B L" >$@
-
-ACS_Map: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B M" >$@
-
-Old_Keys: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B O" >$@
-
-Public_Variables: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B P" >$@
-
-AC_Rep: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B R" >$@
-
-Version_Info: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B V" >$@
-
-Trace_Defs: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B T" >$@
-################################################################################
-Menu_Opt_Rep: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) M R" >$@
-
-Menu_Base_Defs: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) M B" >$@
-
-Menu_Linker_Options: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) M L" >$@
-
-Item_Rep: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) M I" >$@
-################################################################################
-Form_Opt_Rep: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) F R" >$@
-
-Form_Base_Defs: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) F B" >$@
-
-Form_Linker_Options: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) F L" >$@
-
-Field_Rep: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) F I" >$@
-################################################################################
-Mouse_Base_Defs: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) P B" >$@
-
-Mouse_Event_Rep: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) P M" >$@
-
-Mouse_Events: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) B E" >$@
-
-Panel_Linker_Options: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) P L" >$@
-
-Chtype_Def: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) E C" >$@
-Eti_Defs: $(PROG_GENERATE)
- $(WRAPPER) "$(GENERATE) E E" >$@
+$(ADA_SRCDIR)/$(ABASE)_constants.ads: $(PROG_GENERATE)
+ $(WRAPPER) "$(GENERATE)" >$@
################################################################################
$(ADA_SRCDIR)/$(ABASE).ads: $(srcdir)/$(ABASE).ads.m4 \
- $(GEN_FILES1) $(srcdir)/normal.m4
+ $(srcdir)/normal.m4
$(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
$(srcdir)/$(ABASE).ads.m4 |\
$(DEL_ADAMODE) >$@
$(ADA_SRCDIR)/$(ABASE).adb: $(srcdir)/$(ABASE).adb.m4 \
- $(GEN_FILES1) $(srcdir)/normal.m4
+ $(srcdir)/normal.m4
$(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
$(srcdir)/$(ABASE).adb.m4 |\
$(DEL_ADAMODE) >$@
$(ADA_SRCDIR)/$(ABASE)-aux.ads: $(srcdir)/$(ABASE)-aux.ads.m4 \
- $(GEN_FILES5) $(srcdir)/normal.m4
+ $(srcdir)/normal.m4
$(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
$(srcdir)/$(ABASE)-aux.ads.m4 |\
$(DEL_ADAMODE) >$@
$(ADA_SRCDIR)/$(ABASE)-trace.ads: $(srcdir)/$(ABASE)-trace.ads.m4 \
- $(GEN_FILES5) $(srcdir)/normal.m4
+ $(srcdir)/normal.m4
$(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
$(srcdir)/$(ABASE)-trace.ads.m4 |\
$(DEL_ADAMODE) >$@
$(ADA_SRCDIR)/$(ABASE)-menus.ads: $(srcdir)/$(ABASE)-menus.ads.m4 \
- $(GEN_FILES2) $(srcdir)/normal.m4
+ $(srcdir)/normal.m4
$(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
$(srcdir)/$(ABASE)-menus.ads.m4 |\
$(DEL_ADAMODE) >$@
$(ADA_SRCDIR)/$(ABASE)-forms.ads: $(srcdir)/$(ABASE)-forms.ads.m4 \
- $(GEN_FILES3) $(srcdir)/normal.m4
+ $(srcdir)/normal.m4
$(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
$(srcdir)/$(ABASE)-forms.ads.m4 |\
$(DEL_ADAMODE) >$@
$(ADA_SRCDIR)/$(ABASE)-mouse.ads: $(srcdir)/$(ABASE)-mouse.ads.m4 \
- $(GEN_FILES4) $(srcdir)/normal.m4
+ $(srcdir)/normal.m4
$(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
$(srcdir)/$(ABASE)-mouse.ads.m4 |\
$(DEL_ADAMODE) >$@
$(ADA_SRCDIR)/$(ABASE)-panels.ads: $(srcdir)/$(ABASE)-panels.ads.m4 \
- $(GEN_FILES4) \
$(srcdir)/normal.m4
$(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
$(srcdir)/$(ABASE)-panels.ads.m4 |\
@@ -363,11 +268,6 @@ tags:
mostlyclean ::
-rm -f a.out core $(PROG_GENERATE) *.o
- -rm -f $(GEN_FILES1)
- -rm -f $(GEN_FILES2)
- -rm -f $(GEN_FILES3)
- -rm -f $(GEN_FILES4)
- -rm -f $(GEN_FILES5)
clean :: mostlyclean
-rm -f $(GEN_TARGETS) instab.tmp *.ad[bs] *.html *.ali *.tmp
@@ -429,6 +329,8 @@ adahtml:
sed -e 's%GNAT%<A HREF="http://$(GNATHP)">GNAT</A>%g' |\
sed -e 's%&lt;A HREF%<A HREF%g' |\
sed -e 's%"&gt;%">%g' |\
+ sed -e 's%#1A\([[:space:]]*NAME="[^"]*"\)#2%<A\1>%' |\
+ sed -e 's%#1/A#2%</A>%' |\
sed -e 's/3X/3x/g' |\
sed -e 's/$$\([ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxz0123456789_]*:.*\)\$$/@\1@/' |\
sed -e 's%&lt;/A&gt;%</A>%g' > $$a.tmp ;\
diff --git a/Ada95/gen/adacurses-config.in b/Ada95/gen/adacurses-config.in
index ec0b6b68b674..8805b0933f8c 100644
--- a/Ada95/gen/adacurses-config.in
+++ b/Ada95/gen/adacurses-config.in
@@ -1,7 +1,7 @@
#! /bin/sh
-# $Id: adacurses-config.in,v 1.6 2010/03/06 21:05:01 tom Exp $
+# $Id: adacurses-config.in,v 1.13 2019/09/07 20:20:52 tom Exp $
##############################################################################
-# Copyright (c) 2007-2009,2010 Free Software Foundation, Inc. #
+# Copyright (c) 2007-2016,2019 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"), #
@@ -40,14 +40,15 @@ ADA_OBJECTS=@ADA_OBJECTS@
VERSION=@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@
-CFLAGS="-I$ADA_INCLUDE -aO$ADA_OBJECTS"
-LIBS="-L$ADA_OBJECTS -lAdaCurses"
+CFLAGS="-aI$ADA_INCLUDE -aO$ADA_OBJECTS"
+LIBS="-L$ADA_OBJECTS -l@ADA_LIBNAME@"
-THIS="adacurses"
+THIS="@ADA_LIBNAME@"
+THIS_CFG="$THIS@DFT_ARG_SUFFIX@-config"
case "x$1" in
x--version)
- echo AdaCurses $VERSION
+ echo @ADA_LIBNAME@ $VERSION
;;
x--cflags)
echo $CFLAGS
@@ -57,23 +58,25 @@ case "x$1" in
;;
x)
# if no parameter is given, give what gnatmake needs
- echo "$CFLAGS -i -largs $LIBS"
+ echo "$CFLAGS -largs $LIBS"
;;
x--help)
cat <<ENDHELP
-Usage: ${THIS}-config [options]
+Usage: ${THIS_CFG} [options]
Options:
- --cflags echos the C compiler flags needed to compile with ${THIS}
- --libs echos the libraries needed to link with ${THIS}
+ --cflags echos the gnat (Ada compiler) flags needed to compile with ${THIS}
+ --libs echos the gnat libraries needed to link with ${THIS}
--version echos the release+patchdate version of ${THIS}
--help prints this message
+
+If no options are given, echos the full set of flags needed by gnatmake.
ENDHELP
;;
*)
- echo 'Usage: adacurses@DFT_ARG_SUFFIX@-config [--version | --cflags | --libs]' >&2
+ echo 'Usage: $THIS_CFG [--version | --cflags | --libs]' >&2
exit 1
;;
esac
diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c
index 082315b6ceee..fd759ba45a41 100644
--- a/Ada95/gen/gen.c
+++ b/Ada95/gen/gen.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2014,2016 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,48 +32,69 @@
/*
Version Control
- $Id: gen.c,v 1.64 2014/02/01 19:52:47 tom Exp $
+ $Id: gen.c,v 1.70 2016/02/13 22:00:22 tom Exp $
--------------------------------------------------------------------------*/
/*
- 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.
- */
+ This program prints on its standard output the source for the
+ Terminal_Interface.Curses_Constants Ada package specification. This pure
+ package only exports C constants to the Ada compiler.
+ */
#ifdef HAVE_CONFIG_H
#include <ncurses_cfg.h>
#else
#include <ncurses.h>
-#define HAVE_USE_DEFAULT_COLORS 1
#endif
#include <stdlib.h>
-#include <stddef.h>
#include <string.h>
-#include <assert.h>
-#include <ctype.h>
#include <menu.h>
#include <form.h>
#undef UCHAR
#undef UINT
-#define UChar(c) ((UCHAR)(c))
-#define RES_NAME "Reserved"
typedef unsigned char UCHAR;
typedef unsigned int UINT;
-static const char *model = "";
-static int little_endian = 0;
+/* These global variables will be set by main () */
+static int little_endian;
+static const char *my_program_invocation_name = NULL;
-typedef struct
- {
- const char *name;
- unsigned long attr;
- }
-name_attribute_pair;
+static void
+my_error(const char *message)
+{
+ fprintf(stderr, "%s: %s\n", my_program_invocation_name, message);
+ exit(EXIT_FAILURE);
+}
+
+static void
+print_constant(const char *name,
+ long value)
+{
+ printf(" %-28s : constant := %ld;\n", name, value);
+}
+
+#define PRINT_NAMED_CONSTANT(name) \
+ print_constant (#name, name)
+
+static void
+print_comment(const char *message)
+{
+ printf("\n -- %s\n\n", message);
+}
+
+/*
+ * Make sure that KEY_MIN and KEY_MAX are defined.
+ * main () will protest if KEY_MIN == 256
+ */
+#ifndef KEY_MAX
+# define KEY_MAX 0777
+#endif
+#ifndef KEY_MIN
+# define KEY_MIN 0401
+#endif
static UCHAR
bit_is_set(const UCHAR * const data,
@@ -87,7 +108,7 @@ bit_is_set(const UCHAR * const data,
else /* or */
bit = ~offset; /* 7 - offset */
bit &= 7; /* modulo 8 */
- return byte & (UCHAR) (1 << bit);
+ return (UCHAR) (byte & (1 << bit));
}
/* Find lowest and highest used offset in a byte array. */
@@ -114,1407 +135,400 @@ find_pos(const UCHAR * const data,
return -1;
}
-/*
- * 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.
- * Any pair with a 0 attr field will be ignored.
- */
-static void
-gen_reps(
- const name_attribute_pair * nap, /* array of name_attribute_pair records */
- const char *name, /* name of the represented record type */
- const UINT len, /* size of the record in bytes */
- const UINT bias)
-{
- const UINT len_bits = len << 3;
- int i, l;
- UINT low, high;
- int width = strlen(RES_NAME) + 3;
-
- assert(nap != NULL);
-
- for (i = 0; nap[i].name != (char *)0; i++)
- if (nap[i].attr)
- {
- l = (int)strlen(nap[i].name);
- if (l > width)
- width = l;
- }
- assert(width > 0);
-
- printf(" type %s is\n", name);
- printf(" record\n");
- for (i = 0; nap[i].name != (char *)0; i++)
- if (nap[i].attr)
- {
- printf(" %-*s : Boolean;\n", width, nap[i].name);
- }
- printf(" end record;\n");
- printf(" pragma Convention (C, %s);\n\n", name);
-
- printf(" for %s use\n", name);
- printf(" record\n");
-
- for (i = 0; nap[i].name != (char *)0; i++)
- if (nap[i].attr)
- {
- if (find_pos((const UCHAR *)(&(nap[i].attr)) + bias, len, &low, &high))
- printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name,
- low, high);
- }
- 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.");
-}
-
-static void
-chtype_rep(const char *name, attr_t mask)
-{
- attr_t x = (attr_t)-1;
- attr_t t = x & mask;
- UINT low, high;
-
- if (find_pos((const UCHAR *)(&t), sizeof(t), &low, &high))
- printf(" %-5s at 0 range %2d .. %2d;\n", name, low, high);
-}
-
-static void
-gen_chtype_rep(const char *name)
-{
- 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)));
-
- printf(" -- Please note: this rep. clause is generated and may be\n");
- printf(" -- different on your system.\n");
-}
-
-static void
-mrep_rep(const char *name, void *rec)
-{
- UINT low, high;
-
- if (find_pos((const UCHAR *)rec, sizeof(MEVENT), &low, &high))
- printf(" %-7s at 0 range %3d .. %3d;\n", name, low, high);
-}
-
-static void
-gen_mrep_rep(const char *name)
-{
- MEVENT x;
-
- printf(" for %s use\n record\n", name);
-
- memset(&x, 0, sizeof(x));
- x.id = -1;
- mrep_rep("Id", &x);
-
- memset(&x, 0, sizeof(x));
- x.x = -1;
- mrep_rep("X", &x);
-
- memset(&x, 0, sizeof(x));
- x.y = -1;
- mrep_rep("Y", &x);
-
- memset(&x, 0, sizeof(x));
- x.z = -1;
- mrep_rep("Z", &x);
-
- memset(&x, 0, sizeof(x));
- x.bstate = (mmask_t) - 1;
- mrep_rep("Bstate", &x);
-
- printf(" end record;\n");
- printf(" -- Please note: this rep. clause is generated and may be\n");
- printf(" -- different on your system.\n");
-}
-
-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 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.
- * Some preprocessors are not able to test the values because they
- * now (2014) contain an explicit cast to chtype, so we avoid ifdef.
- */
- static const name_attribute_pair nap[] =
- {
- {"Stand_Out", A_STANDOUT},
- {"Under_Line", A_UNDERLINE},
- {"Reverse_Video", A_REVERSE},
- {"Blink", A_BLINK},
- {"Dim_Character", A_DIM},
- {"Bold_Character", A_BOLD},
- {"Alternate_Character_Set", A_ALTCHARSET},
- {"Invisible_Character", A_INVIS},
- {"Protected_Character", A_PROTECT},
- {"Horizontal", A_HORIZONTAL},
- {"Left", A_LEFT},
- {"Low", A_LOW},
- {"Right", A_RIGHT},
- {"Top", A_TOP},
- {"Vertical", A_VERTICAL},
- {(char *)0, 0}
- };
- chtype attr = A_ATTRIBUTES & ~A_COLOR;
- int start = -1;
- int len = 0;
- int i;
- chtype set;
- for (i = 0; i < (int)(8 * sizeof(chtype)); i++)
-
- {
- set = (attr & 1);
- if (set)
- {
- if (start < 0)
- start = i;
- if (start >= 0)
- {
- len++;
- }
- }
- attr = attr >> 1;
- }
- gen_reps(nap, name,
- (UINT) ((len + 7) / 8),
- (UINT) (little_endian ? start >> 3 : 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},
- {"Attributes_And_Colors", TRACE_ATTRS},
- {(char *)0, 0}
- };
+#define PRINT_BITMASK(c_type, ada_name, mask_macro) \
+ { \
+ UINT first, last; \
+ c_type mask = (mask_macro); \
+ if (!find_pos ((UCHAR *)&mask, sizeof (mask), &first, &last)) \
+ my_error ("failed to locate " ada_name); \
+ print_constant (ada_name "_First", first); \
+ print_constant (ada_name "_Last", last); \
+ }
- gen_reps(nap, name, sizeof(UINT),
- little_endian ? 0 : sizeof(nap[0].attr) - sizeof(UINT));
-}
+#define PRINT_NAMED_BITMASK(c_type, mask_macro) \
+ PRINT_BITMASK (c_type, #mask_macro, mask_macro)
+
+#define STRUCT_OFFSET(record, field) \
+ { \
+ UINT first, last; \
+ record mask; \
+ memset (&mask, 0, sizeof (mask)); \
+ memset (&mask.field, 0xff, sizeof(mask.field)); \
+ if (!find_pos ((UCHAR *)&mask, sizeof (mask), &first, &last)) \
+ my_error ("failed to locate" #record "_" #field); \
+ print_constant (#record "_" #field "_First", first); \
+ print_constant (#record "_" #field "_Last", last); \
+ }
-static void
-gen_menu_opt_rep(const char *name)
-{
- static const name_attribute_pair nap[] =
- {
-#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}
- };
+/*--------------------*/
+/* Start of main (). */
+/*--------------------*/
- gen_reps(nap, name, sizeof(Menu_Options),
- little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Menu_Options));
-}
-
-static void
-gen_item_opt_rep(const char *name)
+int
+main(int argc, const char *argv[])
{
- static const name_attribute_pair nap[] =
- {
-#ifdef O_SELECTABLE
- {"Selectable", O_SELECTABLE},
-#endif
- {(char *)0, 0}
- };
-
- gen_reps(nap, name, sizeof(Item_Options),
- little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Item_Options));
-}
+ const int x = 0x12345678;
-static void
-gen_form_opt_rep(const char *name)
-{
- static const name_attribute_pair nap[] =
- {
-#ifdef O_NL_OVERLOAD
- {"NL_Overload", O_NL_OVERLOAD},
-#endif
-#ifdef O_BS_OVERLOAD
- {"BS_Overload", O_BS_OVERLOAD},
-#endif
- {(char *)0, 0}
- };
+ little_endian = (*((const char *)&x) == 0x78);
- gen_reps(nap, name, sizeof(Form_Options),
- little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Form_Options));
-}
+ my_program_invocation_name = argv[0];
-/*
- * Generate the representation clause for the Field_Option_Set record
- */
-static void
-gen_field_opt_rep(const char *name)
-{
- static const name_attribute_pair nap[] =
- {
-#ifdef O_VISIBLE
- {"Visible", O_VISIBLE},
-#endif
-#ifdef O_ACTIVE
- {"Active", O_ACTIVE},
-#endif
-#ifdef O_PUBLIC
- {"Public", O_PUBLIC},
-#endif
-#ifdef O_EDIT
- {"Edit", O_EDIT},
-#endif
-#ifdef O_WRAP
- {"Wrap", O_WRAP},
-#endif
-#ifdef O_BLANK
- {"Blank", O_BLANK},
-#endif
-#ifdef O_AUTOSKIP
- {"Auto_Skip", O_AUTOSKIP},
-#endif
-#ifdef O_NULLOK
- {"Null_Ok", O_NULLOK},
-#endif
-#ifdef O_PASSOK
- {"Pass_Ok", O_PASSOK},
-#endif
-#ifdef O_STATIC
- {"Static", O_STATIC},
-#endif
- {(char *)0, 0}
- };
+ if (KEY_MIN == 256)
+ my_error("unexpected value for KEY_MIN: 256");
- gen_reps(nap, name, sizeof(Field_Options),
- little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Field_Options));
-}
+ if (argc != 2)
+ my_error("Only one argument expected (DFT_ARG_SUFFIX)");
-/*
- * Generate a single key code constant definition.
- */
-static void
-keydef(const char *name, const char *old_name, int value, int mode)
-{
- if (mode == 0) /* Generate the new name */
- printf(" %-30s : constant Special_Key_Code := 8#%3o#;\n", name, value);
- else
- {
- const char *s = old_name;
- const char *t = name;
+ printf("-- Generated by the C program %s (source " __FILE__ ").\n",
+ my_program_invocation_name);
+ printf("-- Do not edit this file directly.\n");
+ printf("-- The values provided here may vary on your system.\n");
+ printf("\n");
+ printf("with System;\n");
+ printf("package Terminal_Interface.Curses_Constants is\n");
+ printf(" pragma Pure;\n");
+ printf("\n");
- /* generate the old name, but only if it doesn't conflict with the old
- * name (Ada95 isn't case sensitive!)
- */
- while (*s && *t && (toupper(UChar(*s++)) == toupper(UChar(*t++))));
- if (*s || *t)
- printf(" %-16s : Special_Key_Code renames %s;\n", old_name, name);
- }
-}
+ printf(" DFT_ARG_SUFFIX : constant String := \"%s\";\n", argv[1]);
+ printf(" Bit_Order : constant System.Bit_Order := System.%s_Order_First;\n",
+ little_endian ? "Low" : "High");
+ print_constant("Sizeof_Bool", 8 * sizeof(bool));
-/*
- * 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.
- */
-static void
-gen_keydefs(int mode)
-{
- char buf[16];
- char obuf[16];
- int i;
+ PRINT_NAMED_CONSTANT(OK);
+ PRINT_NAMED_CONSTANT(ERR);
+ printf(" pragma Warnings (Off); -- redefinition of Standard.True and False\n");
+ PRINT_NAMED_CONSTANT(TRUE);
+ PRINT_NAMED_CONSTANT(FALSE);
+ printf(" pragma Warnings (On);\n");
+ print_comment("Version of the ncurses library from extensions(3NCURSES)");
+ PRINT_NAMED_CONSTANT(NCURSES_VERSION_MAJOR);
+ PRINT_NAMED_CONSTANT(NCURSES_VERSION_MINOR);
+ printf(" Version : constant String := \"%d.%d\";\n",
+ NCURSES_VERSION_MAJOR, NCURSES_VERSION_MINOR);
+
+ print_comment("Character non-color attributes from attr(3NCURSES)");
+ printf(" -- attr_t and chtype may be signed in C.\n");
+ printf(" type attr_t is mod 2 ** %lu;\n", (long unsigned)(8 * sizeof(attr_t)));
+ PRINT_NAMED_BITMASK(attr_t, A_CHARTEXT);
+ PRINT_NAMED_BITMASK(attr_t, A_COLOR);
+ PRINT_BITMASK(attr_t, "Attr", A_ATTRIBUTES & ~A_COLOR);
+ PRINT_NAMED_BITMASK(attr_t, A_STANDOUT);
+ PRINT_NAMED_BITMASK(attr_t, A_UNDERLINE);
+ PRINT_NAMED_BITMASK(attr_t, A_REVERSE);
+ PRINT_NAMED_BITMASK(attr_t, A_BLINK);
+ PRINT_NAMED_BITMASK(attr_t, A_DIM);
+ PRINT_NAMED_BITMASK(attr_t, A_BOLD);
+ PRINT_NAMED_BITMASK(attr_t, A_PROTECT);
+ PRINT_NAMED_BITMASK(attr_t, A_INVIS);
+ PRINT_NAMED_BITMASK(attr_t, A_ALTCHARSET);
+ PRINT_NAMED_BITMASK(attr_t, A_HORIZONTAL);
+ PRINT_NAMED_BITMASK(attr_t, A_LEFT);
+ PRINT_NAMED_BITMASK(attr_t, A_LOW);
+ PRINT_NAMED_BITMASK(attr_t, A_RIGHT);
+ PRINT_NAMED_BITMASK(attr_t, A_TOP);
+ PRINT_NAMED_BITMASK(attr_t, A_VERTICAL);
+ print_constant("chtype_Size", 8 * sizeof(chtype));
+
+ print_comment("predefined color numbers from color(3NCURSES)");
+ PRINT_NAMED_CONSTANT(COLOR_BLACK);
+ PRINT_NAMED_CONSTANT(COLOR_RED);
+ PRINT_NAMED_CONSTANT(COLOR_GREEN);
+ PRINT_NAMED_CONSTANT(COLOR_YELLOW);
+ PRINT_NAMED_CONSTANT(COLOR_BLUE);
+ PRINT_NAMED_CONSTANT(COLOR_MAGENTA);
+ PRINT_NAMED_CONSTANT(COLOR_CYAN);
+ PRINT_NAMED_CONSTANT(COLOR_WHITE);
+
+ print_comment("ETI return codes from ncurses.h");
+ PRINT_NAMED_CONSTANT(E_OK);
+ PRINT_NAMED_CONSTANT(E_SYSTEM_ERROR);
+ PRINT_NAMED_CONSTANT(E_BAD_ARGUMENT);
+ PRINT_NAMED_CONSTANT(E_POSTED);
+ PRINT_NAMED_CONSTANT(E_CONNECTED);
+ PRINT_NAMED_CONSTANT(E_BAD_STATE);
+ PRINT_NAMED_CONSTANT(E_NO_ROOM);
+ PRINT_NAMED_CONSTANT(E_NOT_POSTED);
+ PRINT_NAMED_CONSTANT(E_UNKNOWN_COMMAND);
+ PRINT_NAMED_CONSTANT(E_NO_MATCH);
+ PRINT_NAMED_CONSTANT(E_NOT_SELECTABLE);
+ PRINT_NAMED_CONSTANT(E_NOT_CONNECTED);
+ PRINT_NAMED_CONSTANT(E_REQUEST_DENIED);
+ PRINT_NAMED_CONSTANT(E_INVALID_FIELD);
+ PRINT_NAMED_CONSTANT(E_CURRENT);
+
+ print_comment("Input key codes not defined in any ncurses manpage");
+ PRINT_NAMED_CONSTANT(KEY_MIN);
+ PRINT_NAMED_CONSTANT(KEY_MAX);
#ifdef KEY_CODE_YES
- keydef("Key_Code_Yes", "KEY_CODE_YES", KEY_CODE_YES, mode);
-#endif
-#ifdef KEY_MIN
- keydef("Key_Min", "KEY_MIN", KEY_MIN, mode);
-#endif
-#ifdef KEY_BREAK
- keydef("Key_Break", "KEY_BREAK", KEY_BREAK, mode);
-#endif
-#ifdef KEY_DOWN
- keydef("Key_Cursor_Down", "KEY_DOWN", KEY_DOWN, mode);
-#endif
-#ifdef KEY_UP
- keydef("Key_Cursor_Up", "KEY_UP", KEY_UP, mode);
-#endif
-#ifdef KEY_LEFT
- keydef("Key_Cursor_Left", "KEY_LEFT", KEY_LEFT, mode);
-#endif
-#ifdef KEY_RIGHT
- keydef("Key_Cursor_Right", "KEY_RIGHT", KEY_RIGHT, mode);
-#endif
-#ifdef KEY_HOME
- keydef("Key_Home", "KEY_HOME", KEY_HOME, mode);
-#endif
-#ifdef KEY_BACKSPACE
- keydef("Key_Backspace", "KEY_BACKSPACE", KEY_BACKSPACE, mode);
-#endif
-#ifdef KEY_F0
- keydef("Key_F0", "KEY_F0", KEY_F0, mode);
-#endif
-#ifdef KEY_F
- for (i = 1; i <= 24; i++)
- {
- sprintf(buf, "Key_F%d", i);
- sprintf(obuf, "KEY_F%d", i);
- keydef(buf, obuf, KEY_F(i), mode);
- }
-#endif
-#ifdef KEY_DL
- keydef("Key_Delete_Line", "KEY_DL", KEY_DL, mode);
-#endif
-#ifdef KEY_IL
- keydef("Key_Insert_Line", "KEY_IL", KEY_IL, mode);
-#endif
-#ifdef KEY_DC
- keydef("Key_Delete_Char", "KEY_DC", KEY_DC, mode);
-#endif
-#ifdef KEY_IC
- keydef("Key_Insert_Char", "KEY_IC", KEY_IC, mode);
-#endif
-#ifdef KEY_EIC
- keydef("Key_Exit_Insert_Mode", "KEY_EIC", KEY_EIC, mode);
-#endif
-#ifdef KEY_CLEAR
- keydef("Key_Clear_Screen", "KEY_CLEAR", KEY_CLEAR, mode);
-#endif
-#ifdef KEY_EOS
- keydef("Key_Clear_End_Of_Screen", "KEY_EOS", KEY_EOS, mode);
-#endif
-#ifdef KEY_EOL
- keydef("Key_Clear_End_Of_Line", "KEY_EOL", KEY_EOL, mode);
-#endif
-#ifdef KEY_SF
- keydef("Key_Scroll_1_Forward", "KEY_SF", KEY_SF, mode);
-#endif
-#ifdef KEY_SR
- keydef("Key_Scroll_1_Backward", "KEY_SR", KEY_SR, mode);
-#endif
-#ifdef KEY_NPAGE
- keydef("Key_Next_Page", "KEY_NPAGE", KEY_NPAGE, mode);
-#endif
-#ifdef KEY_PPAGE
- keydef("Key_Previous_Page", "KEY_PPAGE", KEY_PPAGE, mode);
-#endif
-#ifdef KEY_STAB
- keydef("Key_Set_Tab", "KEY_STAB", KEY_STAB, mode);
-#endif
-#ifdef KEY_CTAB
- keydef("Key_Clear_Tab", "KEY_CTAB", KEY_CTAB, mode);
-#endif
-#ifdef KEY_CATAB
- keydef("Key_Clear_All_Tabs", "KEY_CATAB", KEY_CATAB, mode);
-#endif
-#ifdef KEY_ENTER
- keydef("Key_Enter_Or_Send", "KEY_ENTER", KEY_ENTER, mode);
-#endif
-#ifdef KEY_SRESET
- keydef("Key_Soft_Reset", "KEY_SRESET", KEY_SRESET, mode);
-#endif
-#ifdef KEY_RESET
- keydef("Key_Reset", "KEY_RESET", KEY_RESET, mode);
-#endif
-#ifdef KEY_PRINT
- keydef("Key_Print", "KEY_PRINT", KEY_PRINT, mode);
-#endif
-#ifdef KEY_LL
- keydef("Key_Bottom", "KEY_LL", KEY_LL, mode);
-#endif
-#ifdef KEY_A1
- keydef("Key_Upper_Left_Of_Keypad", "KEY_A1", KEY_A1, mode);
-#endif
-#ifdef KEY_A3
- keydef("Key_Upper_Right_Of_Keypad", "KEY_A3", KEY_A3, mode);
-#endif
-#ifdef KEY_B2
- keydef("Key_Center_Of_Keypad", "KEY_B2", KEY_B2, mode);
-#endif
-#ifdef KEY_C1
- keydef("Key_Lower_Left_Of_Keypad", "KEY_C1", KEY_C1, mode);
-#endif
-#ifdef KEY_C3
- keydef("Key_Lower_Right_Of_Keypad", "KEY_C3", KEY_C3, mode);
-#endif
-#ifdef KEY_BTAB
- keydef("Key_Back_Tab", "KEY_BTAB", KEY_BTAB, mode);
-#endif
-#ifdef KEY_BEG
- keydef("Key_Beginning", "KEY_BEG", KEY_BEG, mode);
-#endif
-#ifdef KEY_CANCEL
- keydef("Key_Cancel", "KEY_CANCEL", KEY_CANCEL, mode);
-#endif
-#ifdef KEY_CLOSE
- keydef("Key_Close", "KEY_CLOSE", KEY_CLOSE, mode);
-#endif
-#ifdef KEY_COMMAND
- keydef("Key_Command", "KEY_COMMAND", KEY_COMMAND, mode);
-#endif
-#ifdef KEY_COPY
- keydef("Key_Copy", "KEY_COPY", KEY_COPY, mode);
-#endif
-#ifdef KEY_CREATE
- keydef("Key_Create", "KEY_CREATE", KEY_CREATE, mode);
-#endif
-#ifdef KEY_END
- keydef("Key_End", "KEY_END", KEY_END, mode);
-#endif
-#ifdef KEY_EXIT
- keydef("Key_Exit", "KEY_EXIT", KEY_EXIT, mode);
-#endif
-#ifdef KEY_FIND
- keydef("Key_Find", "KEY_FIND", KEY_FIND, mode);
-#endif
-#ifdef KEY_HELP
- keydef("Key_Help", "KEY_HELP", KEY_HELP, mode);
-#endif
-#ifdef KEY_MARK
- keydef("Key_Mark", "KEY_MARK", KEY_MARK, mode);
-#endif
-#ifdef KEY_MESSAGE
- keydef("Key_Message", "KEY_MESSAGE", KEY_MESSAGE, mode);
-#endif
-#ifdef KEY_MOVE
- keydef("Key_Move", "KEY_MOVE", KEY_MOVE, mode);
-#endif
-#ifdef KEY_NEXT
- keydef("Key_Next", "KEY_NEXT", KEY_NEXT, mode);
-#endif
-#ifdef KEY_OPEN
- keydef("Key_Open", "KEY_OPEN", KEY_OPEN, mode);
-#endif
-#ifdef KEY_OPTIONS
- keydef("Key_Options", "KEY_OPTIONS", KEY_OPTIONS, mode);
-#endif
-#ifdef KEY_PREVIOUS
- keydef("Key_Previous", "KEY_PREVIOUS", KEY_PREVIOUS, mode);
-#endif
-#ifdef KEY_REDO
- keydef("Key_Redo", "KEY_REDO", KEY_REDO, mode);
-#endif
-#ifdef KEY_REFERENCE
- keydef("Key_Reference", "KEY_REFERENCE", KEY_REFERENCE, mode);
-#endif
-#ifdef KEY_REFRESH
- keydef("Key_Refresh", "KEY_REFRESH", KEY_REFRESH, mode);
-#endif
-#ifdef KEY_REPLACE
- keydef("Key_Replace", "KEY_REPLACE", KEY_REPLACE, mode);
-#endif
-#ifdef KEY_RESTART
- keydef("Key_Restart", "KEY_RESTART", KEY_RESTART, mode);
-#endif
-#ifdef KEY_RESUME
- keydef("Key_Resume", "KEY_RESUME", KEY_RESUME, mode);
-#endif
-#ifdef KEY_SAVE
- keydef("Key_Save", "KEY_SAVE", KEY_SAVE, mode);
-#endif
-#ifdef KEY_SBEG
- keydef("Key_Shift_Begin", "KEY_SBEG", KEY_SBEG, mode);
-#endif
-#ifdef KEY_SCANCEL
- keydef("Key_Shift_Cancel", "KEY_SCANCEL", KEY_SCANCEL, mode);
-#endif
-#ifdef KEY_SCOMMAND
- keydef("Key_Shift_Command", "KEY_SCOMMAND", KEY_SCOMMAND, mode);
-#endif
-#ifdef KEY_SCOPY
- keydef("Key_Shift_Copy", "KEY_SCOPY", KEY_SCOPY, mode);
-#endif
-#ifdef KEY_SCREATE
- keydef("Key_Shift_Create", "KEY_SCREATE", KEY_SCREATE, mode);
-#endif
-#ifdef KEY_SDC
- keydef("Key_Shift_Delete_Char", "KEY_SDC", KEY_SDC, mode);
-#endif
-#ifdef KEY_SDL
- keydef("Key_Shift_Delete_Line", "KEY_SDL", KEY_SDL, mode);
-#endif
-#ifdef KEY_SELECT
- keydef("Key_Select", "KEY_SELECT", KEY_SELECT, mode);
-#endif
-#ifdef KEY_SEND
- keydef("Key_Shift_End", "KEY_SEND", KEY_SEND, mode);
-#endif
-#ifdef KEY_SEOL
- keydef("Key_Shift_Clear_End_Of_Line", "KEY_SEOL", KEY_SEOL, mode);
-#endif
-#ifdef KEY_SEXIT
- keydef("Key_Shift_Exit", "KEY_SEXIT", KEY_SEXIT, mode);
-#endif
-#ifdef KEY_SFIND
- keydef("Key_Shift_Find", "KEY_SFIND", KEY_SFIND, mode);
-#endif
-#ifdef KEY_SHELP
- keydef("Key_Shift_Help", "KEY_SHELP", KEY_SHELP, mode);
-#endif
-#ifdef KEY_SHOME
- keydef("Key_Shift_Home", "KEY_SHOME", KEY_SHOME, mode);
-#endif
-#ifdef KEY_SIC
- keydef("Key_Shift_Insert_Char", "KEY_SIC", KEY_SIC, mode);
-#endif
-#ifdef KEY_SLEFT
- keydef("Key_Shift_Cursor_Left", "KEY_SLEFT", KEY_SLEFT, mode);
-#endif
-#ifdef KEY_SMESSAGE
- keydef("Key_Shift_Message", "KEY_SMESSAGE", KEY_SMESSAGE, mode);
-#endif
-#ifdef KEY_SMOVE
- keydef("Key_Shift_Move", "KEY_SMOVE", KEY_SMOVE, mode);
-#endif
-#ifdef KEY_SNEXT
- keydef("Key_Shift_Next_Page", "KEY_SNEXT", KEY_SNEXT, mode);
-#endif
-#ifdef KEY_SOPTIONS
- keydef("Key_Shift_Options", "KEY_SOPTIONS", KEY_SOPTIONS, mode);
-#endif
-#ifdef KEY_SPREVIOUS
- keydef("Key_Shift_Previous_Page", "KEY_SPREVIOUS", KEY_SPREVIOUS, mode);
-#endif
-#ifdef KEY_SPRINT
- keydef("Key_Shift_Print", "KEY_SPRINT", KEY_SPRINT, mode);
-#endif
-#ifdef KEY_SREDO
- keydef("Key_Shift_Redo", "KEY_SREDO", KEY_SREDO, mode);
-#endif
-#ifdef KEY_SREPLACE
- keydef("Key_Shift_Replace", "KEY_SREPLACE", KEY_SREPLACE, mode);
-#endif
-#ifdef KEY_SRIGHT
- keydef("Key_Shift_Cursor_Right", "KEY_SRIGHT", KEY_SRIGHT, mode);
-#endif
-#ifdef KEY_SRSUME
- keydef("Key_Shift_Resume", "KEY_SRSUME", KEY_SRSUME, mode);
-#endif
-#ifdef KEY_SSAVE
- keydef("Key_Shift_Save", "KEY_SSAVE", KEY_SSAVE, mode);
-#endif
-#ifdef KEY_SSUSPEND
- keydef("Key_Shift_Suspend", "KEY_SSUSPEND", KEY_SSUSPEND, mode);
-#endif
-#ifdef KEY_SUNDO
- keydef("Key_Shift_Undo", "KEY_SUNDO", KEY_SUNDO, mode);
-#endif
-#ifdef KEY_SUSPEND
- keydef("Key_Suspend", "KEY_SUSPEND", KEY_SUSPEND, mode);
-#endif
-#ifdef KEY_UNDO
- keydef("Key_Undo", "KEY_UNDO", KEY_UNDO, mode);
-#endif
-#ifdef KEY_MOUSE
- keydef("Key_Mouse", "KEY_MOUSE", KEY_MOUSE, mode);
-#endif
-#ifdef KEY_RESIZE
- keydef("Key_Resize", "KEY_RESIZE", KEY_RESIZE, mode);
-#endif
-}
-
-/*
- * 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.
- */
-static void
-acs_def(const char *name, chtype *a)
-{
- int c = (int)(a - &acs_map[0]);
-
- printf(" %-24s : constant Character := ", name);
- if (isprint(UChar(c)) && (c != '`'))
- printf("'%c';\n", c);
- else
- printf("Character'Val (%d);\n", c);
-}
-
-/*
- * Generate the constants for the ACS characters
- */
-static void
-gen_acs(void)
-{
- printf(" type C_ACS_Map is array (Character'Val (0) .. Character'Val (127))\n");
- printf(" of Attributed_Character;\n");
-#if USE_REENTRANT || BROKEN_LINKER
- 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");
-
-#ifdef ACS_ULCORNER
- acs_def("ACS_Upper_Left_Corner", &ACS_ULCORNER);
-#endif
-#ifdef ACS_LLCORNER
- acs_def("ACS_Lower_Left_Corner", &ACS_LLCORNER);
-#endif
-#ifdef ACS_URCORNER
- acs_def("ACS_Upper_Right_Corner", &ACS_URCORNER);
-#endif
-#ifdef ACS_LRCORNER
- acs_def("ACS_Lower_Right_Corner", &ACS_LRCORNER);
-#endif
-#ifdef ACS_LTEE
- acs_def("ACS_Left_Tee", &ACS_LTEE);
-#endif
-#ifdef ACS_RTEE
- acs_def("ACS_Right_Tee", &ACS_RTEE);
-#endif
-#ifdef ACS_BTEE
- acs_def("ACS_Bottom_Tee", &ACS_BTEE);
-#endif
-#ifdef ACS_TTEE
- acs_def("ACS_Top_Tee", &ACS_TTEE);
-#endif
-#ifdef ACS_HLINE
- acs_def("ACS_Horizontal_Line", &ACS_HLINE);
-#endif
-#ifdef ACS_VLINE
- acs_def("ACS_Vertical_Line", &ACS_VLINE);
-#endif
-#ifdef ACS_PLUS
- acs_def("ACS_Plus_Symbol", &ACS_PLUS);
-#endif
-#ifdef ACS_S1
- acs_def("ACS_Scan_Line_1", &ACS_S1);
-#endif
-#ifdef ACS_S9
- acs_def("ACS_Scan_Line_9", &ACS_S9);
-#endif
-#ifdef ACS_DIAMOND
- acs_def("ACS_Diamond", &ACS_DIAMOND);
-#endif
-#ifdef ACS_CKBOARD
- acs_def("ACS_Checker_Board", &ACS_CKBOARD);
-#endif
-#ifdef ACS_DEGREE
- acs_def("ACS_Degree", &ACS_DEGREE);
-#endif
-#ifdef ACS_PLMINUS
- acs_def("ACS_Plus_Minus", &ACS_PLMINUS);
-#endif
-#ifdef ACS_BULLET
- acs_def("ACS_Bullet", &ACS_BULLET);
-#endif
-#ifdef ACS_LARROW
- acs_def("ACS_Left_Arrow", &ACS_LARROW);
-#endif
-#ifdef ACS_RARROW
- acs_def("ACS_Right_Arrow", &ACS_RARROW);
-#endif
-#ifdef ACS_DARROW
- acs_def("ACS_Down_Arrow", &ACS_DARROW);
-#endif
-#ifdef ACS_UARROW
- acs_def("ACS_Up_Arrow", &ACS_UARROW);
-#endif
-#ifdef ACS_BOARD
- acs_def("ACS_Board_Of_Squares", &ACS_BOARD);
-#endif
-#ifdef ACS_LANTERN
- acs_def("ACS_Lantern", &ACS_LANTERN);
-#endif
-#ifdef ACS_BLOCK
- acs_def("ACS_Solid_Block", &ACS_BLOCK);
-#endif
-#ifdef ACS_S3
- acs_def("ACS_Scan_Line_3", &ACS_S3);
-#endif
-#ifdef ACS_S7
- acs_def("ACS_Scan_Line_7", &ACS_S7);
-#endif
-#ifdef ACS_LEQUAL
- acs_def("ACS_Less_Or_Equal", &ACS_LEQUAL);
-#endif
-#ifdef ACS_GEQUAL
- acs_def("ACS_Greater_Or_Equal", &ACS_GEQUAL);
-#endif
-#ifdef ACS_PI
- acs_def("ACS_PI", &ACS_PI);
-#endif
-#ifdef ACS_NEQUAL
- acs_def("ACS_Not_Equal", &ACS_NEQUAL);
-#endif
-#ifdef ACS_STERLING
- acs_def("ACS_Sterling", &ACS_STERLING);
-#endif
-}
-
-#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
-gen_mouse_events(void)
-{
- 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
+ PRINT_NAMED_CONSTANT(KEY_CODE_YES);
+#endif
+
+ print_comment("Input key codes from getch(3NCURSES)");
+ PRINT_NAMED_CONSTANT(KEY_BREAK);
+ PRINT_NAMED_CONSTANT(KEY_DOWN);
+ PRINT_NAMED_CONSTANT(KEY_UP);
+ PRINT_NAMED_CONSTANT(KEY_LEFT);
+ PRINT_NAMED_CONSTANT(KEY_RIGHT);
+ PRINT_NAMED_CONSTANT(KEY_HOME);
+ PRINT_NAMED_CONSTANT(KEY_BACKSPACE);
+ PRINT_NAMED_CONSTANT(KEY_F0);
+ print_constant("KEY_F1", KEY_F(1));
+ print_constant("KEY_F2", KEY_F(2));
+ print_constant("KEY_F3", KEY_F(3));
+ print_constant("KEY_F4", KEY_F(4));
+ print_constant("KEY_F5", KEY_F(5));
+ print_constant("KEY_F6", KEY_F(6));
+ print_constant("KEY_F7", KEY_F(7));
+ print_constant("KEY_F8", KEY_F(8));
+ print_constant("KEY_F9", KEY_F(9));
+ print_constant("KEY_F10", KEY_F(10));
+ print_constant("KEY_F11", KEY_F(11));
+ print_constant("KEY_F12", KEY_F(12));
+ print_constant("KEY_F13", KEY_F(13));
+ print_constant("KEY_F14", KEY_F(14));
+ print_constant("KEY_F15", KEY_F(15));
+ print_constant("KEY_F16", KEY_F(16));
+ print_constant("KEY_F17", KEY_F(17));
+ print_constant("KEY_F18", KEY_F(18));
+ print_constant("KEY_F19", KEY_F(19));
+ print_constant("KEY_F20", KEY_F(20));
+ print_constant("KEY_F21", KEY_F(21));
+ print_constant("KEY_F22", KEY_F(22));
+ print_constant("KEY_F23", KEY_F(23));
+ print_constant("KEY_F24", KEY_F(24));
+ PRINT_NAMED_CONSTANT(KEY_DL);
+ PRINT_NAMED_CONSTANT(KEY_IL);
+ PRINT_NAMED_CONSTANT(KEY_DC);
+ PRINT_NAMED_CONSTANT(KEY_IC);
+ PRINT_NAMED_CONSTANT(KEY_EIC);
+ PRINT_NAMED_CONSTANT(KEY_CLEAR);
+ PRINT_NAMED_CONSTANT(KEY_EOS);
+ PRINT_NAMED_CONSTANT(KEY_EOL);
+ PRINT_NAMED_CONSTANT(KEY_SF);
+ PRINT_NAMED_CONSTANT(KEY_SR);
+ PRINT_NAMED_CONSTANT(KEY_NPAGE);
+ PRINT_NAMED_CONSTANT(KEY_PPAGE);
+ PRINT_NAMED_CONSTANT(KEY_STAB);
+ PRINT_NAMED_CONSTANT(KEY_CTAB);
+ PRINT_NAMED_CONSTANT(KEY_CATAB);
+ PRINT_NAMED_CONSTANT(KEY_ENTER);
+ PRINT_NAMED_CONSTANT(KEY_SRESET);
+ PRINT_NAMED_CONSTANT(KEY_RESET);
+ PRINT_NAMED_CONSTANT(KEY_PRINT);
+ PRINT_NAMED_CONSTANT(KEY_LL);
+ PRINT_NAMED_CONSTANT(KEY_A1);
+ PRINT_NAMED_CONSTANT(KEY_A3);
+ PRINT_NAMED_CONSTANT(KEY_B2);
+ PRINT_NAMED_CONSTANT(KEY_C1);
+ PRINT_NAMED_CONSTANT(KEY_C3);
+ PRINT_NAMED_CONSTANT(KEY_BTAB);
+ PRINT_NAMED_CONSTANT(KEY_BEG);
+ PRINT_NAMED_CONSTANT(KEY_CANCEL);
+ PRINT_NAMED_CONSTANT(KEY_CLOSE);
+ PRINT_NAMED_CONSTANT(KEY_COMMAND);
+ PRINT_NAMED_CONSTANT(KEY_COPY);
+ PRINT_NAMED_CONSTANT(KEY_CREATE);
+ PRINT_NAMED_CONSTANT(KEY_END);
+ PRINT_NAMED_CONSTANT(KEY_EXIT);
+ PRINT_NAMED_CONSTANT(KEY_FIND);
+ PRINT_NAMED_CONSTANT(KEY_HELP);
+ PRINT_NAMED_CONSTANT(KEY_MARK);
+ PRINT_NAMED_CONSTANT(KEY_MESSAGE);
+ PRINT_NAMED_CONSTANT(KEY_MOVE);
+ PRINT_NAMED_CONSTANT(KEY_NEXT);
+ PRINT_NAMED_CONSTANT(KEY_OPEN);
+ PRINT_NAMED_CONSTANT(KEY_OPTIONS);
+ PRINT_NAMED_CONSTANT(KEY_PREVIOUS);
+ PRINT_NAMED_CONSTANT(KEY_REDO);
+ PRINT_NAMED_CONSTANT(KEY_REFERENCE);
+ PRINT_NAMED_CONSTANT(KEY_REFRESH);
+ PRINT_NAMED_CONSTANT(KEY_REPLACE);
+ PRINT_NAMED_CONSTANT(KEY_RESTART);
+ PRINT_NAMED_CONSTANT(KEY_RESUME);
+ PRINT_NAMED_CONSTANT(KEY_SAVE);
+ PRINT_NAMED_CONSTANT(KEY_SBEG);
+ PRINT_NAMED_CONSTANT(KEY_SCANCEL);
+ PRINT_NAMED_CONSTANT(KEY_SCOMMAND);
+ PRINT_NAMED_CONSTANT(KEY_SCOPY);
+ PRINT_NAMED_CONSTANT(KEY_SCREATE);
+ PRINT_NAMED_CONSTANT(KEY_SDC);
+ PRINT_NAMED_CONSTANT(KEY_SDL);
+ PRINT_NAMED_CONSTANT(KEY_SELECT);
+ PRINT_NAMED_CONSTANT(KEY_SEND);
+ PRINT_NAMED_CONSTANT(KEY_SEOL);
+ PRINT_NAMED_CONSTANT(KEY_SEXIT);
+ PRINT_NAMED_CONSTANT(KEY_SFIND);
+ PRINT_NAMED_CONSTANT(KEY_SHELP);
+ PRINT_NAMED_CONSTANT(KEY_SHOME);
+ PRINT_NAMED_CONSTANT(KEY_SIC);
+ PRINT_NAMED_CONSTANT(KEY_SLEFT);
+ PRINT_NAMED_CONSTANT(KEY_SMESSAGE);
+ PRINT_NAMED_CONSTANT(KEY_SMOVE);
+ PRINT_NAMED_CONSTANT(KEY_SNEXT);
+ PRINT_NAMED_CONSTANT(KEY_SOPTIONS);
+ PRINT_NAMED_CONSTANT(KEY_SPREVIOUS);
+ PRINT_NAMED_CONSTANT(KEY_SPRINT);
+ PRINT_NAMED_CONSTANT(KEY_SREDO);
+ PRINT_NAMED_CONSTANT(KEY_SREPLACE);
+ PRINT_NAMED_CONSTANT(KEY_SRIGHT);
+ PRINT_NAMED_CONSTANT(KEY_SRSUME);
+ PRINT_NAMED_CONSTANT(KEY_SSAVE);
+ PRINT_NAMED_CONSTANT(KEY_SSUSPEND);
+ PRINT_NAMED_CONSTANT(KEY_SUNDO);
+ PRINT_NAMED_CONSTANT(KEY_SUSPEND);
+ PRINT_NAMED_CONSTANT(KEY_UNDO);
+ PRINT_NAMED_CONSTANT(KEY_MOUSE);
+ PRINT_NAMED_CONSTANT(KEY_RESIZE);
+
+ print_comment("alternate character codes (ACS) from addch(3NCURSES)");
+#define PRINT_ACS(name) print_constant (#name, &name - &acs_map[0])
+ PRINT_ACS(ACS_ULCORNER);
+ PRINT_ACS(ACS_LLCORNER);
+ PRINT_ACS(ACS_URCORNER);
+ PRINT_ACS(ACS_LRCORNER);
+ PRINT_ACS(ACS_LTEE);
+ PRINT_ACS(ACS_RTEE);
+ PRINT_ACS(ACS_BTEE);
+ PRINT_ACS(ACS_TTEE);
+ PRINT_ACS(ACS_HLINE);
+ PRINT_ACS(ACS_VLINE);
+ PRINT_ACS(ACS_PLUS);
+ PRINT_ACS(ACS_S1);
+ PRINT_ACS(ACS_S9);
+ PRINT_ACS(ACS_DIAMOND);
+ PRINT_ACS(ACS_CKBOARD);
+ PRINT_ACS(ACS_DEGREE);
+ PRINT_ACS(ACS_PLMINUS);
+ PRINT_ACS(ACS_BULLET);
+ PRINT_ACS(ACS_LARROW);
+ PRINT_ACS(ACS_RARROW);
+ PRINT_ACS(ACS_DARROW);
+ PRINT_ACS(ACS_UARROW);
+ PRINT_ACS(ACS_BOARD);
+ PRINT_ACS(ACS_LANTERN);
+ PRINT_ACS(ACS_BLOCK);
+ PRINT_ACS(ACS_S3);
+ PRINT_ACS(ACS_S7);
+ PRINT_ACS(ACS_LEQUAL);
+ PRINT_ACS(ACS_GEQUAL);
+ PRINT_ACS(ACS_PI);
+ PRINT_ACS(ACS_NEQUAL);
+ PRINT_ACS(ACS_STERLING);
+
+ print_comment("Menu_Options from opts(3MENU)");
+ PRINT_NAMED_BITMASK(Menu_Options, O_ONEVALUE);
+ PRINT_NAMED_BITMASK(Menu_Options, O_SHOWDESC);
+ PRINT_NAMED_BITMASK(Menu_Options, O_ROWMAJOR);
+ PRINT_NAMED_BITMASK(Menu_Options, O_IGNORECASE);
+ PRINT_NAMED_BITMASK(Menu_Options, O_SHOWMATCH);
+ PRINT_NAMED_BITMASK(Menu_Options, O_NONCYCLIC);
+ print_constant("Menu_Options_Size", 8 * sizeof(Menu_Options));
+
+ print_comment("Item_Options from menu_opts(3MENU)");
+ PRINT_NAMED_BITMASK(Item_Options, O_SELECTABLE);
+ print_constant("Item_Options_Size", 8 * sizeof(Item_Options));
+
+ print_comment("Field_Options from field_opts(3FORM)");
+ PRINT_NAMED_BITMASK(Field_Options, O_VISIBLE);
+ PRINT_NAMED_BITMASK(Field_Options, O_ACTIVE);
+ PRINT_NAMED_BITMASK(Field_Options, O_PUBLIC);
+ PRINT_NAMED_BITMASK(Field_Options, O_EDIT);
+ PRINT_NAMED_BITMASK(Field_Options, O_WRAP);
+ PRINT_NAMED_BITMASK(Field_Options, O_BLANK);
+ PRINT_NAMED_BITMASK(Field_Options, O_AUTOSKIP);
+ PRINT_NAMED_BITMASK(Field_Options, O_NULLOK);
+ PRINT_NAMED_BITMASK(Field_Options, O_PASSOK);
+ PRINT_NAMED_BITMASK(Field_Options, O_STATIC);
+ print_constant("Field_Options_Size", 8 * sizeof(Field_Options));
+
+ print_comment("Field_Options from opts(3FORM)");
+ PRINT_NAMED_BITMASK(Field_Options, O_NL_OVERLOAD);
+ PRINT_NAMED_BITMASK(Field_Options, O_BS_OVERLOAD);
+ /* Field_Options_Size is defined below */
+
+ print_comment("MEVENT structure from mouse(3NCURSES)");
+ STRUCT_OFFSET(MEVENT, id);
+ STRUCT_OFFSET(MEVENT, x);
+ STRUCT_OFFSET(MEVENT, y);
+ STRUCT_OFFSET(MEVENT, z);
+ STRUCT_OFFSET(MEVENT, bstate);
+ print_constant("MEVENT_Size", 8 * sizeof(MEVENT));
+
+ print_comment("mouse events from mouse(3NCURSES)");
+ {
+ mmask_t all_events;
+
+#define PRINT_MOUSE_EVENT(event) \
+ print_constant (#event, event); \
+ all_events |= event
+
+ all_events = 0;
+ PRINT_MOUSE_EVENT(BUTTON1_RELEASED);
+ PRINT_MOUSE_EVENT(BUTTON1_PRESSED);
+ PRINT_MOUSE_EVENT(BUTTON1_CLICKED);
+ PRINT_MOUSE_EVENT(BUTTON1_DOUBLE_CLICKED);
+ PRINT_MOUSE_EVENT(BUTTON1_TRIPLE_CLICKED);
#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);
+ PRINT_MOUSE_EVENT(BUTTON1_RESERVED_EVENT);
#endif
-#ifdef REPORT_MOUSE_POSITION
- GEN_MEVENT(REPORT_MOUSE_POSITION);
-#endif
-#ifdef ALL_MOUSE_EVENTS
- GEN_MEVENT(ALL_MOUSE_EVENTS);
-#endif
-
- GEN_EVENT(BUTTON1_EVENTS, all1);
- GEN_EVENT(BUTTON2_EVENTS, all2);
- GEN_EVENT(BUTTON3_EVENTS, all3);
- GEN_EVENT(BUTTON4_EVENTS, all4);
-}
-
-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);
-}
-
-/*
- * 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.
- */
-static void
-prologue(const char *name)
-{
- printf("-- %s binding.\n", name);
- printf("-- This module is generated. Please don't change it manually!\n");
- printf("-- Run the generator instead.\n-- |");
-
- printf("define(`M4_BIT_ORDER',`%s_Order_First')",
- little_endian ? "Low" : "High");
-}
+ print_constant("all_events_button_1", (long)all_events);
-/*
- * Write the prologue for the curses facility and make sure that
- * KEY_MIN and KEY_MAX are defined for the rest of this source.
- */
-static void
-basedefs(void)
-{
- prologue("curses");
-#ifndef KEY_MAX
-# define KEY_MAX 0777
-#endif
- printf("define(`M4_KEY_MAX',`8#%o#')", KEY_MAX);
-#ifndef KEY_MIN
-# define KEY_MIN 0401
+ all_events = 0;
+ PRINT_MOUSE_EVENT(BUTTON2_RELEASED);
+ PRINT_MOUSE_EVENT(BUTTON2_PRESSED);
+ PRINT_MOUSE_EVENT(BUTTON2_CLICKED);
+ PRINT_MOUSE_EVENT(BUTTON2_DOUBLE_CLICKED);
+ PRINT_MOUSE_EVENT(BUTTON2_TRIPLE_CLICKED);
+#ifdef BUTTON2_RESERVED_EVENT
+ PRINT_MOUSE_EVENT(BUTTON2_RESERVED_EVENT);
#endif
- 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);
-}
-
-/*
- * Write out the comment lines for the menu facility
- */
-static void
-menu_basedefs(void)
-{
- prologue("menu");
-}
-
-/*
- * Write out the comment lines for the form facility
- */
-static void
-form_basedefs(void)
-{
- prologue("form");
-}
-
-/*
- * Write out the comment lines for the mouse facility
- */
-static void
-mouse_basedefs(void)
-{
- prologue("mouse");
-}
+ print_constant("all_events_button_2", (long)all_events);
-/*
- * Write the definition of a single color
- */
-static void
-color_def(const char *name, int value)
-{
- printf(" %-16s : constant Color_Number := %d;\n", name, value);
-}
-
-/*
- * Generate all color definitions
- */
-static void
-gen_color(void)
-{
-#if HAVE_USE_DEFAULT_COLORS
- color_def("Default_Color", -1);
-#endif
-#ifdef COLOR_BLACK
- color_def("Black", COLOR_BLACK);
-#endif
-#ifdef COLOR_RED
- color_def("Red", COLOR_RED);
-#endif
-#ifdef COLOR_GREEN
- color_def("Green", COLOR_GREEN);
-#endif
-#ifdef COLOR_YELLOW
- color_def("Yellow", COLOR_YELLOW);
-#endif
-#ifdef COLOR_BLUE
- color_def("Blue", COLOR_BLUE);
-#endif
-#ifdef COLOR_MAGENTA
- color_def("Magenta", COLOR_MAGENTA);
-#endif
-#ifdef COLOR_CYAN
- color_def("Cyan", COLOR_CYAN);
-#endif
-#ifdef COLOR_WHITE
- color_def("White", COLOR_WHITE);
+ all_events = 0;
+ PRINT_MOUSE_EVENT(BUTTON3_RELEASED);
+ PRINT_MOUSE_EVENT(BUTTON3_PRESSED);
+ PRINT_MOUSE_EVENT(BUTTON3_CLICKED);
+ PRINT_MOUSE_EVENT(BUTTON3_DOUBLE_CLICKED);
+ PRINT_MOUSE_EVENT(BUTTON3_TRIPLE_CLICKED);
+#ifdef BUTTON3_RESERVED_EVENT
+ PRINT_MOUSE_EVENT(BUTTON3_RESERVED_EVENT);
#endif
-}
-
-/*
- * Generate the linker options for the base facility
- */
-static void
-gen_linkopts(void)
-{
- printf(" pragma Linker_Options (\"-lncurses%s\");\n", model);
-}
+ print_constant("all_events_button_3", (long)all_events);
-/*
- * Generate the linker options for the menu facility
- */
-static void
-gen_menu_linkopts(void)
-{
- printf(" pragma Linker_Options (\"-lmenu%s\");\n", model);
-}
-
-/*
- * Generate the linker options for the form facility
- */
-static void
-gen_form_linkopts(void)
-{
- printf(" pragma Linker_Options (\"-lform%s\");\n", model);
-}
-
-/*
- * Generate the linker options for the panel facility
- */
-static void
-gen_panel_linkopts(void)
-{
- printf(" pragma Linker_Options (\"-lpanel%s\");\n", model);
-}
-
-static void
-gen_version_info(void)
-{
- 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";
-
- printf(v1, NCURSES_VERSION_MAJOR);
- printf(v2, NCURSES_VERSION_MINOR);
- printf(v3, '"', NCURSES_VERSION_MAJOR, NCURSES_VERSION_MINOR, '"');
-}
-
-static int
-eti_gen(char *buf, int code, const char *name, int *etimin, int *etimax)
-{
- sprintf(buf, " E_%-16s : constant Eti_Error := %d;\n", name, code);
- if (code < *etimin)
- *etimin = code;
- if (code > *etimax)
- *etimax = code;
- return (int)strlen(buf);
-}
-
-static void
-gen_offsets(void)
-{
- 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";
- }
- printf(" Sizeof%-*s : constant Natural := %2ld; -- %s\n",
- 12, "_bool", (long)sizeof(bool), "bool");
-
- printf(" type Curses_Bool is mod 2 ** Interfaces.C.%s'Size;\n", s_bool);
-}
-
-/*
- * 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)
- * E - ETI base definitions
- *
- * The second character then denotes the specific output that should be
- * generated for the selected facility.
- */
-int
-main(int argc, char *argv[])
-{
- int x = 0x12345678;
- char *s = (char *)&x;
-
- if (*s == 0x78)
- little_endian = 1;
-
- if (argc != 4)
- exit(1);
- model = *++argv;
-
- switch (argv[1][0])
- {
- /* --------------------------------------------------------------- */
- case 'B': /* The Base facility */
- switch (argv[2][0])
- {
- case 'A': /* chtype translation into Ada95 record type */
- gen_attr_set("Character_Attribute_Set");
- break;
- case 'B': /* write some initial comment lines */
- basedefs();
- break;
- case 'C': /* generate color constants */
- gen_color();
- break;
- case 'D': /* generate displacements of fields in WINDOW struct. */
- gen_offsets();
- break;
- case 'E': /* generate Mouse Event codes */
- gen_mouse_events();
- break;
- case 'K': /* translation of keycodes */
- gen_keydefs(0);
- break;
- case 'L': /* generate the Linker_Options pragma */
- gen_linkopts();
- break;
- case 'M': /* generate constants for the ACS characters */
- gen_acs();
- break;
- case 'O': /* generate definitions of the old key code names */
- gen_keydefs(1);
- break;
- case 'P': /* generate definitions of the public variables */
- gen_public_vars();
- break;
- case 'R': /* generate representation clause for Attributed character */
- gen_chtype_rep("Attributed_Character");
- break;
- case 'T': /* generate the Trace info */
- gen_trace("Trace_Attribute_Set");
- break;
- case 'V': /* generate version info */
- gen_version_info();
- break;
- default:
- break;
- }
- break;
- /* --------------------------------------------------------------- */
- case 'M': /* The Menu facility */
- switch (argv[2][0])
- {
- case 'R': /* generate representation clause for Menu_Option_Set */
- gen_menu_opt_rep("Menu_Option_Set");
- break;
- case 'B': /* write some initial comment lines */
- menu_basedefs();
- break;
- case 'L': /* generate the Linker_Options pragma */
- gen_menu_linkopts();
- break;
- case 'I': /* generate representation clause for Item_Option_Set */
- gen_item_opt_rep("Item_Option_Set");
- break;
- default:
- break;
- }
- break;
- /* --------------------------------------------------------------- */
- case 'F': /* The Form facility */
- switch (argv[2][0])
- {
- case 'R': /* generate representation clause for Form_Option_Set */
- gen_form_opt_rep("Form_Option_Set");
- break;
- case 'B': /* write some initial comment lines */
- form_basedefs();
- break;
- case 'L': /* generate the Linker_Options pragma */
- gen_form_linkopts();
- break;
- case 'I': /* generate representation clause for Field_Option_Set */
- gen_field_opt_rep("Field_Option_Set");
- break;
- default:
- break;
- }
- break;
- /* --------------------------------------------------------------- */
- case 'P': /* The Pointer(=Mouse) facility */
- switch (argv[2][0])
- {
- case 'B': /* write some initial comment lines */
- mouse_basedefs();
- break;
- case 'M': /* generate representation clause for Mouse_Event */
- gen_mrep_rep("Mouse_Event");
- break;
- case 'L': /* generate the Linker_Options pragma */
- gen_panel_linkopts();
- break;
- default:
- break;
- }
- break;
- /* --------------------------------------------------------------- */
- case 'E': /* chtype size detection */
- switch (argv[2][0])
- {
- 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");
- }
- else
- 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");
- }
- else
- printf("Error\n");
-
- 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("%s", buf);
- }
- break;
- default:
- break;
- }
- break;
- /* --------------------------------------------------------------- */
- case 'V': /* plain version dump */
- {
- switch (argv[2][0])
- {
- case '1': /* major version */
-#ifdef NCURSES_VERSION_MAJOR
- printf("%d", NCURSES_VERSION_MAJOR);
-#endif
- break;
- case '2': /* minor version */
-#ifdef NCURSES_VERSION_MINOR
- printf("%d", NCURSES_VERSION_MINOR);
-#endif
- break;
- case '3': /* patch level */
-#ifdef NCURSES_VERSION_PATCH
- printf("%d", NCURSES_VERSION_PATCH);
+ all_events = 0;
+ PRINT_MOUSE_EVENT(BUTTON4_RELEASED);
+ PRINT_MOUSE_EVENT(BUTTON4_PRESSED);
+ PRINT_MOUSE_EVENT(BUTTON4_CLICKED);
+ PRINT_MOUSE_EVENT(BUTTON4_DOUBLE_CLICKED);
+ PRINT_MOUSE_EVENT(BUTTON4_TRIPLE_CLICKED);
+#ifdef BUTTON4_RESERVED_EVENT
+ PRINT_MOUSE_EVENT(BUTTON4_RESERVED_EVENT);
#endif
- break;
- default:
- break;
- }
- }
- break;
- /* --------------------------------------------------------------- */
- default:
- break;
- }
- return 0;
+ print_constant("all_events_button_4", (long)all_events);
+ }
+ PRINT_NAMED_CONSTANT(BUTTON_CTRL);
+ PRINT_NAMED_CONSTANT(BUTTON_SHIFT);
+ PRINT_NAMED_CONSTANT(BUTTON_ALT);
+ PRINT_NAMED_CONSTANT(REPORT_MOUSE_POSITION);
+ PRINT_NAMED_CONSTANT(ALL_MOUSE_EVENTS);
+
+ print_comment("trace selection from trace(3NCURSES)");
+ PRINT_NAMED_BITMASK(UINT, TRACE_TIMES);
+ PRINT_NAMED_BITMASK(UINT, TRACE_TPUTS);
+ PRINT_NAMED_BITMASK(UINT, TRACE_UPDATE);
+ PRINT_NAMED_BITMASK(UINT, TRACE_MOVE);
+ PRINT_NAMED_BITMASK(UINT, TRACE_CHARPUT);
+ PRINT_NAMED_BITMASK(UINT, TRACE_CALLS);
+ PRINT_NAMED_BITMASK(UINT, TRACE_VIRTPUT);
+ PRINT_NAMED_BITMASK(UINT, TRACE_IEVENT);
+ PRINT_NAMED_BITMASK(UINT, TRACE_BITS);
+ PRINT_NAMED_BITMASK(UINT, TRACE_ICALLS);
+ PRINT_NAMED_BITMASK(UINT, TRACE_CCALLS);
+ PRINT_NAMED_BITMASK(UINT, TRACE_DATABASE);
+ PRINT_NAMED_BITMASK(UINT, TRACE_ATTRS);
+ print_constant("Trace_Size", 8 * sizeof(UINT));
+
+ printf("end Terminal_Interface.Curses_Constants;\n");
+ exit(EXIT_SUCCESS);
}
diff --git a/Ada95/gen/html.m4 b/Ada95/gen/html.m4
index 8df2653c7ecf..76058505b3e9 100644
--- a/Ada95/gen/html.m4
+++ b/Ada95/gen/html.m4
@@ -1,5 +1,5 @@
dnl***************************************************************************
-dnl Copyright (c) 2000-2006,2007 Free Software Foundation, Inc. *
+dnl Copyright (c) 2000-2007,2019 Free Software Foundation, Inc. *
dnl *
dnl Permission is hereby granted, free of charge, to any person obtaining a *
dnl copy of this software and associated documentation files (the *
@@ -26,7 +26,7 @@ dnl sale, use or other dealings in this Software without prior written *
dnl authorization. *
dnl***************************************************************************
dnl
-dnl $Id: html.m4,v 1.3 2007/09/01 23:59:59 tom Exp $
+dnl $Id: html.m4,v 1.4 2019/03/16 21:49:15 tom Exp $
define(`ANCHORIDX',`0')dnl
define(`MANPAGE',`define(`MANPG',$1)dnl
|=====================================================================
@@ -35,6 +35,6 @@ define(`MANPAGE',`define(`MANPG',$1)dnl
define(`ANCHOR',`define(`ANCHORIDX',incr(ANCHORIDX))dnl
`#'1A NAME="AFU`_'ANCHORIDX"`#'2dnl
define(`CFUNAME',`$1')define(`AFUNAME',`$2')dnl
-|')dnl
+|#1/A#2')dnl
define(`AKA',``AKA': <A HREF="../man/MANPG.html">CFUNAME</A>')dnl
define(`ALIAS',``AKA': $1')dnl
diff --git a/Ada95/gen/terminal_interface-curses-aux.ads.m4 b/Ada95/gen/terminal_interface-curses-aux.ads.m4
index 111ec698a493..5e3505020c66 100644
--- a/Ada95/gen/terminal_interface-curses-aux.ads.m4
+++ b/Ada95/gen/terminal_interface-curses-aux.ads.m4
@@ -10,7 +10,7 @@ include(M4MACRO)dnl
-- S P E C --
-- --
------------------------------------------------------------------------------
--- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2014,2018 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 --
@@ -38,20 +38,16 @@ include(M4MACRO)dnl
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
--- $Revision: 1.18 $
+-- $Revision: 1.24 $
-- Binding Version 01.00
------------------------------------------------------------------------------
-include(`Base_Defs')
with System;
with Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
-with Unchecked_Conversion;
package Terminal_Interface.Curses.Aux is
pragma Preelaborate (Terminal_Interface.Curses.Aux);
- use type Interfaces.C.int;
-
subtype C_Int is Interfaces.C.int;
subtype C_Short is Interfaces.C.short;
subtype C_Long_Int is Interfaces.C.long;
@@ -60,39 +56,39 @@ package Terminal_Interface.Curses.Aux is
subtype C_ULong is Interfaces.C.unsigned_long;
subtype C_Char_Ptr is Interfaces.C.Strings.chars_ptr;
type C_Void_Ptr is new System.Address;
-include(`Chtype_Def')
+
-- This is how those constants are defined in ncurses. I see them also
-- exactly like this in all ETI implementations I ever tested. So it
-- could be that this is quite general, but please check with your curses.
-- This is critical, because curses sometime mixes Boolean returns with
-- returning an error status.
- Curses_Ok : constant C_Int := CF_CURSES_OK;
- Curses_Err : constant C_Int := CF_CURSES_ERR;
+ Curses_Ok : constant C_Int := Curses_Constants.OK;
+ Curses_Err : constant C_Int := Curses_Constants.ERR;
- Curses_True : constant C_Int := CF_CURSES_TRUE;
- Curses_False : constant C_Int := CF_CURSES_FALSE;
+ Curses_True : constant C_Int := Curses_Constants.TRUE;
+ Curses_False : constant C_Int := Curses_Constants.FALSE;
-- Eti_Error: type for error codes returned by the menu and form subsystem
-include(`Eti_Defs')
- procedure Eti_Exception (Code : Eti_Error);
- -- Dispatch the error code and raise the appropriate exception
- --
- --
- -- Some helpers
- function Chtype_To_AttrChar is new
- Unchecked_Conversion (Source => C_Chtype,
- Target => Attributed_Character);
- function AttrChar_To_Chtype is new
- Unchecked_Conversion (Source => Attributed_Character,
- Target => C_Chtype);
+ type Eti_Error is
+ (E_Current,
+ E_Invalid_Field,
+ E_Request_Denied,
+ E_Not_Connected,
+ E_Not_Selectable,
+ E_No_Match,
+ E_Unknown_Command,
+ E_Not_Posted,
+ E_No_Room,
+ E_Bad_State,
+ E_Connected,
+ E_Posted,
+ E_Bad_Argument,
+ E_System_Error,
+ E_Ok);
- function AttrChar_To_AttrType is new
- Unchecked_Conversion (Source => Attributed_Character,
- Target => C_AttrType);
-
- function AttrType_To_AttrChar is new
- Unchecked_Conversion (Source => C_AttrType,
- Target => Attributed_Character);
+ procedure Eti_Exception (Code : Eti_Error);
+ -- Do nothing if Code = E_Ok.
+ -- Else dispatch the error code and raise the appropriate exception.
procedure Fill_String (Cp : chars_ptr;
Str : out String);
@@ -102,4 +98,23 @@ include(`Eti_Defs')
function Fill_String (Cp : chars_ptr) return String;
-- Same but as function.
+private
+ for Eti_Error'Size use C_Int'Size;
+ pragma Convention (C, Eti_Error);
+ for Eti_Error use
+ (E_Current => Curses_Constants.E_CURRENT,
+ E_Invalid_Field => Curses_Constants.E_INVALID_FIELD,
+ E_Request_Denied => Curses_Constants.E_REQUEST_DENIED,
+ E_Not_Connected => Curses_Constants.E_NOT_CONNECTED,
+ E_Not_Selectable => Curses_Constants.E_NOT_SELECTABLE,
+ E_No_Match => Curses_Constants.E_NO_MATCH,
+ E_Unknown_Command => Curses_Constants.E_UNKNOWN_COMMAND,
+ E_Not_Posted => Curses_Constants.E_NOT_POSTED,
+ E_No_Room => Curses_Constants.E_NO_ROOM,
+ E_Bad_State => Curses_Constants.E_BAD_STATE,
+ E_Connected => Curses_Constants.E_CONNECTED,
+ E_Posted => Curses_Constants.E_POSTED,
+ E_Bad_Argument => Curses_Constants.E_BAD_ARGUMENT,
+ E_System_Error => Curses_Constants.E_SYSTEM_ERROR,
+ E_Ok => Curses_Constants.E_OK);
end Terminal_Interface.Curses.Aux;
diff --git a/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 b/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4
index f9784007f461..4a179869b140 100644
--- a/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4
+++ b/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4
@@ -10,7 +10,7 @@ include(M4MACRO)dnl
-- S P E C --
-- --
------------------------------------------------------------------------------
--- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2014,2018 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 --
@@ -38,14 +38,14 @@ include(M4MACRO)dnl
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
--- $Revision: 1.17 $
+-- $Revision: 1.20 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Interfaces.C;
+with Terminal_Interface.Curses.Aux;
package Terminal_Interface.Curses.Forms.Field_Types is
pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types);
- use type Interfaces.C.int;
subtype C_Int is Interfaces.C.int;
-- MANPAGE(`form_fieldtype.3x')
@@ -227,12 +227,12 @@ private
Mak : Makearg_Function := Make_Arg'Access;
Cop : Copyarg_Function := Copy_Arg'Access;
Fre : Freearg_Function := Free_Arg'Access)
- return C_Int;
+ return Aux.Eti_Error;
pragma Import (C, Set_Fieldtype_Arg, "set_fieldtype_arg");
function Set_Fieldtype_Choice (Cft : C_Field_Type;
Next, Prev : Choice_Function)
- return C_Int;
+ return Aux.Eti_Error;
pragma Import (C, Set_Fieldtype_Choice, "set_fieldtype_choice");
end Terminal_Interface.Curses.Forms.Field_Types;
diff --git a/Ada95/gen/terminal_interface-curses-forms.ads.m4 b/Ada95/gen/terminal_interface-curses-forms.ads.m4
index a4329ba9f0cf..b269f4c447d7 100644
--- a/Ada95/gen/terminal_interface-curses-forms.ads.m4
+++ b/Ada95/gen/terminal_interface-curses-forms.ads.m4
@@ -10,7 +10,7 @@ include(M4MACRO)dnl
-- S P E C --
-- --
------------------------------------------------------------------------------
--- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2009,2014 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 --
@@ -38,18 +38,17 @@ include(M4MACRO)dnl
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
--- $Revision: 1.30 $
--- $Date: 2009/12/26 17:31:35 $
+-- $Revision: 1.33 $
+-- $Date: 2014/05/24 21:31:57 $
-- Binding Version 01.00
------------------------------------------------------------------------------
-include(`Form_Base_Defs')
with System;
with Ada.Characters.Latin_1;
package Terminal_Interface.Curses.Forms is
pragma Preelaborate (Terminal_Interface.Curses.Forms);
-include(`Form_Linker_Options')dnl
-include(`Linker_Options')
+ pragma Linker_Options ("-lform" & Curses_Constants.DFT_ARG_SUFFIX);
+
Space : Character renames Ada.Characters.Latin_1.Space;
type Field is private;
@@ -63,18 +62,68 @@ include(`Linker_Options')
Center,
Right);
+ type Field_Option_Set is
+ record
+ Visible : Boolean;
+ Active : Boolean;
+ Public : Boolean;
+ Edit : Boolean;
+ Wrap : Boolean;
+ Blank : Boolean;
+ Auto_Skip : Boolean;
+ Null_Ok : Boolean;
+ Pass_Ok : Boolean;
+ Static : Boolean;
+ end record;
+ pragma Convention (C_Pass_By_Copy, Field_Option_Set);
+
+ for Field_Option_Set use
+ record
+ Visible at 0 range Curses_Constants.O_VISIBLE_First
+ .. Curses_Constants.O_VISIBLE_Last;
+ Active at 0 range Curses_Constants.O_ACTIVE_First
+ .. Curses_Constants.O_ACTIVE_Last;
+ Public at 0 range Curses_Constants.O_PUBLIC_First
+ .. Curses_Constants.O_PUBLIC_Last;
+ Edit at 0 range Curses_Constants.O_EDIT_First
+ .. Curses_Constants.O_EDIT_Last;
+ Wrap at 0 range Curses_Constants.O_WRAP_First
+ .. Curses_Constants.O_WRAP_Last;
+ Blank at 0 range Curses_Constants.O_BLANK_First
+ .. Curses_Constants.O_BLANK_Last;
+ Auto_Skip at 0 range Curses_Constants.O_AUTOSKIP_First
+ .. Curses_Constants.O_AUTOSKIP_Last;
+ Null_Ok at 0 range Curses_Constants.O_NULLOK_First
+ .. Curses_Constants.O_NULLOK_Last;
+ Pass_Ok at 0 range Curses_Constants.O_PASSOK_First
+ .. Curses_Constants.O_PASSOK_Last;
+ Static at 0 range Curses_Constants.O_STATIC_First
+ .. Curses_Constants.O_STATIC_Last;
+ end record;
pragma Warnings (Off);
-include(`Field_Rep')Dnl
-
+ for Field_Option_Set'Size use Curses_Constants.Field_Options_Size;
pragma Warnings (On);
function Default_Field_Options return Field_Option_Set;
-- The initial defaults for the field options.
pragma Inline (Default_Field_Options);
+ type Form_Option_Set is
+ record
+ NL_Overload : Boolean;
+ BS_Overload : Boolean;
+ end record;
+ pragma Convention (C_Pass_By_Copy, Form_Option_Set);
+
+ for Form_Option_Set use
+ record
+ NL_Overload at 0 range Curses_Constants.O_NL_OVERLOAD_First
+ .. Curses_Constants.O_NL_OVERLOAD_Last;
+ BS_Overload at 0 range Curses_Constants.O_BS_OVERLOAD_First
+ .. Curses_Constants.O_BS_OVERLOAD_Last;
+ end record;
pragma Warnings (Off);
-include(`Form_Opt_Rep')Dnl
-
+ for Form_Option_Set'Size use Curses_Constants.Field_Options_Size;
pragma Warnings (On);
function Default_Form_Options return Form_Option_Set;
diff --git a/Ada95/gen/terminal_interface-curses-menus.ads.m4 b/Ada95/gen/terminal_interface-curses-menus.ads.m4
index 6274b6ed8f2d..0ad9c456dbda 100644
--- a/Ada95/gen/terminal_interface-curses-menus.ads.m4
+++ b/Ada95/gen/terminal_interface-curses-menus.ads.m4
@@ -10,7 +10,7 @@ include(M4MACRO)dnl
-- S P E C --
-- --
------------------------------------------------------------------------------
--- Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2009,2014 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 --
@@ -38,18 +38,17 @@ include(M4MACRO)dnl
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
--- $Revision: 1.28 $
--- $Date: 2009/12/26 18:35:22 $
+-- $Revision: 1.31 $
+-- $Date: 2014/05/24 21:31:57 $
-- Binding Version 01.00
------------------------------------------------------------------------------
-include(`Menu_Base_Defs')
with System;
with Ada.Characters.Latin_1;
package Terminal_Interface.Curses.Menus is
pragma Preelaborate (Terminal_Interface.Curses.Menus);
-include(`Menu_Linker_Options')dnl
-include(`Linker_Options')
+ pragma Linker_Options ("-lmenu" & Curses_Constants.DFT_ARG_SUFFIX);
+
Space : Character renames Ada.Characters.Latin_1.Space;
type Item is private;
@@ -116,9 +115,34 @@ include(`Linker_Options')
--
-- Menu options
--
+ type Menu_Option_Set is
+ record
+ One_Valued : Boolean;
+ Show_Descriptions : Boolean;
+ Row_Major_Order : Boolean;
+ Ignore_Case : Boolean;
+ Show_Matches : Boolean;
+ Non_Cyclic : Boolean;
+ end record;
+ pragma Convention (C_Pass_By_Copy, Menu_Option_Set);
+
+ for Menu_Option_Set use
+ record
+ One_Valued at 0 range Curses_Constants.O_ONEVALUE_First
+ .. Curses_Constants.O_ONEVALUE_Last;
+ Show_Descriptions at 0 range Curses_Constants.O_SHOWDESC_First
+ .. Curses_Constants.O_SHOWDESC_Last;
+ Row_Major_Order at 0 range Curses_Constants.O_ROWMAJOR_First
+ .. Curses_Constants.O_ROWMAJOR_Last;
+ Ignore_Case at 0 range Curses_Constants.O_IGNORECASE_First
+ .. Curses_Constants.O_IGNORECASE_Last;
+ Show_Matches at 0 range Curses_Constants.O_SHOWMATCH_First
+ .. Curses_Constants.O_SHOWMATCH_Last;
+ Non_Cyclic at 0 range Curses_Constants.O_NONCYCLIC_First
+ .. Curses_Constants.O_NONCYCLIC_Last;
+ end record;
pragma Warnings (Off);
-include(`Menu_Opt_Rep')dnl
-
+ for Menu_Option_Set'Size use Curses_Constants.Menu_Options_Size;
pragma Warnings (On);
function Default_Menu_Options return Menu_Option_Set;
@@ -127,9 +151,19 @@ include(`Menu_Opt_Rep')dnl
--
-- Item options
--
+ type Item_Option_Set is
+ record
+ Selectable : Boolean;
+ end record;
+ pragma Convention (C_Pass_By_Copy, Item_Option_Set);
+
+ for Item_Option_Set use
+ record
+ Selectable at 0 range Curses_Constants.O_SELECTABLE_First
+ .. Curses_Constants.O_SELECTABLE_Last;
+ end record;
pragma Warnings (Off);
-include(`Item_Rep')dnl
-
+ for Item_Option_Set'Size use Curses_Constants.Item_Options_Size;
pragma Warnings (On);
function Default_Item_Options return Item_Option_Set;
diff --git a/Ada95/gen/terminal_interface-curses-mouse.ads.m4 b/Ada95/gen/terminal_interface-curses-mouse.ads.m4
index a4fb661ef84a..8d3f8edc7922 100644
--- a/Ada95/gen/terminal_interface-curses-mouse.ads.m4
+++ b/Ada95/gen/terminal_interface-curses-mouse.ads.m4
@@ -10,7 +10,7 @@ include(M4MACRO)dnl
-- S P E C --
-- --
------------------------------------------------------------------------------
--- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2014,2015 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 --
@@ -38,11 +38,10 @@ include(M4MACRO)dnl
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
--- $Revision: 1.29 $
--- $Date: 2011/03/19 12:35:58 $
+-- $Revision: 1.32 $
+-- $Date: 2015/05/30 23:19:19 $
-- Binding Version 01.00
------------------------------------------------------------------------------
-include(`Mouse_Base_Defs')
with System;
package Terminal_Interface.Curses.Mouse is
@@ -155,7 +154,10 @@ package Terminal_Interface.Curses.Mouse is
pragma Inline (Mouse_Interval);
private
- type Event_Mask is new Interfaces.C.unsigned_long;
+ -- This can be as little as 32 bits (unsigned), or as long as the system's
+ -- unsigned long. Declare it as the minimum size to handle all valid
+ -- sizes.
+ type Event_Mask is mod 4294967296;
type Mouse_Event is
record
@@ -167,12 +169,35 @@ private
end record;
pragma Convention (C, Mouse_Event);
-include(`Mouse_Event_Rep')
- Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER;
- -- This constant may be different on your system.
-
-include(`Mouse_Events')
- No_Events : constant Event_Mask := 0;
- All_Events : constant Event_Mask := ALL_MOUSE_EVENTS;
+ for Mouse_Event use
+ record
+ Id at 0 range Curses_Constants.MEVENT_id_First
+ .. Curses_Constants.MEVENT_id_Last;
+ X at 0 range Curses_Constants.MEVENT_x_First
+ .. Curses_Constants.MEVENT_x_Last;
+ Y at 0 range Curses_Constants.MEVENT_y_First
+ .. Curses_Constants.MEVENT_y_Last;
+ Z at 0 range Curses_Constants.MEVENT_z_First
+ .. Curses_Constants.MEVENT_z_Last;
+ Bstate at 0 range Curses_Constants.MEVENT_bstate_First
+ .. Curses_Constants.MEVENT_bstate_Last;
+ end record;
+ for Mouse_Event'Size use Curses_Constants.MEVENT_Size;
+ Generation_Bit_Order : System.Bit_Order renames Curses_Constants.Bit_Order;
+
+ BUTTON_CTRL : constant Event_Mask := Curses_Constants.BUTTON_CTRL;
+ BUTTON_SHIFT : constant Event_Mask := Curses_Constants.BUTTON_SHIFT;
+ BUTTON_ALT : constant Event_Mask := Curses_Constants.BUTTON_ALT;
+ BUTTON1_EVENTS : constant Event_Mask
+ := Curses_Constants.all_events_button_1;
+ BUTTON2_EVENTS : constant Event_Mask
+ := Curses_Constants.all_events_button_2;
+ BUTTON3_EVENTS : constant Event_Mask
+ := Curses_Constants.all_events_button_3;
+ BUTTON4_EVENTS : constant Event_Mask
+ := Curses_Constants.all_events_button_4;
+ ALL_MOUSE_EVENTS : constant Event_Mask := Curses_Constants.ALL_MOUSE_EVENTS;
+ No_Events : constant Event_Mask := 0;
+ All_Events : constant Event_Mask := ALL_MOUSE_EVENTS;
end Terminal_Interface.Curses.Mouse;
diff --git a/Ada95/gen/terminal_interface-curses-panels.ads.m4 b/Ada95/gen/terminal_interface-curses-panels.ads.m4
index dc06fa42171c..b0eda4d427d3 100644
--- a/Ada95/gen/terminal_interface-curses-panels.ads.m4
+++ b/Ada95/gen/terminal_interface-curses-panels.ads.m4
@@ -10,7 +10,7 @@ include(M4MACRO)dnl
-- S P E C --
-- --
------------------------------------------------------------------------------
--- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2009,2014 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 --
@@ -38,16 +38,16 @@ include(M4MACRO)dnl
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
--- $Revision: 1.20 $
--- $Date: 2009/12/26 17:38:58 $
+-- $Revision: 1.22 $
+-- $Date: 2014/05/24 21:31:57 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with System;
package Terminal_Interface.Curses.Panels is
pragma Preelaborate (Terminal_Interface.Curses.Panels);
-include(`Panel_Linker_Options')dnl
-include(`Linker_Options')
+ pragma Linker_Options ("-lpanel" & Curses_Constants.DFT_ARG_SUFFIX);
+
type Panel is private;
---------------------------
diff --git a/Ada95/gen/terminal_interface-curses-trace.ads.m4 b/Ada95/gen/terminal_interface-curses-trace.ads.m4
index 546004fd4938..e22734358a5e 100644
--- a/Ada95/gen/terminal_interface-curses-trace.ads.m4
+++ b/Ada95/gen/terminal_interface-curses-trace.ads.m4
@@ -9,7 +9,7 @@ include(M4MACRO)----------------------------------------------------------------
-- S P E C --
-- --
------------------------------------------------------------------------------
--- Copyright (c) 2000 Free Software Foundation, Inc. --
+-- Copyright (c) 2000,2014 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 --
@@ -37,16 +37,62 @@ include(M4MACRO)----------------------------------------------------------------
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000
-- Version Control:
--- $Revision: 1.1 $
+-- $Revision: 1.4 $
-- Binding Version 01.00
------------------------------------------------------------------------------
package Terminal_Interface.Curses.Trace is
pragma Preelaborate (Terminal_Interface.Curses.Trace);
- pragma Warnings (Off);
-include(`Trace_Defs')
+ type Trace_Attribute_Set is
+ record
+ Times : Boolean;
+ Tputs : Boolean;
+ Update : Boolean;
+ Cursor_Move : Boolean;
+ Character_Output : Boolean;
+ Calls : Boolean;
+ Virtual_Puts : Boolean;
+ Input_Events : Boolean;
+ TTY_State : Boolean;
+ Internal_Calls : Boolean;
+ Character_Calls : Boolean;
+ Termcap_TermInfo : Boolean;
+ Attribute_Color : Boolean;
+ end record;
+ pragma Convention (C_Pass_By_Copy, Trace_Attribute_Set);
+ for Trace_Attribute_Set use
+ record
+ Times at 0 range Curses_Constants.TRACE_TIMES_First
+ .. Curses_Constants.TRACE_TIMES_Last;
+ Tputs at 0 range Curses_Constants.TRACE_TPUTS_First
+ .. Curses_Constants.TRACE_TPUTS_Last;
+ Update at 0 range Curses_Constants.TRACE_UPDATE_First
+ .. Curses_Constants.TRACE_UPDATE_Last;
+ Cursor_Move at 0 range Curses_Constants.TRACE_MOVE_First
+ .. Curses_Constants.TRACE_MOVE_Last;
+ Character_Output at 0 range Curses_Constants.TRACE_CHARPUT_First
+ .. Curses_Constants.TRACE_CHARPUT_Last;
+ Calls at 0 range Curses_Constants.TRACE_CALLS_First
+ .. Curses_Constants.TRACE_CALLS_Last;
+ Virtual_Puts at 0 range Curses_Constants.TRACE_VIRTPUT_First
+ .. Curses_Constants.TRACE_VIRTPUT_Last;
+ Input_Events at 0 range Curses_Constants.TRACE_IEVENT_First
+ .. Curses_Constants.TRACE_IEVENT_Last;
+ TTY_State at 0 range Curses_Constants.TRACE_BITS_First
+ .. Curses_Constants.TRACE_BITS_Last;
+ Internal_Calls at 0 range Curses_Constants.TRACE_ICALLS_First
+ .. Curses_Constants.TRACE_ICALLS_Last;
+ Character_Calls at 0 range Curses_Constants.TRACE_CCALLS_First
+ .. Curses_Constants.TRACE_CCALLS_Last;
+ Termcap_TermInfo at 0 range Curses_Constants.TRACE_DATABASE_First
+ .. Curses_Constants.TRACE_DATABASE_Last;
+ Attribute_Color at 0 range Curses_Constants.TRACE_ATTRS_First
+ .. Curses_Constants.TRACE_ATTRS_Last;
+ end record;
+ pragma Warnings (Off);
+ for Trace_Attribute_Set'Size use Curses_Constants.Trace_Size;
pragma Warnings (On);
Trace_Disable : constant Trace_Attribute_Set := (others => False);
diff --git a/Ada95/gen/terminal_interface-curses.adb.m4 b/Ada95/gen/terminal_interface-curses.adb.m4
index 1f89a5a35233..1c55ed2589e9 100644
--- a/Ada95/gen/terminal_interface-curses.adb.m4
+++ b/Ada95/gen/terminal_interface-curses.adb.m4
@@ -9,7 +9,7 @@ include(M4MACRO)----------------------------------------------------------------
-- B O D Y --
-- --
------------------------------------------------------------------------------
--- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2014,2018 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 --
@@ -37,8 +37,8 @@ include(M4MACRO)----------------------------------------------------------------
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
--- $Revision: 1.8 $
--- $Date: 2011/03/22 23:02:14 $
+-- $Revision: 1.15 $
+-- $Date: 2018/07/07 23:28:45 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with System;
@@ -52,7 +52,6 @@ with Ada.Strings.Fixed;
package body Terminal_Interface.Curses is
use Aux;
- use type System.Bit_Order;
package ASF renames Ada.Strings.Fixed;
@@ -151,10 +150,10 @@ package body Terminal_Interface.Curses is
Ch : Attributed_Character)
is
function Waddch (W : Window;
- Ch : C_Chtype) return C_Int;
+ Ch : Attributed_Character) return C_Int;
pragma Import (C, Waddch, "waddch");
begin
- if Waddch (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then
+ if Waddch (Win, Ch) = Curses_Err then
raise Curses_Exception;
end if;
end Add;
@@ -178,12 +177,13 @@ package body Terminal_Interface.Curses is
function mvwaddch (W : Window;
Y : C_Int;
X : C_Int;
- Ch : C_Chtype) return C_Int;
+ Ch : Attributed_Character) return C_Int;
pragma Import (C, mvwaddch, "mvwaddch");
begin
if mvwaddch (Win, C_Int (Line),
C_Int (Column),
- AttrChar_To_Chtype (Ch)) = Curses_Err then
+ Ch) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Add;
@@ -208,10 +208,10 @@ package body Terminal_Interface.Curses is
Ch : Attributed_Character)
is
function Wechochar (W : Window;
- Ch : C_Chtype) return C_Int;
+ Ch : Attributed_Character) return C_Int;
pragma Import (C, Wechochar, "wechochar");
begin
- if Wechochar (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then
+ if Wechochar (Win, Ch) = Curses_Err then
raise Curses_Exception;
end if;
end Add_With_Immediate_Echo;
@@ -419,7 +419,8 @@ package body Terminal_Interface.Curses is
Txt (Str'Length) := Default_Character;
if Waddchnstr (Win,
Txt,
- C_Int (Len)) = Curses_Err then
+ C_Int (Len)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Add;
@@ -448,26 +449,25 @@ package body Terminal_Interface.Curses is
Lower_Right_Corner_Symbol : Attributed_Character := Default_Character)
is
function Wborder (W : Window;
- LS : C_Chtype;
- RS : C_Chtype;
- TS : C_Chtype;
- BS : C_Chtype;
- ULC : C_Chtype;
- URC : C_Chtype;
- LLC : C_Chtype;
- LRC : C_Chtype) return C_Int;
+ LS : Attributed_Character;
+ RS : Attributed_Character;
+ TS : Attributed_Character;
+ BS : Attributed_Character;
+ ULC : Attributed_Character;
+ URC : Attributed_Character;
+ LLC : Attributed_Character;
+ LRC : Attributed_Character) return C_Int;
pragma Import (C, Wborder, "wborder");
begin
if Wborder (Win,
- AttrChar_To_Chtype (Left_Side_Symbol),
- AttrChar_To_Chtype (Right_Side_Symbol),
- AttrChar_To_Chtype (Top_Side_Symbol),
- AttrChar_To_Chtype (Bottom_Side_Symbol),
- AttrChar_To_Chtype (Upper_Left_Corner_Symbol),
- AttrChar_To_Chtype (Upper_Right_Corner_Symbol),
- AttrChar_To_Chtype (Lower_Left_Corner_Symbol),
- AttrChar_To_Chtype (Lower_Right_Corner_Symbol)
- ) = Curses_Err
+ Left_Side_Symbol,
+ Right_Side_Symbol,
+ Top_Side_Symbol,
+ Bottom_Side_Symbol,
+ Upper_Left_Corner_Symbol,
+ Upper_Right_Corner_Symbol,
+ Lower_Left_Corner_Symbol,
+ Lower_Right_Corner_Symbol) = Curses_Err
then
raise Curses_Exception;
end if;
@@ -490,13 +490,14 @@ package body Terminal_Interface.Curses is
Line_Symbol : Attributed_Character := Default_Character)
is
function Whline (W : Window;
- Ch : C_Chtype;
+ Ch : Attributed_Character;
Len : C_Int) return C_Int;
pragma Import (C, Whline, "whline");
begin
if Whline (Win,
- AttrChar_To_Chtype (Line_Symbol),
- C_Int (Line_Size)) = Curses_Err then
+ Line_Symbol,
+ C_Int (Line_Size)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Horizontal_Line;
@@ -507,13 +508,14 @@ package body Terminal_Interface.Curses is
Line_Symbol : Attributed_Character := Default_Character)
is
function Wvline (W : Window;
- Ch : C_Chtype;
+ Ch : Attributed_Character;
Len : C_Int) return C_Int;
pragma Import (C, Wvline, "wvline");
begin
if Wvline (Win,
- AttrChar_To_Chtype (Line_Symbol),
- C_Int (Line_Size)) = Curses_Err then
+ Line_Symbol,
+ C_Int (Line_Size)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Vertical_Line;
@@ -611,10 +613,10 @@ package body Terminal_Interface.Curses is
On : Boolean := True)
is
function Wattron (Win : Window;
- C_Attr : C_AttrType) return C_Int;
+ C_Attr : Attributed_Character) return C_Int;
pragma Import (C, Wattron, "wattr_on");
function Wattroff (Win : Window;
- C_Attr : C_AttrType) return C_Int;
+ C_Attr : Attributed_Character) return C_Int;
pragma Import (C, Wattroff, "wattr_off");
-- In Ada we use the On Boolean to control whether or not we want to
-- switch on or off the attributes in the set.
@@ -624,9 +626,9 @@ package body Terminal_Interface.Curses is
Attr => Attr);
begin
if On then
- Err := Wattron (Win, AttrChar_To_AttrType (AC));
+ Err := Wattron (Win, AC);
else
- Err := Wattroff (Win, AttrChar_To_AttrType (AC));
+ Err := Wattroff (Win, AC);
end if;
if Err = Curses_Err then
raise Curses_Exception;
@@ -639,14 +641,13 @@ package body Terminal_Interface.Curses is
Color : Color_Pair := Color_Pair'First)
is
function Wattrset (Win : Window;
- C_Attr : C_AttrType) return C_Int;
+ C_Attr : Attributed_Character) return C_Int;
pragma Import (C, Wattrset, "wattrset"); -- ??? wattr_set
begin
- if Wattrset (Win,
- AttrChar_To_AttrType (Attributed_Character'
- (Ch => Character'First,
- Color => Color,
- Attr => Attr))) = Curses_Err then
+ if Wattrset (Win, (Ch => Character'First,
+ Color => Color,
+ Attr => Attr)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Set_Character_Attributes;
@@ -655,20 +656,18 @@ package body Terminal_Interface.Curses is
return Character_Attribute_Set
is
function Wattrget (Win : Window;
- Atr : access C_AttrType;
+ Atr : access Attributed_Character;
Col : access C_Short;
Opt : System.Address) return C_Int;
pragma Import (C, Wattrget, "wattr_get");
- Attr : aliased C_AttrType;
+ Attr : aliased Attributed_Character;
Col : aliased C_Short;
Res : constant C_Int := Wattrget (Win, Attr'Access, Col'Access,
System.Null_Address);
- Ch : Attributed_Character;
begin
if Res = Curses_Ok then
- Ch := AttrType_To_AttrChar (Attr);
- return Ch.Attr;
+ return Attr.Attr;
else
raise Curses_Exception;
end if;
@@ -678,20 +677,18 @@ package body Terminal_Interface.Curses is
return Color_Pair
is
function Wattrget (Win : Window;
- Atr : access C_AttrType;
+ Atr : access Attributed_Character;
Col : access C_Short;
Opt : System.Address) return C_Int;
pragma Import (C, Wattrget, "wattr_get");
- Attr : aliased C_AttrType;
+ Attr : aliased Attributed_Character;
Col : aliased C_Short;
Res : constant C_Int := Wattrget (Win, Attr'Access, Col'Access,
System.Null_Address);
- Ch : Attributed_Character;
begin
if Res = Curses_Ok then
- Ch := AttrType_To_AttrChar (Attr);
- return Ch.Color;
+ return Attr.Color;
else
raise Curses_Exception;
end if;
@@ -707,7 +704,8 @@ package body Terminal_Interface.Curses is
begin
if Wset_Color (Win,
C_Short (Pair),
- C_Void_Ptr (System.Null_Address)) = Curses_Err then
+ C_Void_Ptr (System.Null_Address)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Set_Color;
@@ -720,17 +718,19 @@ package body Terminal_Interface.Curses is
is
function Wchgat (Win : Window;
Cnt : C_Int;
- Attr : C_AttrType;
+ Attr : Attributed_Character;
Color : C_Short;
Opts : System.Address := System.Null_Address)
return C_Int;
pragma Import (C, Wchgat, "wchgat");
-
- Ch : constant Attributed_Character :=
- (Ch => Character'First, Color => Color_Pair'First, Attr => Attr);
begin
- if Wchgat (Win, C_Int (Count), AttrChar_To_AttrType (Ch),
- C_Short (Color)) = Curses_Err then
+ if Wchgat (Win,
+ C_Int (Count),
+ (Ch => Character'First,
+ Color => Color_Pair'First,
+ Attr => Attr),
+ C_Short (Color)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Change_Attributes;
@@ -938,7 +938,8 @@ package body Terminal_Interface.Curses is
pragma Import (C, Notimeout, "notimeout");
begin
if Notimeout (Win, Curses_Bool (Boolean'Pos (Timer_Off)))
- = Curses_Err then
+ = Curses_Err
+ then
raise Curses_Exception;
end if;
end Set_Escape_Timer_Mode;
@@ -1051,7 +1052,8 @@ package body Terminal_Interface.Curses is
pragma Import (C, Wsetscrreg, "wsetscrreg");
begin
if Wsetscrreg (Win, C_Int (Top_Line), C_Int (Bottom_Line))
- = Curses_Err then
+ = Curses_Err
+ then
raise Curses_Exception;
end if;
end Set_Scroll_Region;
@@ -1108,7 +1110,8 @@ package body Terminal_Interface.Curses is
begin
if Wredrawln (Win,
C_Int (Begin_Line),
- C_Int (Line_Count)) = Curses_Err then
+ C_Int (Line_Count)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Redraw;
@@ -1158,20 +1161,21 @@ package body Terminal_Interface.Curses is
(Win : Window := Standard_Window;
Ch : Attributed_Character)
is
- procedure WBackground (W : Window; Ch : C_Chtype);
+ procedure WBackground (W : Window; Ch : Attributed_Character);
pragma Import (C, WBackground, "wbkgdset");
begin
- WBackground (Win, AttrChar_To_Chtype (Ch));
+ WBackground (Win, Ch);
end Set_Background;
procedure Change_Background
(Win : Window := Standard_Window;
Ch : Attributed_Character)
is
- function WChangeBkgd (W : Window; Ch : C_Chtype) return C_Int;
+ function WChangeBkgd (W : Window; Ch : Attributed_Character)
+ return C_Int;
pragma Import (C, WChangeBkgd, "wbkgd");
begin
- if WChangeBkgd (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then
+ if WChangeBkgd (Win, Ch) = Curses_Err then
raise Curses_Exception;
end if;
end Change_Background;
@@ -1179,10 +1183,10 @@ package body Terminal_Interface.Curses is
function Get_Background (Win : Window := Standard_Window)
return Attributed_Character
is
- function Wgetbkgd (Win : Window) return C_Chtype;
+ function Wgetbkgd (Win : Window) return Attributed_Character;
pragma Import (C, Wgetbkgd, "getbkgd");
begin
- return Chtype_To_AttrChar (Wgetbkgd (Win));
+ return Wgetbkgd (Win);
end Get_Background;
------------------------------------------------------------------------------
procedure Change_Lines_Status (Win : Window := Standard_Window;
@@ -1197,7 +1201,8 @@ package body Terminal_Interface.Curses is
pragma Import (C, Wtouchln, "wtouchln");
begin
if Wtouchln (Win, C_Int (Start), C_Int (Count),
- C_Int (Boolean'Pos (State))) = Curses_Err then
+ C_Int (Boolean'Pos (State))) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Change_Lines_Status;
@@ -1208,7 +1213,7 @@ package body Terminal_Interface.Curses is
X : Column_Position;
begin
Get_Size (Win, Y, X);
- pragma Unreferenced (X);
+ pragma Warnings (Off, X); -- unreferenced
Change_Lines_Status (Win, 0, Positive (Y), True);
end Touch;
@@ -1218,7 +1223,7 @@ package body Terminal_Interface.Curses is
X : Column_Position;
begin
Get_Size (Win, Y, X);
- pragma Unreferenced (X);
+ pragma Warnings (Off, X); -- unreferenced
Change_Lines_Status (Win, 0, Positive (Y), False);
end Untouch;
@@ -1288,7 +1293,8 @@ package body Terminal_Interface.Curses is
C_Int (Destination_Bottom_Row),
C_Int (Destination_Right_Column),
Boolean'Pos (Non_Destructive_Mode)
- ) = Curses_Err then
+ ) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Copy;
@@ -1491,7 +1497,8 @@ package body Terminal_Interface.Curses is
C_Int (Destination_Top_Row),
C_Int (Destination_Left_Column),
C_Int (Destination_Bottom_Row),
- C_Int (Destination_Right_Column)) = Curses_Err then
+ C_Int (Destination_Right_Column)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Refresh;
@@ -1521,7 +1528,8 @@ package body Terminal_Interface.Curses is
C_Int (Destination_Top_Row),
C_Int (Destination_Left_Column),
C_Int (Destination_Bottom_Row),
- C_Int (Destination_Right_Column)) = Curses_Err then
+ C_Int (Destination_Right_Column)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Refresh_Without_Update;
@@ -1530,11 +1538,11 @@ package body Terminal_Interface.Curses is
(Pad : Window;
Ch : Attributed_Character)
is
- function Pechochar (Pad : Window; Ch : C_Chtype)
+ function Pechochar (Pad : Window; Ch : Attributed_Character)
return C_Int;
pragma Import (C, Pechochar, "pechochar");
begin
- if Pechochar (Pad, AttrChar_To_Chtype (Ch)) = Curses_Err then
+ if Pechochar (Pad, Ch) = Curses_Err then
raise Curses_Exception;
end if;
end Add_Character_To_Pad_And_Echo_It;
@@ -1592,10 +1600,10 @@ package body Terminal_Interface.Curses is
function Peek (Win : Window := Standard_Window)
return Attributed_Character
is
- function Winch (Win : Window) return C_Chtype;
+ function Winch (Win : Window) return Attributed_Character;
pragma Import (C, Winch, "winch");
begin
- return Chtype_To_AttrChar (Winch (Win));
+ return Winch (Win);
end Peek;
function Peek
@@ -1605,19 +1613,19 @@ package body Terminal_Interface.Curses is
is
function Mvwinch (Win : Window;
Lin : C_Int;
- Col : C_Int) return C_Chtype;
+ Col : C_Int) return Attributed_Character;
pragma Import (C, Mvwinch, "mvwinch");
begin
- return Chtype_To_AttrChar (Mvwinch (Win, C_Int (Line), C_Int (Column)));
+ return Mvwinch (Win, C_Int (Line), C_Int (Column));
end Peek;
------------------------------------------------------------------------------
procedure Insert (Win : Window := Standard_Window;
Ch : Attributed_Character)
is
- function Winsch (Win : Window; Ch : C_Chtype) return C_Int;
+ function Winsch (Win : Window; Ch : Attributed_Character) return C_Int;
pragma Import (C, Winsch, "winsch");
begin
- if Winsch (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then
+ if Winsch (Win, Ch) = Curses_Err then
raise Curses_Exception;
end if;
end Insert;
@@ -1631,13 +1639,14 @@ package body Terminal_Interface.Curses is
function Mvwinsch (Win : Window;
Lin : C_Int;
Col : C_Int;
- Ch : C_Chtype) return C_Int;
+ Ch : Attributed_Character) return C_Int;
pragma Import (C, Mvwinsch, "mvwinsch");
begin
if Mvwinsch (Win,
C_Int (Line),
C_Int (Column),
- AttrChar_To_Chtype (Ch)) = Curses_Err then
+ Ch) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Insert;
@@ -1679,7 +1688,8 @@ package body Terminal_Interface.Curses is
begin
To_C (Str, Txt, Length);
if Mvwinsnstr (Win, C_Int (Line), C_Int (Column), Txt, C_Int (Len))
- = Curses_Err then
+ = Curses_Err
+ then
raise Curses_Exception;
end if;
end Insert;
@@ -1840,7 +1850,8 @@ package body Terminal_Interface.Curses is
begin
To_C (Text, Txt, Len);
if Slk_Set (C_Int (Label), Txt,
- C_Int (Label_Justification'Pos (Fmt))) = Curses_Err then
+ C_Int (Label_Justification'Pos (Fmt))) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Set_Soft_Label_Key;
@@ -1916,9 +1927,9 @@ package body Terminal_Interface.Curses is
(Attr : Character_Attribute_Set;
On : Boolean := True)
is
- function Slk_Attron (Ch : C_Chtype) return C_Int;
+ function Slk_Attron (Ch : Attributed_Character) return C_Int;
pragma Import (C, Slk_Attron, "slk_attron");
- function Slk_Attroff (Ch : C_Chtype) return C_Int;
+ function Slk_Attroff (Ch : Attributed_Character) return C_Int;
pragma Import (C, Slk_Attroff, "slk_attroff");
Err : C_Int;
@@ -1927,9 +1938,9 @@ package body Terminal_Interface.Curses is
Color => Color_Pair'First);
begin
if On then
- Err := Slk_Attron (AttrChar_To_Chtype (Ch));
+ Err := Slk_Attron (Ch);
else
- Err := Slk_Attroff (AttrChar_To_Chtype (Ch));
+ Err := Slk_Attroff (Ch);
end if;
if Err = Curses_Err then
raise Curses_Exception;
@@ -1940,36 +1951,36 @@ package body Terminal_Interface.Curses is
(Attr : Character_Attribute_Set := Normal_Video;
Color : Color_Pair := Color_Pair'First)
is
- function Slk_Attrset (Ch : C_Chtype) return C_Int;
+ function Slk_Attrset (Ch : Attributed_Character) return C_Int;
pragma Import (C, Slk_Attrset, "slk_attrset");
Ch : constant Attributed_Character := (Ch => Character'First,
Attr => Attr,
Color => Color);
begin
- if Slk_Attrset (AttrChar_To_Chtype (Ch)) = Curses_Err then
+ if Slk_Attrset (Ch) = Curses_Err then
raise Curses_Exception;
end if;
end Set_Soft_Label_Key_Attributes;
function Get_Soft_Label_Key_Attributes return Character_Attribute_Set
is
- function Slk_Attr return C_Chtype;
+ function Slk_Attr return Attributed_Character;
pragma Import (C, Slk_Attr, "slk_attr");
- Attr : constant C_Chtype := Slk_Attr;
+ Attr : constant Attributed_Character := Slk_Attr;
begin
- return Chtype_To_AttrChar (Attr).Attr;
+ return Attr.Attr;
end Get_Soft_Label_Key_Attributes;
function Get_Soft_Label_Key_Attributes return Color_Pair
is
- function Slk_Attr return C_Chtype;
+ function Slk_Attr return Attributed_Character;
pragma Import (C, Slk_Attr, "slk_attr");
- Attr : constant C_Chtype := Slk_Attr;
+ Attr : constant Attributed_Character := Slk_Attr;
begin
- return Chtype_To_AttrChar (Attr).Color;
+ return Attr.Color;
end Get_Soft_Label_Key_Attributes;
procedure Set_Soft_Label_Key_Color (Pair : Color_Pair)
@@ -1991,7 +2002,8 @@ package body Terminal_Interface.Curses is
pragma Import (C, Keyok, "keyok");
begin
if Keyok (C_Int (Key), Curses_Bool (Boolean'Pos (Enable)))
- = Curses_Err then
+ = Curses_Err
+ then
raise Curses_Exception;
end if;
end Enable_Key;
@@ -2015,18 +2027,18 @@ package body Terminal_Interface.Curses is
procedure Un_Control (Ch : Attributed_Character;
Str : out String)
is
- function Unctrl (Ch : C_Chtype) return chars_ptr;
+ function Unctrl (Ch : Attributed_Character) return chars_ptr;
pragma Import (C, Unctrl, "unctrl");
begin
- Fill_String (Unctrl (AttrChar_To_Chtype (Ch)), Str);
+ Fill_String (Unctrl (Ch), Str);
end Un_Control;
function Un_Control (Ch : Attributed_Character) return String
is
- function Unctrl (Ch : C_Chtype) return chars_ptr;
+ function Unctrl (Ch : Attributed_Character) return chars_ptr;
pragma Import (C, Unctrl, "unctrl");
begin
- return Fill_String (Unctrl (AttrChar_To_Chtype (Ch)));
+ return Fill_String (Unctrl (Ch));
end Un_Control;
procedure Delay_Output (Msecs : Natural)
@@ -2099,10 +2111,10 @@ package body Terminal_Interface.Curses is
function Supported_Attributes return Character_Attribute_Set
is
- function Termattrs return C_Chtype;
+ function Termattrs return Attributed_Character;
pragma Import (C, Termattrs, "termattrs");
- Ch : constant Attributed_Character := Chtype_To_AttrChar (Termattrs);
+ Ch : constant Attributed_Character := Termattrs;
begin
return Ch.Attr;
end Supported_Attributes;
@@ -2152,11 +2164,13 @@ package body Terminal_Interface.Curses is
raise Constraint_Error;
end if;
if Integer (Fore) >= Number_Of_Colors or else
- Integer (Back) >= Number_Of_Colors then
+ Integer (Back) >= Number_Of_Colors
+ then
raise Constraint_Error;
end if;
if Initpair (C_Short (Pair), C_Short (Fore), C_Short (Back))
- = Curses_Err then
+ = Curses_Err
+ then
raise Curses_Exception;
end if;
end Init_Pair;
@@ -2205,7 +2219,8 @@ package body Terminal_Interface.Curses is
pragma Import (C, Initcolor, "init_color");
begin
if Initcolor (C_Short (Color), C_Short (Red), C_Short (Green),
- C_Short (Blue)) = Curses_Err then
+ C_Short (Blue)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Init_Color;
@@ -2236,7 +2251,8 @@ package body Terminal_Interface.Curses is
R, G, B : aliased C_Short;
begin
if Colorcontent (C_Short (Color), R'Access, G'Access, B'Access) =
- Curses_Err then
+ Curses_Err
+ then
raise Curses_Exception;
else
Red := RGB_Value (R);
@@ -2337,7 +2353,46 @@ package body Terminal_Interface.Curses is
end if;
end Nap_Milli_Seconds;
------------------------------------------------------------------------------
-include(`Public_Variables')
+ function Lines return Line_Count
+ is
+ function LINES_As_Function return Interfaces.C.int;
+ pragma Import (C, LINES_As_Function, "LINES_as_function");
+ begin
+ return Line_Count (LINES_As_Function);
+ end Lines;
+
+ function Columns return Column_Count
+ is
+ function COLS_As_Function return Interfaces.C.int;
+ pragma Import (C, COLS_As_Function, "COLS_as_function");
+ begin
+ return Column_Count (COLS_As_Function);
+ end Columns;
+
+ function Tab_Size return Natural
+ is
+ function TABSIZE_As_Function return Interfaces.C.int;
+ pragma Import (C, TABSIZE_As_Function, "TABSIZE_as_function");
+
+ begin
+ return Natural (TABSIZE_As_Function);
+ end Tab_Size;
+
+ function Number_Of_Colors return Natural
+ is
+ function COLORS_As_Function return Interfaces.C.int;
+ pragma Import (C, COLORS_As_Function, "COLORS_as_function");
+ begin
+ return Natural (COLORS_As_Function);
+ end Number_Of_Colors;
+
+ function Number_Of_Color_Pairs return Natural
+ is
+ function COLOR_PAIRS_As_Function return Interfaces.C.int;
+ pragma Import (C, COLOR_PAIRS_As_Function, "COLOR_PAIRS_as_function");
+ begin
+ return Natural (COLOR_PAIRS_As_Function);
+ end Number_Of_Color_Pairs;
------------------------------------------------------------------------------
procedure Transform_Coordinates
(W : Window := Standard_Window;
@@ -2493,7 +2548,8 @@ include(`Public_Variables')
begin
if wresize (Win,
C_Int (Number_Of_Lines),
- C_Int (Number_Of_Columns)) = Curses_Err then
+ C_Int (Number_Of_Columns)) = Curses_Err
+ then
raise Curses_Exception;
end if;
end Resize;
diff --git a/Ada95/gen/terminal_interface-curses.ads.m4 b/Ada95/gen/terminal_interface-curses.ads.m4
index 28cc9d198779..25bb5d9b5f4c 100644
--- a/Ada95/gen/terminal_interface-curses.ads.m4
+++ b/Ada95/gen/terminal_interface-curses.ads.m4
@@ -9,7 +9,7 @@ include(M4MACRO)----------------------------------------------------------------
-- S P E C --
-- --
------------------------------------------------------------------------------
--- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2011,2014 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 --
@@ -37,18 +37,23 @@ include(M4MACRO)----------------------------------------------------------------
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
--- $Revision: 1.44 $
--- $Date: 2011/03/19 23:05:56 $
+-- $Revision: 1.47 $
+-- $Date: 2014/05/24 21:31:57 $
-- Binding Version 01.00
------------------------------------------------------------------------------
-include(`Base_Defs')
with System.Storage_Elements;
with Interfaces.C; -- We need this for some assertions.
+with Terminal_Interface.Curses_Constants;
+
package Terminal_Interface.Curses is
pragma Preelaborate (Terminal_Interface.Curses);
-include(`Linker_Options')
-include(`Version_Info')
+ pragma Linker_Options ("-lncurses" & Curses_Constants.DFT_ARG_SUFFIX);
+
+ Major_Version : constant := Curses_Constants.NCURSES_VERSION_MAJOR;
+ Minor_Version : constant := Curses_Constants.NCURSES_VERSION_MINOR;
+ NC_Version : String renames Curses_Constants.Version;
+
type Window is private;
Null_Window : constant Window;
@@ -65,24 +70,315 @@ include(`Version_Info')
-- request codes.
-- FIXME: The "-1" should be Curses_Err
- subtype Real_Key_Code is Key_Code range -1 .. M4_KEY_MAX;
+ subtype Real_Key_Code is Key_Code range -1 .. Curses_Constants.KEY_MAX;
-- This are the codes that potentially represent a real keystroke.
-- Not all codes may be possible on a specific terminal. To check the
-- availability of a special key, the Has_Key function is provided.
subtype Special_Key_Code is Real_Key_Code
- range M4_SPECIAL_FIRST .. Real_Key_Code'Last;
+ range Curses_Constants. KEY_MIN - 1 .. Real_Key_Code'Last;
-- Type for a function- or special key number
subtype Normal_Key_Code is Real_Key_Code range
Character'Pos (Character'First) .. Character'Pos (Character'Last);
-- This are the codes for regular (incl. non-graphical) characters.
+ -- For those who like to use the original key names we produce them were
+ -- they differ from the original.
+
-- Constants for function- and special keys
- --
- Key_None : constant Special_Key_Code := M4_SPECIAL_FIRST;
-include(`Key_Definitions')
- Key_Max : constant Special_Key_Code
+ Key_None : constant Special_Key_Code
+ := Curses_Constants.KEY_MIN - 1;
+ Key_Min : constant Special_Key_Code
+ := Curses_Constants.KEY_MIN;
+ Key_Break : constant Special_Key_Code
+ := Curses_Constants.KEY_BREAK;
+ KEY_DOWN : constant Special_Key_Code
+ := Curses_Constants.KEY_DOWN;
+ Key_Cursor_Down : Special_Key_Code renames KEY_DOWN;
+ KEY_UP : constant Special_Key_Code
+ := Curses_Constants.KEY_UP;
+ Key_Cursor_Up : Special_Key_Code renames KEY_UP;
+ KEY_LEFT : constant Special_Key_Code
+ := Curses_Constants.KEY_LEFT;
+ Key_Cursor_Left : Special_Key_Code renames KEY_LEFT;
+ KEY_RIGHT : constant Special_Key_Code
+ := Curses_Constants.KEY_RIGHT;
+ Key_Cursor_Right : Special_Key_Code renames KEY_RIGHT;
+ Key_Home : constant Special_Key_Code
+ := Curses_Constants.KEY_HOME;
+ Key_Backspace : constant Special_Key_Code
+ := Curses_Constants.KEY_BACKSPACE;
+ Key_F0 : constant Special_Key_Code
+ := Curses_Constants.KEY_F0;
+ Key_F1 : constant Special_Key_Code
+ := Curses_Constants.KEY_F1;
+ Key_F2 : constant Special_Key_Code
+ := Curses_Constants.KEY_F2;
+ Key_F3 : constant Special_Key_Code
+ := Curses_Constants.KEY_F3;
+ Key_F4 : constant Special_Key_Code
+ := Curses_Constants.KEY_F4;
+ Key_F5 : constant Special_Key_Code
+ := Curses_Constants.KEY_F5;
+ Key_F6 : constant Special_Key_Code
+ := Curses_Constants.KEY_F6;
+ Key_F7 : constant Special_Key_Code
+ := Curses_Constants.KEY_F7;
+ Key_F8 : constant Special_Key_Code
+ := Curses_Constants.KEY_F8;
+ Key_F9 : constant Special_Key_Code
+ := Curses_Constants.KEY_F9;
+ Key_F10 : constant Special_Key_Code
+ := Curses_Constants.KEY_F10;
+ Key_F11 : constant Special_Key_Code
+ := Curses_Constants.KEY_F11;
+ Key_F12 : constant Special_Key_Code
+ := Curses_Constants.KEY_F12;
+ Key_F13 : constant Special_Key_Code
+ := Curses_Constants.KEY_F13;
+ Key_F14 : constant Special_Key_Code
+ := Curses_Constants.KEY_F14;
+ Key_F15 : constant Special_Key_Code
+ := Curses_Constants.KEY_F15;
+ Key_F16 : constant Special_Key_Code
+ := Curses_Constants.KEY_F16;
+ Key_F17 : constant Special_Key_Code
+ := Curses_Constants.KEY_F17;
+ Key_F18 : constant Special_Key_Code
+ := Curses_Constants.KEY_F18;
+ Key_F19 : constant Special_Key_Code
+ := Curses_Constants.KEY_F19;
+ Key_F20 : constant Special_Key_Code
+ := Curses_Constants.KEY_F20;
+ Key_F21 : constant Special_Key_Code
+ := Curses_Constants.KEY_F21;
+ Key_F22 : constant Special_Key_Code
+ := Curses_Constants.KEY_F22;
+ Key_F23 : constant Special_Key_Code
+ := Curses_Constants.KEY_F23;
+ Key_F24 : constant Special_Key_Code
+ := Curses_Constants.KEY_F24;
+ KEY_DL : constant Special_Key_Code
+ := Curses_Constants.KEY_DL;
+ Key_Delete_Line : Special_Key_Code renames KEY_DL;
+ KEY_IL : constant Special_Key_Code
+ := Curses_Constants.KEY_IL;
+ Key_Insert_Line : Special_Key_Code renames KEY_IL;
+ KEY_DC : constant Special_Key_Code
+ := Curses_Constants.KEY_DC;
+ Key_Delete_Char : Special_Key_Code renames KEY_DC;
+ KEY_IC : constant Special_Key_Code
+ := Curses_Constants.KEY_IC;
+ Key_Insert_Char : Special_Key_Code renames KEY_IC;
+ KEY_EIC : constant Special_Key_Code
+ := Curses_Constants.KEY_EIC;
+ Key_Exit_Insert_Mode : Special_Key_Code renames KEY_EIC;
+ KEY_CLEAR : constant Special_Key_Code
+ := Curses_Constants.KEY_CLEAR;
+ Key_Clear_Screen : Special_Key_Code renames KEY_CLEAR;
+ KEY_EOS : constant Special_Key_Code
+ := Curses_Constants.KEY_EOS;
+ Key_Clear_End_Of_Screen : Special_Key_Code renames KEY_EOS;
+ KEY_EOL : constant Special_Key_Code
+ := Curses_Constants.KEY_EOL;
+ Key_Clear_End_Of_Line : Special_Key_Code renames KEY_EOL;
+ KEY_SF : constant Special_Key_Code
+ := Curses_Constants.KEY_SF;
+ Key_Scroll_1_Forward : Special_Key_Code renames KEY_SF;
+ KEY_SR : constant Special_Key_Code
+ := Curses_Constants.KEY_SR;
+ Key_Scroll_1_Backward : Special_Key_Code renames KEY_SR;
+ KEY_NPAGE : constant Special_Key_Code
+ := Curses_Constants.KEY_NPAGE;
+ Key_Next_Page : Special_Key_Code renames KEY_NPAGE;
+ KEY_PPAGE : constant Special_Key_Code
+ := Curses_Constants.KEY_PPAGE;
+ Key_Previous_Page : Special_Key_Code renames KEY_PPAGE;
+ KEY_STAB : constant Special_Key_Code
+ := Curses_Constants.KEY_STAB;
+ Key_Set_Tab : Special_Key_Code renames KEY_STAB;
+ KEY_CTAB : constant Special_Key_Code
+ := Curses_Constants.KEY_CTAB;
+ Key_Clear_Tab : Special_Key_Code renames KEY_CTAB;
+ KEY_CATAB : constant Special_Key_Code
+ := Curses_Constants.KEY_CATAB;
+ Key_Clear_All_Tabs : Special_Key_Code renames KEY_CATAB;
+ KEY_ENTER : constant Special_Key_Code
+ := Curses_Constants.KEY_ENTER;
+ Key_Enter_Or_Send : Special_Key_Code renames KEY_ENTER;
+ KEY_SRESET : constant Special_Key_Code
+ := Curses_Constants.KEY_SRESET;
+ Key_Soft_Reset : Special_Key_Code renames KEY_SRESET;
+ Key_Reset : constant Special_Key_Code
+ := Curses_Constants.KEY_RESET;
+ Key_Print : constant Special_Key_Code
+ := Curses_Constants.KEY_PRINT;
+ KEY_LL : constant Special_Key_Code
+ := Curses_Constants.KEY_LL;
+ Key_Bottom : Special_Key_Code renames KEY_LL;
+ KEY_A1 : constant Special_Key_Code
+ := Curses_Constants.KEY_A1;
+ Key_Upper_Left_Of_Keypad : Special_Key_Code renames KEY_A1;
+ KEY_A3 : constant Special_Key_Code
+ := Curses_Constants.KEY_A3;
+ Key_Upper_Right_Of_Keypad : Special_Key_Code renames KEY_A3;
+ KEY_B2 : constant Special_Key_Code
+ := Curses_Constants.KEY_B2;
+ Key_Center_Of_Keypad : Special_Key_Code renames KEY_B2;
+ KEY_C1 : constant Special_Key_Code
+ := Curses_Constants.KEY_C1;
+ Key_Lower_Left_Of_Keypad : Special_Key_Code renames KEY_C1;
+ KEY_C3 : constant Special_Key_Code
+ := Curses_Constants.KEY_C3;
+ Key_Lower_Right_Of_Keypad : Special_Key_Code renames KEY_C3;
+ KEY_BTAB : constant Special_Key_Code
+ := Curses_Constants.KEY_BTAB;
+ Key_Back_Tab : Special_Key_Code renames KEY_BTAB;
+ KEY_BEG : constant Special_Key_Code
+ := Curses_Constants.KEY_BEG;
+ Key_Beginning : Special_Key_Code renames KEY_BEG;
+ Key_Cancel : constant Special_Key_Code
+ := Curses_Constants.KEY_CANCEL;
+ Key_Close : constant Special_Key_Code
+ := Curses_Constants.KEY_CLOSE;
+ Key_Command : constant Special_Key_Code
+ := Curses_Constants.KEY_COMMAND;
+ Key_Copy : constant Special_Key_Code
+ := Curses_Constants.KEY_COPY;
+ Key_Create : constant Special_Key_Code
+ := Curses_Constants.KEY_CREATE;
+ Key_End : constant Special_Key_Code
+ := Curses_Constants.KEY_END;
+ Key_Exit : constant Special_Key_Code
+ := Curses_Constants.KEY_EXIT;
+ Key_Find : constant Special_Key_Code
+ := Curses_Constants.KEY_FIND;
+ Key_Help : constant Special_Key_Code
+ := Curses_Constants.KEY_HELP;
+ Key_Mark : constant Special_Key_Code
+ := Curses_Constants.KEY_MARK;
+ Key_Message : constant Special_Key_Code
+ := Curses_Constants.KEY_MESSAGE;
+ Key_Move : constant Special_Key_Code
+ := Curses_Constants.KEY_MOVE;
+ Key_Next : constant Special_Key_Code
+ := Curses_Constants.KEY_NEXT;
+ Key_Open : constant Special_Key_Code
+ := Curses_Constants.KEY_OPEN;
+ Key_Options : constant Special_Key_Code
+ := Curses_Constants.KEY_OPTIONS;
+ Key_Previous : constant Special_Key_Code
+ := Curses_Constants.KEY_PREVIOUS;
+ Key_Redo : constant Special_Key_Code
+ := Curses_Constants.KEY_REDO;
+ Key_Reference : constant Special_Key_Code
+ := Curses_Constants.KEY_REFERENCE;
+ Key_Refresh : constant Special_Key_Code
+ := Curses_Constants.KEY_REFRESH;
+ Key_Replace : constant Special_Key_Code
+ := Curses_Constants.KEY_REPLACE;
+ Key_Restart : constant Special_Key_Code
+ := Curses_Constants.KEY_RESTART;
+ Key_Resume : constant Special_Key_Code
+ := Curses_Constants.KEY_RESUME;
+ Key_Save : constant Special_Key_Code
+ := Curses_Constants.KEY_SAVE;
+ KEY_SBEG : constant Special_Key_Code
+ := Curses_Constants.KEY_SBEG;
+ Key_Shift_Begin : Special_Key_Code renames KEY_SBEG;
+ KEY_SCANCEL : constant Special_Key_Code
+ := Curses_Constants.KEY_SCANCEL;
+ Key_Shift_Cancel : Special_Key_Code renames KEY_SCANCEL;
+ KEY_SCOMMAND : constant Special_Key_Code
+ := Curses_Constants.KEY_SCOMMAND;
+ Key_Shift_Command : Special_Key_Code renames KEY_SCOMMAND;
+ KEY_SCOPY : constant Special_Key_Code
+ := Curses_Constants.KEY_SCOPY;
+ Key_Shift_Copy : Special_Key_Code renames KEY_SCOPY;
+ KEY_SCREATE : constant Special_Key_Code
+ := Curses_Constants.KEY_SCREATE;
+ Key_Shift_Create : Special_Key_Code renames KEY_SCREATE;
+ KEY_SDC : constant Special_Key_Code
+ := Curses_Constants.KEY_SDC;
+ Key_Shift_Delete_Char : Special_Key_Code renames KEY_SDC;
+ KEY_SDL : constant Special_Key_Code
+ := Curses_Constants.KEY_SDL;
+ Key_Shift_Delete_Line : Special_Key_Code renames KEY_SDL;
+ Key_Select : constant Special_Key_Code
+ := Curses_Constants.KEY_SELECT;
+ KEY_SEND : constant Special_Key_Code
+ := Curses_Constants.KEY_SEND;
+ Key_Shift_End : Special_Key_Code renames KEY_SEND;
+ KEY_SEOL : constant Special_Key_Code
+ := Curses_Constants.KEY_SEOL;
+ Key_Shift_Clear_End_Of_Line : Special_Key_Code renames KEY_SEOL;
+ KEY_SEXIT : constant Special_Key_Code
+ := Curses_Constants.KEY_SEXIT;
+ Key_Shift_Exit : Special_Key_Code renames KEY_SEXIT;
+ KEY_SFIND : constant Special_Key_Code
+ := Curses_Constants.KEY_SFIND;
+ Key_Shift_Find : Special_Key_Code renames KEY_SFIND;
+ KEY_SHELP : constant Special_Key_Code
+ := Curses_Constants.KEY_SHELP;
+ Key_Shift_Help : Special_Key_Code renames KEY_SHELP;
+ KEY_SHOME : constant Special_Key_Code
+ := Curses_Constants.KEY_SHOME;
+ Key_Shift_Home : Special_Key_Code renames KEY_SHOME;
+ KEY_SIC : constant Special_Key_Code
+ := Curses_Constants.KEY_SIC;
+ Key_Shift_Insert_Char : Special_Key_Code renames KEY_SIC;
+ KEY_SLEFT : constant Special_Key_Code
+ := Curses_Constants.KEY_SLEFT;
+ Key_Shift_Cursor_Left : Special_Key_Code renames KEY_SLEFT;
+ KEY_SMESSAGE : constant Special_Key_Code
+ := Curses_Constants.KEY_SMESSAGE;
+ Key_Shift_Message : Special_Key_Code renames KEY_SMESSAGE;
+ KEY_SMOVE : constant Special_Key_Code
+ := Curses_Constants.KEY_SMOVE;
+ Key_Shift_Move : Special_Key_Code renames KEY_SMOVE;
+ KEY_SNEXT : constant Special_Key_Code
+ := Curses_Constants.KEY_SNEXT;
+ Key_Shift_Next_Page : Special_Key_Code renames KEY_SNEXT;
+ KEY_SOPTIONS : constant Special_Key_Code
+ := Curses_Constants.KEY_SOPTIONS;
+ Key_Shift_Options : Special_Key_Code renames KEY_SOPTIONS;
+ KEY_SPREVIOUS : constant Special_Key_Code
+ := Curses_Constants.KEY_SPREVIOUS;
+ Key_Shift_Previous_Page : Special_Key_Code renames KEY_SPREVIOUS;
+ KEY_SPRINT : constant Special_Key_Code
+ := Curses_Constants.KEY_SPRINT;
+ Key_Shift_Print : Special_Key_Code renames KEY_SPRINT;
+ KEY_SREDO : constant Special_Key_Code
+ := Curses_Constants.KEY_SREDO;
+ Key_Shift_Redo : Special_Key_Code renames KEY_SREDO;
+ KEY_SREPLACE : constant Special_Key_Code
+ := Curses_Constants.KEY_SREPLACE;
+ Key_Shift_Replace : Special_Key_Code renames KEY_SREPLACE;
+ KEY_SRIGHT : constant Special_Key_Code
+ := Curses_Constants.KEY_SRIGHT;
+ Key_Shift_Cursor_Right : Special_Key_Code renames KEY_SRIGHT;
+ KEY_SRSUME : constant Special_Key_Code
+ := Curses_Constants.KEY_SRSUME;
+ Key_Shift_Resume : Special_Key_Code renames KEY_SRSUME;
+ KEY_SSAVE : constant Special_Key_Code
+ := Curses_Constants.KEY_SSAVE;
+ Key_Shift_Save : Special_Key_Code renames KEY_SSAVE;
+ KEY_SSUSPEND : constant Special_Key_Code
+ := Curses_Constants.KEY_SSUSPEND;
+ Key_Shift_Suspend : Special_Key_Code renames KEY_SSUSPEND;
+ KEY_SUNDO : constant Special_Key_Code
+ := Curses_Constants.KEY_SUNDO;
+ Key_Shift_Undo : Special_Key_Code renames KEY_SUNDO;
+ Key_Suspend : constant Special_Key_Code
+ := Curses_Constants.KEY_SUSPEND;
+ Key_Undo : constant Special_Key_Code
+ := Curses_Constants.KEY_UNDO;
+ Key_Mouse : constant Special_Key_Code
+ := Curses_Constants.KEY_MOUSE;
+ Key_Resize : constant Special_Key_Code
+ := Curses_Constants.KEY_RESIZE;
+ Key_Max : constant Special_Key_Code
:= Special_Key_Code'Last;
subtype User_Key_Code is Key_Code
@@ -90,12 +386,7 @@ include(`Key_Definitions')
-- This is reserved for user defined key codes. The range between Key_Max
-- and the first user code is reserved for subsystems like menu and forms.
- -- For those who like to use the original key names we produce them were
- -- they differ from the original. Please note that they may differ in
- -- lower/upper case.
-include(`Old_Keys')dnl
-
-------------------------------------------------------------------------------
+ --------------------------------------------------------------------------
type Color_Number is range -1 .. Integer (Interfaces.C.short'Last);
for Color_Number'Size use Interfaces.C.short'Size;
@@ -104,7 +395,15 @@ include(`Old_Keys')dnl
-- (potentially) definable colors. Some of those indices are
-- predefined (see below), although they may not really exist.
-include(`Color_Defs')
+ Black : constant Color_Number := Curses_Constants.COLOR_BLACK;
+ Red : constant Color_Number := Curses_Constants.COLOR_RED;
+ Green : constant Color_Number := Curses_Constants.COLOR_GREEN;
+ Yellow : constant Color_Number := Curses_Constants.COLOR_YELLOW;
+ Blue : constant Color_Number := Curses_Constants.COLOR_BLUE;
+ Magenta : constant Color_Number := Curses_Constants.COLOR_MAGENTA;
+ Cyan : constant Color_Number := Curses_Constants.COLOR_CYAN;
+ White : constant Color_Number := Curses_Constants.COLOR_WHITE;
+
type RGB_Value is range 0 .. Integer (Interfaces.C.short'Last);
for RGB_Value'Size use Interfaces.C.short'Size;
-- Some system may allow to redefine a color by setting RGB values.
@@ -117,8 +416,73 @@ include(`Color_Defs')
-- two colors described by Color_Numbers, one for the foreground and
-- the other for the background
-include(`Character_Attribute_Set_Rep')
- -- (n)curses uses all but the lowest 16 Bits for Attributes.
+ type Character_Attribute_Set is
+ record
+ Stand_Out : Boolean;
+ Under_Line : Boolean;
+ Reverse_Video : Boolean;
+ Blink : Boolean;
+ Dim_Character : Boolean;
+ Bold_Character : Boolean;
+ Protected_Character : Boolean;
+ Invisible_Character : Boolean;
+ Alternate_Character_Set : Boolean;
+ Horizontal : Boolean;
+ Left : Boolean;
+ Low : Boolean;
+ Right : Boolean;
+ Top : Boolean;
+ Vertical : Boolean;
+ end record;
+
+ for Character_Attribute_Set use
+ record
+ Stand_Out at 0 range
+ Curses_Constants.A_STANDOUT_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_STANDOUT_Last - Curses_Constants.Attr_First;
+ Under_Line at 0 range
+ Curses_Constants.A_UNDERLINE_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_UNDERLINE_Last - Curses_Constants.Attr_First;
+ Reverse_Video at 0 range
+ Curses_Constants.A_REVERSE_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_REVERSE_Last - Curses_Constants.Attr_First;
+ Blink at 0 range
+ Curses_Constants.A_BLINK_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_BLINK_Last - Curses_Constants.Attr_First;
+ Dim_Character at 0 range
+ Curses_Constants.A_DIM_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_DIM_Last - Curses_Constants.Attr_First;
+ Bold_Character at 0 range
+ Curses_Constants.A_BOLD_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_BOLD_Last - Curses_Constants.Attr_First;
+ Protected_Character at 0 range
+ Curses_Constants.A_PROTECT_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_PROTECT_Last - Curses_Constants.Attr_First;
+ Invisible_Character at 0 range
+ Curses_Constants.A_INVIS_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_INVIS_Last - Curses_Constants.Attr_First;
+ Alternate_Character_Set at 0 range
+ Curses_Constants.A_ALTCHARSET_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_ALTCHARSET_Last - Curses_Constants.Attr_First;
+ Horizontal at 0 range
+ Curses_Constants.A_HORIZONTAL_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_HORIZONTAL_Last - Curses_Constants.Attr_First;
+ Left at 0 range
+ Curses_Constants.A_LEFT_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_LEFT_Last - Curses_Constants.Attr_First;
+ Low at 0 range
+ Curses_Constants.A_LOW_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_LOW_Last - Curses_Constants.Attr_First;
+ Right at 0 range
+ Curses_Constants.A_RIGHT_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_RIGHT_Last - Curses_Constants.Attr_First;
+ Top at 0 range
+ Curses_Constants.A_TOP_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_TOP_Last - Curses_Constants.Attr_First;
+ Vertical at 0 range
+ Curses_Constants.A_VERTICAL_First - Curses_Constants.Attr_First
+ .. Curses_Constants.A_VERTICAL_Last - Curses_Constants.Attr_First;
+ end record;
Normal_Video : constant Character_Attribute_Set := (others => False);
@@ -128,17 +492,29 @@ include(`Character_Attribute_Set_Rep')
Color : Color_Pair;
Ch : Character;
end record;
- pragma Convention (C, Attributed_Character);
+ pragma Convention (C_Pass_By_Copy, Attributed_Character);
-- This is the counterpart for the chtype in C.
-include(`AC_Rep')
+ for Attributed_Character use
+ record
+ Ch at 0 range Curses_Constants.A_CHARTEXT_First
+ .. Curses_Constants.A_CHARTEXT_Last;
+ Color at 0 range Curses_Constants.A_COLOR_First
+ .. Curses_Constants.A_COLOR_Last;
+ pragma Warnings (Off);
+ Attr at 0 range Curses_Constants.Attr_First
+ .. Curses_Constants.Attr_Last;
+ pragma Warnings (On);
+ end record;
+ for Attributed_Character'Size use Curses_Constants.chtype_Size;
+
Default_Character : constant Attributed_Character
:= (Ch => Character'First,
Color => Color_Pair'First,
Attr => (others => False)); -- preelaboratable Normal_Video
type Attributed_String is array (Positive range <>) of Attributed_Character;
- pragma Pack (Attributed_String);
+ pragma Convention (C, Attributed_String);
-- In this binding we allow strings of attributed characters.
------------------
@@ -188,7 +564,78 @@ include(`AC_Rep')
function Number_Of_Color_Pairs return Natural;
pragma Inline (Number_Of_Color_Pairs);
-include(`ACS_Map')dnl
+ subtype ACS_Index is Character range
+ Character'Val (0) .. Character'Val (127);
+ function ACS_Map (Index : ACS_Index) return Attributed_Character;
+ pragma Import (C, ACS_Map, "acs_map_as_function");
+
+ -- Constants for several characters from the Alternate Character Set
+ -- You must use these constants as indices into the ACS_Map function
+ -- to get the corresponding attributed character at runtime
+ ACS_Upper_Left_Corner : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_ULCORNER);
+ ACS_Lower_Left_Corner : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_LLCORNER);
+ ACS_Upper_Right_Corner : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_URCORNER);
+ ACS_Lower_Right_Corner : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_LRCORNER);
+ ACS_Left_Tee : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_LTEE);
+ ACS_Right_Tee : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_RTEE);
+ ACS_Bottom_Tee : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_BTEE);
+ ACS_Top_Tee : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_TTEE);
+ ACS_Horizontal_Line : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_HLINE);
+ ACS_Vertical_Line : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_VLINE);
+ ACS_Plus_Symbol : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_PLUS);
+ ACS_Scan_Line_1 : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_S1);
+ ACS_Scan_Line_9 : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_S9);
+ ACS_Diamond : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_DIAMOND);
+ ACS_Checker_Board : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_CKBOARD);
+ ACS_Degree : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_DEGREE);
+ ACS_Plus_Minus : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_PLMINUS);
+ ACS_Bullet : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_BULLET);
+ ACS_Left_Arrow : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_LARROW);
+ ACS_Right_Arrow : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_RARROW);
+ ACS_Down_Arrow : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_DARROW);
+ ACS_Up_Arrow : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_UARROW);
+ ACS_Board_Of_Squares : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_BOARD);
+ ACS_Lantern : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_LANTERN);
+ ACS_Solid_Block : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_BLOCK);
+ ACS_Scan_Line_3 : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_S3);
+ ACS_Scan_Line_7 : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_S7);
+ ACS_Less_Or_Equal : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_LEQUAL);
+ ACS_Greater_Or_Equal : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_GEQUAL);
+ ACS_PI : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_PI);
+ ACS_Not_Equal : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_NEQUAL);
+ ACS_Sterling : constant ACS_Index
+ := Character'Val (Curses_Constants.ACS_STERLING);
-- MANPAGE(`curs_initscr.3x')
-- | Not implemented: newterm, set_term, delscreen
@@ -196,11 +643,13 @@ include(`ACS_Map')dnl
-- ANCHOR(`stdscr',`Standard_Window')
function Standard_Window return Window;
-- AKA
+ pragma Import (C, Standard_Window, "stdscr_as_function");
pragma Inline (Standard_Window);
-- ANCHOR(`curscr',`Current_Window')
function Current_Window return Window;
-- AKA
+ pragma Import (C, Current_Window, "curscr_as_function");
pragma Inline (Current_Window);
-- ANCHOR(`initscr()',`Init_Screen')
@@ -1476,6 +1925,8 @@ include(`ACS_Map')dnl
-- MANPAGE(`default_colors.3x')
+ Default_Color : constant Color_Number := -1;
+
-- ANCHOR(`use_default_colors()',`Use_Default_Colors')
procedure Use_Default_Colors;
-- AKA
@@ -1553,7 +2004,11 @@ private
-- The next constants are generated and may be different on your
-- architecture.
--
-include(`Window_Offsets')dnl
+
+ Sizeof_Bool : constant := Curses_Constants.Sizeof_Bool;
+
+ type Curses_Bool is mod 2 ** Sizeof_Bool;
+
Curses_Bool_False : constant Curses_Bool := 0;
end Terminal_Interface.Curses;