Base version of ncurses-5.7 library
diff --git a/Ada95/gen/Makefile.in b/Ada95/gen/Makefile.in
new file mode 100644
index 0000000..b7e3bec
--- /dev/null
+++ b/Ada95/gen/Makefile.in
@@ -0,0 +1,474 @@
+##############################################################################
+# Copyright (c) 1998-2007,2008 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"), #
+# to deal in the Software without restriction, including without limitation #
+# the rights to use, copy, modify, merge, publish, distribute, distribute #
+# with modifications, sublicense, and/or sell copies of the Software, and to #
+# permit persons to whom the Software is furnished to do so, subject to the #
+# following conditions: #
+# #
+# The above copyright notice and this permission notice shall be included in #
+# all copies or substantial portions of the Software. #
+# #
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
+# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
+# DEALINGS IN THE SOFTWARE. #
+# #
+# Except as contained in this notice, the name(s) of the above copyright #
+# holders shall not be used in advertising or otherwise to promote the sale, #
+# use or other dealings in this Software without prior written #
+# authorization. #
+##############################################################################
+#
+# Author: Juergen Pfeifer, 1996
+#
+# $Id: Makefile.in,v 1.61 2008/10/04 22:58:31 tom Exp $
+#
+.SUFFIXES:
+
+SHELL = /bin/sh
+THIS = Makefile
+
+x = @PROG_EXT@
+
+top_srcdir = @top_srcdir@
+DESTDIR = @DESTDIR@
+srcdir = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+
+ADA_INCLUDE = $(DESTDIR)@ADA_INCLUDE@
+ADA_OBJECTS = $(DESTDIR)@ADA_OBJECTS@
+
+INSTALL = @INSTALL@
+INSTALL_PROG = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+AWK = @AWK@
+LN_S = @LN_S@
+
+CC = @CC@
+HOST_CC = @BUILD_CC@
+CFLAGS = @CFLAGS@
+
+CPPFLAGS = @ACPPFLAGS@ \
+ -DHAVE_CONFIG_H -I$(srcdir)
+
+CCFLAGS = $(CPPFLAGS) $(CFLAGS)
+CFLAGS_NORMAL = $(CCFLAGS)
+CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE
+CFLAGS_PROFILE = $(CCFLAGS) -pg
+CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@
+
+CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@)
+
+REL_VERSION = @cf_cv_rel_version@
+ABI_VERSION = @cf_cv_abi_version@
+LOCAL_LIBDIR = @top_builddir@/lib
+
+LINK = $(HOST_CC)
+LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) @TINFO_ARGS2@
+
+RANLIB = @RANLIB@
+
+M4 = m4
+M4FLAGS = -DNCURSES_EXT_FUNCS=@NCURSES_EXT_FUNCS@
+
+ADACURSES_CONFIG = adacurses-config
+
+WRAPPER = sh $(top_srcdir)/misc/shlib
+GENERATE = ./gen$x '@DFT_ARG_SUFFIX@'
+DEL_ADAMODE = sed -e '/^\-\-\ \ \-\*\-\ ada\ \-\*\-.*/d'
+
+GNATHTML = `type -p gnathtml || type -p gnathtml.pl`
+GNATHP = www.gnat.com
+
+################################################################################
+ALIB = @cf_ada_package@
+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 \
+ $(ADA_SRCDIR)/$(ABASE)-trace.ads \
+ $(ADA_SRCDIR)/$(ABASE)-menus.ads \
+ $(ADA_SRCDIR)/$(ABASE)-forms.ads \
+ $(ADA_SRCDIR)/$(ABASE)-mouse.ads \
+ $(ADA_SRCDIR)/$(ABASE)-panels.ads \
+ $(ADA_SRCDIR)/$(ABASE)-menus-menu_user_data.ads \
+ $(ADA_SRCDIR)/$(ABASE)-menus-item_user_data.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
+
+GEN_SRC = $(srcdir)/$(ABASE).ads.m4 \
+ $(srcdir)/$(ABASE).adb.m4 \
+ $(srcdir)/$(ABASE)-aux.ads.m4 \
+ $(srcdir)/$(ABASE)-trace.ads.m4 \
+ $(srcdir)/$(ABASE)-menus.ads.m4 \
+ $(srcdir)/$(ABASE)-forms.ads.m4 \
+ $(srcdir)/$(ABASE)-mouse.ads.m4 \
+ $(srcdir)/$(ABASE)-panels.ads.m4 \
+ $(srcdir)/$(ABASE)-menus-menu_user_data.ads.m4 \
+ $(srcdir)/$(ABASE)-menus-item_user_data.ads.m4 \
+ $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 \
+ $(srcdir)/$(ABASE)-forms-field_types.ads.m4 \
+ $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 \
+ $(srcdir)/$(ABASE)-panels-user_data.ads.m4
+
+
+all \
+libs : $(GEN_TARGETS)
+ @echo made $@
+
+sources:
+
+$(ADA_INCLUDE) \
+$(ADA_OBJECTS) :
+ sh $(top_srcdir)/mkdirs.sh $@
+
+install \
+install.libs :: $(ADA_INCLUDE)
+ @echo installing package $(ALIB) in $(ADA_INCLUDE)
+ @$(top_srcdir)/tar-copy.sh '$(ALIB)*.ad?' $(ADA_SRCDIR) $(ADA_INCLUDE)
+ @$(top_srcdir)/tar-copy.sh '$(ALIB)[-.]*.ad?' $(ADA_SRCDIR) $(ADA_INCLUDE)
+ @test $(srcdir) != ./ && $(top_srcdir)/tar-copy.sh '$(ALIB)*.ad?' $(srcdir)/../src $(ADA_INCLUDE)
+ @test $(srcdir) != ./ && $(top_srcdir)/tar-copy.sh '$(ALIB)[-.]*.ad?' $(srcdir)/../src $(ADA_INCLUDE)
+
+install \
+install.libs :: $(ADA_OBJECTS)
+ @echo installing package $(ALIB) in $(ADA_OBJECTS)
+ @-chmod a-wx $(ADA_SRCDIR)/*.ali
+ @$(top_srcdir)/tar-copy.sh '$(ALIB)*.ali' $(ADA_SRCDIR) $(ADA_OBJECTS)
+ @$(top_srcdir)/tar-copy.sh '$(ALIB)[-.]*.ali' $(ADA_SRCDIR) $(ADA_OBJECTS)
+ @-chmod u+x $(ADA_SRCDIR)/*.ali
+
+install \
+install.libs :: $(DESTDIR)$(bindir) adacurses-config
+ $(INSTALL_PROG) adacurses-config $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG)
+
+uninstall \
+uninstall.libs ::
+ @echo removing package $(ALIB) from $(ADA_INCLUDE)
+ -@cd $(ADA_INCLUDE) && rm -f $(ALIB)[-.]*
+
+uninstall \
+uninstall.libs ::
+ @echo removing package $(ALIB) from $(ADA_OBJECTS)
+ -@cd $(ADA_OBJECTS) && rm -f $(ALIB)[-.]*
+
+uninstall \
+uninstall.libs ::
+ -rm -f $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG)
+
+gen$x: gen.o
+ @ECHO_LINK@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@
+
+gen.o: $(srcdir)/gen.c
+ $(HOST_CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/gen.c
+################################################################################
+Character_Attribute_Set_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) B A" >$@
+
+Base_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) B B" >$@
+
+Color_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) B C" >$@
+
+Window_Offsets: gen$x
+ $(WRAPPER) "$(GENERATE) B D" >$@
+
+Key_Definitions: gen$x
+ $(WRAPPER) "$(GENERATE) B K" >$@
+
+Linker_Options: gen$x
+ $(WRAPPER) "$(GENERATE) B L" >$@
+
+ACS_Map: gen$x
+ $(WRAPPER) "$(GENERATE) B M" >$@
+
+Old_Keys: gen$x
+ $(WRAPPER) "$(GENERATE) B O" >$@
+
+Public_Variables: gen$x
+ $(WRAPPER) "$(GENERATE) B P" >$@
+
+AC_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) B R" >$@
+
+Version_Info: gen$x
+ $(WRAPPER) "$(GENERATE) B V" >$@
+
+Trace_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) B T" >$@
+################################################################################
+Menu_Opt_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) M R" >$@
+
+Menu_Base_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) M B" >$@
+
+Menu_Linker_Options: gen$x
+ $(WRAPPER) "$(GENERATE) M L" >$@
+
+Item_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) M I" >$@
+################################################################################
+Form_Opt_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) F R" >$@
+
+Form_Base_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) F B" >$@
+
+Form_Linker_Options: gen$x
+ $(WRAPPER) "$(GENERATE) F L" >$@
+
+Field_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) F I" >$@
+################################################################################
+Mouse_Base_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) P B" >$@
+
+Mouse_Event_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) P M" >$@
+
+Mouse_Events: gen$x
+ $(WRAPPER) "$(GENERATE) B E" >$@
+
+Panel_Linker_Options: gen$x
+ $(WRAPPER) "$(GENERATE) P L" >$@
+
+Chtype_Def: gen$x
+ $(WRAPPER) "$(GENERATE) E C" >$@
+
+Eti_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) E E" >$@
+################################################################################
+$(ADA_SRCDIR)/$(ABASE).ads: $(srcdir)/$(ABASE).ads.m4 \
+ $(GEN_FILES1) $(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
+ $(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
+ $(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
+ $(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
+ $(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
+ $(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
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-mouse.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-panels.ads: $(srcdir)/$(ABASE)-panels.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-panels.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-menus-menu_user_data.ads: \
+ $(srcdir)/$(ABASE)-menus-menu_user_data.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-menus-menu_user_data.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-menus-item_user_data.ads: \
+ $(srcdir)/$(ABASE)-menus-item_user_data.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-menus-item_user_data.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-forms-form_user_data.ads: \
+ $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-forms-field_types.ads: \
+ $(srcdir)/$(ABASE)-forms-field_types.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-forms-field_types.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-forms-field_user_data.ads: \
+ $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-panels-user_data.ads: \
+ $(srcdir)/$(ABASE)-panels-user_data.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-panels-user_data.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+install.progs ::
+
+tags:
+ ctags *.[ch]
+
+@MAKE_UPPER_TAGS@TAGS:
+@MAKE_UPPER_TAGS@ etags *.[ch]
+
+mostlyclean ::
+ -rm -f a.out core gen$x *.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
+
+distclean :: clean
+ -rm -f adacurses-config
+ -rm -f Makefile
+
+realclean :: distclean
+
+HTML_DIR = ../../doc/html/ada
+
+instab.tmp : table.m4 $(GEN_SRC)
+ @rm -f $@
+ @for f in $(GEN_SRC) ; do \
+ $(M4) $(M4FLAGS) -DM4MACRO=table.m4 $$f | $(DEL_ADAMODE) >> $@ ;\
+ done;
+
+$(HTML_DIR)/table.html : instab.tmp
+ @-touch $@
+ @-chmod +w $@
+ @echo '<!DOCTYPE HTML' > $@
+ @echo 'PUBLIC "-//IETF//DTD HTML 3.0//EN">' >> $@
+ @echo '<HTML>' >> $@
+ @echo '<HEAD>' >> $@
+ @echo '<TITLE>Correspondence between ncurses C and Ada functions</TITLE>' >>$@
+ @echo '</HEAD>' >> $@
+ @echo '<BODY>' >> $@
+ @echo '<H1>Correspondence between ncurses C and Ada functions</H1>' >>$@
+ @echo '<H2>Sorted by C function name</H2>' >>$@
+ @echo '<TABLE ALIGN=CENTER BORDER>' >>$@
+ @echo '<TR ALIGN=LEFT>' >>$@
+ @echo '<TH>C name</TH><TH>Ada name</TH><TH>man page</TH></TR>' >>$@
+ @sort < instab.tmp >> $@
+ @echo '</TABLE></BODY></HTML>' >>$@
+ @rm -f instab.tmp
+
+adahtml:
+ @find $(HTML_DIR) -type f -exec rm -f {} \;
+ @mkdir -p $(HTML_DIR)
+ cp -p ../src/*.ad[sb] . && chmod +w *.ad[sb]
+ ln -sf ../src/*.ali .
+ @echo "Filtering generated files"
+ @for f in $(GEN_SRC); do \
+ h=`basename $$f` ;\
+ g=`basename $$f .ads.m4` ;\
+ if test "$$g" != "$$h" ; then \
+ $(M4) $(M4FLAGS) -DM4MACRO=html.m4 $$f | $(DEL_ADAMODE) > $$g.ads ;\
+ echo "... $$g.ads" ;\
+ fi \
+ done
+ @-rm -f $(HTML_DIR)/$(ALIB)*.htm*
+ $(GNATHTML) -d -f $(ALIB)*.ads
+ for f in html/$(ALIB)*.htm*; do \
+ a=`basename $$f` ; \
+ sed -e 's/You may also.*body.*//' <$$f |\
+ sed -e 's%GNAT%<A HREF="http://$(GNATHP)">GNAT</A>%g' |\
+ sed -e 's%<A HREF%<A HREF%g' |\
+ sed -e 's%">%">%g' |\
+ sed -e 's/3X/3x/g' |\
+ sed -e 's/$$\([ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxz0123456789_]*:.*\)\$$/@\1@/' |\
+ sed -e 's%</A>%</A>%g' > $$a.tmp ;\
+ mv $$a.tmp $$f ;\
+ done
+ @rm -f *.ad[sb] *.ali *.tmp
+ @for f in funcs.htm main.htm ; do \
+ sed -e "\%<A HREF=funcs/ .htm>\[ \]</A>%d" < html/$$f > $$f ;\
+ mv $$f html/$$f ;\
+ done
+ @rm -f "html/funcs/ .htm"
+ @cp -pdrf html/* $(HTML_DIR)/
+ @rm -rf html
+
+html : adahtml $(HTML_DIR)/table.html
+ @echo made $@
+
+###############################################################################
+# The remainder of this file is automatically generated during configuration
+###############################################################################
diff --git a/Ada95/gen/adacurses-config.in b/Ada95/gen/adacurses-config.in
new file mode 100644
index 0000000..c88d85b
--- /dev/null
+++ b/Ada95/gen/adacurses-config.in
@@ -0,0 +1,35 @@
+#! /bin/sh
+# $Id: adacurses-config.in,v 1.2 2007/04/07 21:06:50 tom Exp $
+#
+# This script will return the option to add to `gnatmake' for using
+# AdaCurses.
+#
+
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+
+VERSION="@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@"
+
+CFLAGS="-I$libdir/adacurses -L$libdir/adacurses"
+LIBS="-L$prefix/lib -lAdaCurses"
+
+case "x$1" in
+ x--version)
+ echo AdaCurses $VERSION
+ ;;
+ x--cflags)
+ echo $CFLAGS
+ ;;
+ x--libs)
+ echo $LIBS
+ ;;
+ x)
+ # if no parameter is given, give what gnatmake needs
+ echo $CFLAGS -largs $LIBS
+ ;;
+ *)
+ echo 'Usage: adacurses-config [--version | --cflags | --libs]' >&2
+ exit 1
+ ;;
+esac
diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c
new file mode 100644
index 0000000..d8ea44f
--- /dev/null
+++ b/Ada95/gen/gen.c
@@ -0,0 +1,1523 @@
+/****************************************************************************
+ * Copyright (c) 1998,2007,2008 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"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Juergen Pfeifer, 1996 *
+ ****************************************************************************/
+
+/*
+ Version Control
+ $Id: gen.c,v 1.49 2008/10/04 21:59:37 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.
+ */
+
+#include <ncurses_cfg.h>
+
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include <menu.h>
+#include <form.h>
+
+#define RES_NAME "Reserved"
+
+static const char *model = "";
+static int little_endian = 0;
+
+typedef struct
+ {
+ const char *name;
+ unsigned long attr;
+ }
+name_attribute_pair;
+
+static int
+find_pos(char *s, unsigned len, int *low, int *high)
+{
+ unsigned int i, j;
+ int l = 0;
+
+ *high = -1;
+ *low = 8 * len;
+
+ for (i = 0; i < len; i++, s++)
+ {
+ if (*s)
+ {
+ for (j = 0; j < 8 * sizeof(char); j++)
+
+ {
+ if (((little_endian && ((*s) & 0x01)) ||
+ (!little_endian && ((*s) & 0x80))))
+ {
+ if (l > *high)
+ *high = l;
+ if (l < *low)
+ *low = l;
+ }
+ l++;
+ if (little_endian)
+ *s >>= 1;
+ else
+ *s <<= 1;
+ }
+ }
+ else
+ l += 8;
+ }
+ return (*high >= 0 && (*low <= *high)) ? *low : -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.
+ */
+static void
+ gen_reps
+ (const name_attribute_pair * nap, /* array of name_attribute_pair records */
+ const char *name, /* name of the represented record type */
+ int len, /* size of the record in bytes */
+ int bias)
+{
+ int i, n, l, cnt = 0, low, high;
+ int width = strlen(RES_NAME) + 3;
+ unsigned long a;
+ unsigned long mask = 0;
+
+ assert(nap != NULL);
+
+ for (i = 0; nap[i].name != (char *)0; i++)
+ {
+ cnt++;
+ l = 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++)
+ {
+ 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++)
+ {
+ a = nap[i].attr;
+ mask |= a;
+ l = find_pos((char *)&a, sizeof(a), &low, &high);
+ if (l >= 0)
+ printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name,
+ low - bias, high - bias);
+ }
+ i = 1;
+ n = cnt;
+ printf(" end record;\n");
+ printf(" for %s'Size use %d;\n", name, 8 * len);
+ printf(" -- 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 = -1;
+ attr_t t = x & mask;
+ int low, high;
+ int l = find_pos((char *)&t, sizeof(t), &low, &high);
+
+ if (l >= 0)
+ 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)
+{
+ int low, high;
+ int l = find_pos((char *)rec, sizeof(MEVENT), &low, &high);
+
+ if (l >= 0)
+ 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 = -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 specified.
+ */
+ static const name_attribute_pair nap[] =
+ {
+#if A_STANDOUT
+ {"Stand_Out", A_STANDOUT},
+#endif
+#if A_UNDERLINE
+ {"Under_Line", A_UNDERLINE},
+#endif
+#if A_REVERSE
+ {"Reverse_Video", A_REVERSE},
+#endif
+#if A_BLINK
+ {"Blink", A_BLINK},
+#endif
+#if A_DIM
+ {"Dim_Character", A_DIM},
+#endif
+#if A_BOLD
+ {"Bold_Character", A_BOLD},
+#endif
+#if A_ALTCHARSET
+ {"Alternate_Character_Set", A_ALTCHARSET},
+#endif
+#if A_INVIS
+ {"Invisible_Character", A_INVIS},
+#endif
+#if A_PROTECT
+ {"Protected_Character", A_PROTECT},
+#endif
+#if A_HORIZONTAL
+ {"Horizontal", A_HORIZONTAL},
+#endif
+#if A_LEFT
+ {"Left", A_LEFT},
+#endif
+#if A_LOW
+ {"Low", A_LOW},
+#endif
+#if A_RIGHT
+ {"Right", A_RIGHT},
+#endif
+#if A_TOP
+ {"Top", A_TOP},
+#endif
+#if A_VERTICAL
+ {"Vertical", A_VERTICAL},
+#endif
+ {(char *)0, 0}
+ };
+ chtype attr = A_ATTRIBUTES & ~A_COLOR;
+ int start = -1;
+ int len = 0;
+ int i, 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, (len + 7) / 8, little_endian ? start : 0);
+}
+
+static void
+gen_trace(const char *name)
+{
+ static const name_attribute_pair nap[] =
+ {
+ {"Times", TRACE_TIMES},
+ {"Tputs", TRACE_TPUTS},
+ {"Update", TRACE_UPDATE},
+ {"Cursor_Move", TRACE_MOVE},
+ {"Character_Output", TRACE_CHARPUT},
+ {"Calls", TRACE_CALLS},
+ {"Virtual_Puts", TRACE_VIRTPUT},
+ {"Input_Events", TRACE_IEVENT},
+ {"TTY_State", TRACE_BITS},
+ {"Internal_Calls", TRACE_ICALLS},
+ {"Character_Calls", TRACE_CCALLS},
+ {"Termcap_TermInfo", TRACE_DATABASE},
+ {(char *)0, 0}
+ };
+ gen_reps(nap, name, sizeof(int), 0);
+}
+
+static void
+gen_menu_opt_rep(const char *name)
+{
+ static const name_attribute_pair nap[] =
+ {
+#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}
+ };
+ gen_reps(nap, name, sizeof(int), 0);
+}
+
+static void
+gen_item_opt_rep(const char *name)
+{
+ static const name_attribute_pair nap[] =
+ {
+#ifdef O_SELECTABLE
+ {"Selectable", O_SELECTABLE},
+#endif
+ {(char *)0, 0}
+ };
+ gen_reps(nap, name, sizeof(int), 0);
+}
+
+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}
+ };
+ gen_reps(nap, name, sizeof(int), 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}
+ };
+ gen_reps(nap, name, sizeof(int), 0);
+}
+
+/*
+ * 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
+ { /* generate the old name, but only if it doesn't conflict with the old
+ * name (Ada95 isn't case sensitive!)
+ */
+ const char *s = old_name;
+ const char *t = name;
+
+ while (*s && *t && (toupper(*s++) == toupper(*t++)));
+ if (*s || *t)
+ printf(" %-16s : Special_Key_Code renames %s;\n", old_name, name);
+ }
+}
+
+/*
+ * 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;
+
+#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 = a - &acs_map[0];
+
+ printf(" %-24s : constant Character := ", name);
+ if (isprint(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, \"_nc_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
+#ifdef BUTTON1_RESERVED_EVENT
+ GEN_MEVENT(BUTTON1_RESERVED_EVENT);
+ all1 |= BUTTON1_RESERVED_EVENT;
+#endif
+#ifdef BUTTON2_RELEASED
+ GEN_MEVENT(BUTTON2_RELEASED);
+ all2 |= BUTTON2_RELEASED;
+#endif
+#ifdef BUTTON2_PRESSED
+ GEN_MEVENT(BUTTON2_PRESSED);
+ all2 |= BUTTON2_PRESSED;
+#endif
+#ifdef BUTTON2_CLICKED
+ GEN_MEVENT(BUTTON2_CLICKED);
+ all2 |= BUTTON2_CLICKED;
+#endif
+#ifdef BUTTON2_DOUBLE_CLICKED
+ GEN_MEVENT(BUTTON2_DOUBLE_CLICKED);
+ all2 |= BUTTON2_DOUBLE_CLICKED;
+#endif
+#ifdef BUTTON2_TRIPLE_CLICKED
+ GEN_MEVENT(BUTTON2_TRIPLE_CLICKED);
+ all2 |= BUTTON2_TRIPLE_CLICKED;
+#endif
+#ifdef BUTTON2_RESERVED_EVENT
+ GEN_MEVENT(BUTTON2_RESERVED_EVENT);
+ all2 |= BUTTON2_RESERVED_EVENT;
+#endif
+#ifdef BUTTON3_RELEASED
+ GEN_MEVENT(BUTTON3_RELEASED);
+ all3 |= BUTTON3_RELEASED;
+#endif
+#ifdef BUTTON3_PRESSED
+ GEN_MEVENT(BUTTON3_PRESSED);
+ all3 |= BUTTON3_PRESSED;
+#endif
+#ifdef BUTTON3_CLICKED
+ GEN_MEVENT(BUTTON3_CLICKED);
+ all3 |= BUTTON3_CLICKED;
+#endif
+#ifdef BUTTON3_DOUBLE_CLICKED
+ GEN_MEVENT(BUTTON3_DOUBLE_CLICKED);
+ all3 |= BUTTON3_DOUBLE_CLICKED;
+#endif
+#ifdef BUTTON3_TRIPLE_CLICKED
+ GEN_MEVENT(BUTTON3_TRIPLE_CLICKED);
+ all3 |= BUTTON3_TRIPLE_CLICKED;
+#endif
+#ifdef BUTTON3_RESERVED_EVENT
+ GEN_MEVENT(BUTTON3_RESERVED_EVENT);
+ all3 |= BUTTON3_RESERVED_EVENT;
+#endif
+#ifdef BUTTON4_RELEASED
+ GEN_MEVENT(BUTTON4_RELEASED);
+ all4 |= BUTTON4_RELEASED;
+#endif
+#ifdef BUTTON4_PRESSED
+ GEN_MEVENT(BUTTON4_PRESSED);
+ all4 |= BUTTON4_PRESSED;
+#endif
+#ifdef BUTTON4_CLICKED
+ GEN_MEVENT(BUTTON4_CLICKED);
+ all4 |= BUTTON4_CLICKED;
+#endif
+#ifdef BUTTON4_DOUBLE_CLICKED
+ GEN_MEVENT(BUTTON4_DOUBLE_CLICKED);
+ all4 |= BUTTON4_DOUBLE_CLICKED;
+#endif
+#ifdef BUTTON4_TRIPLE_CLICKED
+ GEN_MEVENT(BUTTON4_TRIPLE_CLICKED);
+ all4 |= BUTTON4_TRIPLE_CLICKED;
+#endif
+#ifdef BUTTON4_RESERVED_EVENT
+ GEN_MEVENT(BUTTON4_RESERVED_EVENT);
+ all4 |= BUTTON4_RESERVED_EVENT;
+#endif
+#ifdef BUTTON_CTRL
+ GEN_MEVENT(BUTTON_CTRL);
+#endif
+#ifdef BUTTON_SHIFT
+ GEN_MEVENT(BUTTON_SHIFT);
+#endif
+#ifdef BUTTON_ALT
+ GEN_MEVENT(BUTTON_ALT);
+#endif
+#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, \"_nc_%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");
+}
+
+/*
+ * 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
+#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");
+}
+
+/*
+ * 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);
+#endif
+}
+
+/*
+ * Generate the linker options for the base facility
+ */
+static void
+gen_linkopts(void)
+{
+ printf(" pragma Linker_Options (\"-lncurses%s\");\n", model);
+}
+
+/*
+ * 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 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");
+
+ /* In ncurses _maxy and _maxx needs an offset for the "public"
+ * value
+ */
+ printf(" Offset%-*s : constant Natural := %2d; -- %s\n",
+ 12, "_XY", 1, "int");
+ printf("\n");
+ printf(" type Curses_Bool is mod 2 ** Interfaces.C.%s'Size;\n", s_bool);
+}
+
+/*
+ * 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(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);
+#endif
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ /* --------------------------------------------------------------- */
+ default:
+ break;
+ }
+ return 0;
+}
diff --git a/Ada95/gen/html.m4 b/Ada95/gen/html.m4
new file mode 100644
index 0000000..8df2653
--- /dev/null
+++ b/Ada95/gen/html.m4
@@ -0,0 +1,40 @@
+dnl***************************************************************************
+dnl Copyright (c) 2000-2006,2007 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 *
+dnl "Software"), to deal in the Software without restriction, including *
+dnl without limitation the rights to use, copy, modify, merge, publish, *
+dnl distribute, distribute with modifications, sublicense, and/or sell *
+dnl copies of the Software, and to permit persons to whom the Software is *
+dnl furnished to do so, subject to the following conditions: *
+dnl *
+dnl The above copyright notice and this permission notice shall be included *
+dnl in all copies or substantial portions of the Software. *
+dnl *
+dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+dnl *
+dnl Except as contained in this notice, the name(s) of the above copyright *
+dnl holders shall not be used in advertising or otherwise to promote the *
+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 $
+define(`ANCHORIDX',`0')dnl
+define(`MANPAGE',`define(`MANPG',$1)dnl
+|=====================================================================
+ -- | Man page <A HREF="../man/MANPG.html">MANPG</A>
+ -- |=====================================================================')dnl
+define(`ANCHOR',`define(`ANCHORIDX',incr(ANCHORIDX))dnl
+`#'1A NAME="AFU`_'ANCHORIDX"`#'2dnl
+define(`CFUNAME',`$1')define(`AFUNAME',`$2')dnl
+|')dnl
+define(`AKA',``AKA': <A HREF="../man/MANPG.html">CFUNAME</A>')dnl
+define(`ALIAS',``AKA': $1')dnl
diff --git a/Ada95/gen/normal.m4 b/Ada95/gen/normal.m4
new file mode 100644
index 0000000..9529976
--- /dev/null
+++ b/Ada95/gen/normal.m4
@@ -0,0 +1,37 @@
+dnl***************************************************************************
+dnl Copyright (c) 1998,2006 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 *
+dnl "Software"), to deal in the Software without restriction, including *
+dnl without limitation the rights to use, copy, modify, merge, publish, *
+dnl distribute, distribute with modifications, sublicense, and/or sell *
+dnl copies of the Software, and to permit persons to whom the Software is *
+dnl furnished to do so, subject to the following conditions: *
+dnl *
+dnl The above copyright notice and this permission notice shall be included *
+dnl in all copies or substantial portions of the Software. *
+dnl *
+dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+dnl *
+dnl Except as contained in this notice, the name(s) of the above copyright *
+dnl holders shall not be used in advertising or otherwise to promote the *
+dnl sale, use or other dealings in this Software without prior written *
+dnl authorization. *
+dnl***************************************************************************
+dnl
+dnl $Id: normal.m4,v 1.2 2006/04/22 23:16:14 tom Exp $
+define(`MANPAGE',`define(`MANPG',$1)dnl
+|=====================================================================
+ -- | Man page MANPG
+ -- |=====================================================================')dnl
+define(`ANCHOR',`define(`CFUNAME',`$1')define(`AFUNAME',`$2')'dnl
+|)dnl
+define(`AKA',``AKA': CFUNAME')dnl
+define(`ALIAS',``AKA': $1')dnl
diff --git a/Ada95/gen/table.m4 b/Ada95/gen/table.m4
new file mode 100644
index 0000000..36b0027
--- /dev/null
+++ b/Ada95/gen/table.m4
@@ -0,0 +1,35 @@
+dnl***************************************************************************
+dnl Copyright (c) 2000,2006 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 *
+dnl "Software"), to deal in the Software without restriction, including *
+dnl without limitation the rights to use, copy, modify, merge, publish, *
+dnl distribute, distribute with modifications, sublicense, and/or sell *
+dnl copies of the Software, and to permit persons to whom the Software is *
+dnl furnished to do so, subject to the following conditions: *
+dnl *
+dnl The above copyright notice and this permission notice shall be included *
+dnl in all copies or substantial portions of the Software. *
+dnl *
+dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+dnl *
+dnl Except as contained in this notice, the name(s) of the above copyright *
+dnl holders shall not be used in advertising or otherwise to promote the *
+dnl sale, use or other dealings in this Software without prior written *
+dnl authorization. *
+dnl***************************************************************************
+dnl
+dnl $Id: table.m4,v 1.2 2006/04/22 23:16:44 tom Exp $
+define(`ANCHORIDX',`0')dnl
+define(`MANPAGE',`define(`MANPG',$1)')dnl
+divert(-1)dnl
+define(`ANCHOR',`divert(0)define(`ANCHORIDX',incr(ANCHORIDX))dnl
+<TR><TD>$1</TD><TD><A HREF="HTMLNAME`#'AFU`_'ANCHORIDX">$2</A></TD><TD><A HREF="../man/MANPG.html">MANPG</A></TD></TR>
+divert(-1)')
diff --git a/Ada95/gen/terminal_interface-curses-aux.ads.m4 b/Ada95/gen/terminal_interface-curses-aux.ads.m4
new file mode 100644
index 0000000..e0c9348
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-aux.ads.m4
@@ -0,0 +1,105 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-aux__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Aux --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.16 $
+-- 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;
+ subtype C_Size_T is Interfaces.C.size_t;
+ subtype C_UInt is Interfaces.C.unsigned;
+ 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_True : constant C_Int := CF_CURSES_TRUE;
+ Curses_False : constant C_Int := CF_CURSES_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);
+
+ 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 Fill_String (Cp : in chars_ptr;
+ Str : out String);
+ -- Fill the Str parameter with the string denoted by the chars_ptr
+ -- C-Style string.
+
+ function Fill_String (Cp : chars_ptr) return String;
+ -- Same but as function.
+
+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
new file mode 100644
index 0000000..8819844
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4
@@ -0,0 +1,238 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-forms-field_user_data__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.14 $
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Interfaces.C;
+
+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')
+
+ type Field_Type is abstract tagged null record;
+ -- Abstract base type for all field types. A concrete field type
+ -- is an extension that adds some data elements describing formats or
+ -- boundary values for the type and validation routines.
+ -- For the builtin low-level fieldtypes, the validation routines are
+ -- already defined by the low-level C library.
+ -- The builtin types like Alpha or AlphaNumeric etc. are defined in
+ -- child packages of this package. You may use one of them as example
+ -- how to create you own child packages for low-level field types that
+ -- you may have already written in C.
+
+ type Field_Type_Access is access all Field_Type'Class;
+
+ -- ANCHOR(`set_field_type()',`Set_Type')
+ procedure Set_Field_Type (Fld : in Field;
+ Fld_Type : in Field_Type) is abstract;
+ -- AKA
+ -- But: we hide the vararg mechanism of the C interface. You always
+ -- have to pass a single Field_Type parameter.
+
+ -- ---------------------------------------------------------------------
+
+ -- MANPAGE(`form_field_validation.3x')
+
+ -- ANCHOR(`field_type()',`Get_Type')
+ function Get_Type (Fld : in Field) return Field_Type_Access;
+ -- AKA
+ -- ALIAS(`field_arg()')
+ -- In Ada95 we can combine these. If you try to retrieve the field type
+ -- that is not defined as extension of the abstract tagged type above,
+ -- you will raise a Form_Exception.
+ -- This is not inlined
+
+ -- +----------------------------------------------------------------------
+ -- | Private Part.
+ -- | Most of this is used by the implementations of the child packages.
+ -- |
+private
+ type Makearg_Function is access
+ function (Args : System.Address) return System.Address;
+ pragma Convention (C, Makearg_Function);
+
+ type Copyarg_Function is access
+ function (Usr : System.Address) return System.Address;
+ pragma Convention (C, Copyarg_Function);
+
+ type Freearg_Function is access
+ procedure (Usr : System.Address);
+ pragma Convention (C, Freearg_Function);
+
+ type Field_Check_Function is access
+ function (Fld : Field; Usr : System.Address) return C_Int;
+ pragma Convention (C, Field_Check_Function);
+
+ type Char_Check_Function is access
+ function (Ch : C_Int; Usr : System.Address) return C_Int;
+ pragma Convention (C, Char_Check_Function);
+
+ type Choice_Function is access
+ function (Fld : Field; Usr : System.Address) return C_Int;
+ pragma Convention (C, Choice_Function);
+
+ -- +----------------------------------------------------------------------
+ -- | This must be in sync with the FIELDTYPE structure in form.h
+ -- |
+ type Low_Level_Field_Type is
+ record
+ Status : Interfaces.C.short;
+ Ref_Count : Interfaces.C.long;
+ Left, Right : System.Address;
+ Makearg : Makearg_Function;
+ Copyarg : Copyarg_Function;
+ Freearg : Freearg_Function;
+ Fcheck : Field_Check_Function;
+ Ccheck : Char_Check_Function;
+ Next, Prev : Choice_Function;
+ end record;
+ pragma Convention (C, Low_Level_Field_Type);
+ type C_Field_Type is access all Low_Level_Field_Type;
+
+ Null_Field_Type : constant C_Field_Type := null;
+
+ -- +----------------------------------------------------------------------
+ -- | This four low-level fieldtypes are the ones associated with
+ -- | fieldtypes handled by this binding. Any other low-level fieldtype
+ -- | will result in a Form_Exception is function Get_Type.
+ -- |
+ M_Generic_Type : C_Field_Type := null;
+ M_Generic_Choice : C_Field_Type := null;
+ M_Builtin_Router : C_Field_Type := null;
+ M_Choice_Router : C_Field_Type := null;
+
+ -- Two wrapper functions to access those low-level fieldtypes defined
+ -- in this package.
+ function C_Builtin_Router return C_Field_Type;
+ function C_Choice_Router return C_Field_Type;
+
+ procedure Wrap_Builtin (Fld : Field;
+ Typ : Field_Type'Class;
+ Cft : C_Field_Type := C_Builtin_Router);
+ -- This procedure has to be called by the Set_Field_Type implementation
+ -- for builtin low-level fieldtypes to replace it by an Ada95
+ -- conformant Field_Type object.
+ -- The parameter Cft must be C_Builtin_Router for regular low-level
+ -- fieldtypes (like TYP_ALPHA or TYP_ALNUM) and C_Choice_Router for
+ -- low-level fieldtypes witch choice functions (like TYP_ENUM).
+ -- Any other value will raise a Form_Exception.
+
+ function Make_Arg (Args : System.Address) return System.Address;
+ pragma Convention (C, Make_Arg);
+ -- This is the Makearg_Function for the internal low-level types
+ -- introduced by this binding.
+
+ function Copy_Arg (Usr : System.Address) return System.Address;
+ pragma Convention (C, Copy_Arg);
+ -- This is the Copyarg_Function for the internal low-level types
+ -- introduced by this binding.
+
+ procedure Free_Arg (Usr : System.Address);
+ pragma Convention (C, Free_Arg);
+ -- This is the Freearg_Function for the internal low-level types
+ -- introduced by this binding.
+
+ function Field_Check_Router (Fld : Field;
+ Usr : System.Address) return C_Int;
+ pragma Convention (C, Field_Check_Router);
+ -- This is the Field_Check_Function for the internal low-level types
+ -- introduced to wrap the low-level types by a Field_Type derived
+ -- type. It routes the call to the corresponding low-level validation
+ -- function.
+
+ function Char_Check_Router (Ch : C_Int;
+ Usr : System.Address) return C_Int;
+ pragma Convention (C, Char_Check_Router);
+ -- This is the Char_Check_Function for the internal low-level types
+ -- introduced to wrap the low-level types by a Field_Type derived
+ -- type. It routes the call to the corresponding low-level validation
+ -- function.
+
+ function Next_Router (Fld : Field;
+ Usr : System.Address) return C_Int;
+ pragma Convention (C, Next_Router);
+ -- This is the Choice_Function for the internal low-level types
+ -- introduced to wrap the low-level types by a Field_Type derived
+ -- type. It routes the call to the corresponding low-level next_choice
+ -- function.
+
+ function Prev_Router (Fld : Field;
+ Usr : System.Address) return C_Int;
+ pragma Convention (C, Prev_Router);
+ -- This is the Choice_Function for the internal low-level types
+ -- introduced to wrap the low-level types by a Field_Type derived
+ -- type. It routes the call to the corresponding low-level prev_choice
+ -- function.
+
+ -- This is the Argument structure maintained by all low-level field types
+ -- introduced by this binding.
+ type Argument is record
+ Typ : Field_Type_Access; -- the Field_Type creating this record
+ Usr : System.Address; -- original arg for builtin low-level types
+ Cft : C_Field_Type; -- the original low-level type
+ end record;
+ type Argument_Access is access all Argument;
+
+ -- +----------------------------------------------------------------------
+ -- |
+ -- | Some Imports of libform routines to deal with low-level fieldtypes.
+ -- |
+ function New_Fieldtype (Fcheck : Field_Check_Function;
+ Ccheck : Char_Check_Function)
+ return C_Field_Type;
+ pragma Import (C, New_Fieldtype, "new_fieldtype");
+
+ function Set_Fieldtype_Arg (Cft : C_Field_Type;
+ Mak : Makearg_Function := Make_Arg'Access;
+ Cop : Copyarg_Function := Copy_Arg'Access;
+ Fre : Freearg_Function := Free_Arg'Access)
+ return C_Int;
+ pragma Import (C, Set_Fieldtype_Arg, "set_fieldtype_arg");
+
+ function Set_Fieldtype_Choice (Cft : C_Field_Type;
+ Next, Prev : Choice_Function)
+ return C_Int;
+ 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-field_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4
new file mode 100644
index 0000000..4139883
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4
@@ -0,0 +1,70 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-forms-field_user_data__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_User_Data --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.15 $
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+
+generic
+ type User is limited private;
+ type User_Access is access User;
+package Terminal_Interface.Curses.Forms.Field_User_Data is
+ pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_User_Data);
+
+ -- MANPAGE(`form_field_userptr.3x')
+
+ -- ANCHOR(`set_field_userptr',`Set_User_Data')
+ procedure Set_User_Data (Fld : in Field;
+ Data : in User_Access);
+ -- AKA
+ pragma Inline (Set_User_Data);
+
+ -- ANCHOR(`field_userptr',`Get_User_Data')
+ procedure Get_User_Data (Fld : in Field;
+ Data : out User_Access);
+ -- AKA
+
+ -- ANCHOR(`field_userptr',`Get_User_Data')
+ function Get_User_Data (Fld : in Field) return User_Access;
+ -- AKA
+ -- Sama as function
+ pragma Inline (Get_User_Data);
+
+end Terminal_Interface.Curses.Forms.Field_User_Data;
diff --git a/Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4
new file mode 100644
index 0000000..0c4420d
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4
@@ -0,0 +1,70 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-forms-form_user_data__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Form_User_Data --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.14 $
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+
+generic
+ type User is limited private;
+ type User_Access is access User;
+package Terminal_Interface.Curses.Forms.Form_User_Data is
+ pragma Preelaborate (Terminal_Interface.Curses.Forms.Form_User_Data);
+
+ -- MANPAGE(`form_userptr.3x')
+
+ -- ANCHOR(`set_form_userptr',`Set_User_Data')
+ procedure Set_User_Data (Frm : in Form;
+ Data : in User_Access);
+ -- AKA
+ pragma Inline (Set_User_Data);
+
+ -- ANCHOR(`form_userptr',`Get_User_Data')
+ procedure Get_User_Data (Frm : in Form;
+ Data : out User_Access);
+ -- AKA
+
+ -- ANCHOR(`form_userptr',`Get_User_Data')
+ function Get_User_Data (Frm : in Form) return User_Access;
+ -- AKA
+ -- Same as function
+ pragma Inline (Get_User_Data);
+
+end Terminal_Interface.Curses.Forms.Form_User_Data;
diff --git a/Ada95/gen/terminal_interface-curses-forms.ads.m4 b/Ada95/gen/terminal_interface-curses-forms.ads.m4
new file mode 100644
index 0000000..5b75edb
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-forms.ads.m4
@@ -0,0 +1,699 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-forms__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Form --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998,2006 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.29 $
+-- $Date: 2006/06/25 14:30:21 $
+-- 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')
+ Space : Character renames Ada.Characters.Latin_1.Space;
+
+ type Field is private;
+ type Form is private;
+
+ Null_Field : constant Field;
+ Null_Form : constant Form;
+
+ type Field_Justification is (None,
+ Left,
+ Center,
+ Right);
+
+ pragma Warnings (Off);
+include(`Field_Rep')Dnl
+
+ pragma Warnings (On);
+
+ function Default_Field_Options return Field_Option_Set;
+ -- The initial defaults for the field options.
+ pragma Inline (Default_Field_Options);
+
+ pragma Warnings (Off);
+include(`Form_Opt_Rep')Dnl
+
+ pragma Warnings (On);
+
+ function Default_Form_Options return Form_Option_Set;
+ -- The initial defaults for the form options.
+ pragma Inline (Default_Form_Options);
+
+ type Buffer_Number is new Natural;
+
+ type Field_Array is array (Positive range <>) of aliased Field;
+ pragma Convention (C, Field_Array);
+
+ type Field_Array_Access is access Field_Array;
+
+ procedure Free (FA : in out Field_Array_Access;
+ Free_Fields : in Boolean := False);
+ -- Release the memory for an allocated field array
+ -- If Free_Fields is True, call Delete() for all the fields in
+ -- the array.
+
+ subtype Form_Request_Code is Key_Code range (Key_Max + 1) .. (Key_Max + 57);
+
+ -- The prefix F_ stands for "Form Request"
+ F_Next_Page : constant Form_Request_Code := Key_Max + 1;
+ F_Previous_Page : constant Form_Request_Code := Key_Max + 2;
+ F_First_Page : constant Form_Request_Code := Key_Max + 3;
+ F_Last_Page : constant Form_Request_Code := Key_Max + 4;
+
+ F_Next_Field : constant Form_Request_Code := Key_Max + 5;
+ F_Previous_Field : constant Form_Request_Code := Key_Max + 6;
+ F_First_Field : constant Form_Request_Code := Key_Max + 7;
+ F_Last_Field : constant Form_Request_Code := Key_Max + 8;
+ F_Sorted_Next_Field : constant Form_Request_Code := Key_Max + 9;
+ F_Sorted_Previous_Field : constant Form_Request_Code := Key_Max + 10;
+ F_Sorted_First_Field : constant Form_Request_Code := Key_Max + 11;
+ F_Sorted_Last_Field : constant Form_Request_Code := Key_Max + 12;
+ F_Left_Field : constant Form_Request_Code := Key_Max + 13;
+ F_Right_Field : constant Form_Request_Code := Key_Max + 14;
+ F_Up_Field : constant Form_Request_Code := Key_Max + 15;
+ F_Down_Field : constant Form_Request_Code := Key_Max + 16;
+
+ F_Next_Char : constant Form_Request_Code := Key_Max + 17;
+ F_Previous_Char : constant Form_Request_Code := Key_Max + 18;
+ F_Next_Line : constant Form_Request_Code := Key_Max + 19;
+ F_Previous_Line : constant Form_Request_Code := Key_Max + 20;
+ F_Next_Word : constant Form_Request_Code := Key_Max + 21;
+ F_Previous_Word : constant Form_Request_Code := Key_Max + 22;
+ F_Begin_Field : constant Form_Request_Code := Key_Max + 23;
+ F_End_Field : constant Form_Request_Code := Key_Max + 24;
+ F_Begin_Line : constant Form_Request_Code := Key_Max + 25;
+ F_End_Line : constant Form_Request_Code := Key_Max + 26;
+ F_Left_Char : constant Form_Request_Code := Key_Max + 27;
+ F_Right_Char : constant Form_Request_Code := Key_Max + 28;
+ F_Up_Char : constant Form_Request_Code := Key_Max + 29;
+ F_Down_Char : constant Form_Request_Code := Key_Max + 30;
+
+ F_New_Line : constant Form_Request_Code := Key_Max + 31;
+ F_Insert_Char : constant Form_Request_Code := Key_Max + 32;
+ F_Insert_Line : constant Form_Request_Code := Key_Max + 33;
+ F_Delete_Char : constant Form_Request_Code := Key_Max + 34;
+ F_Delete_Previous : constant Form_Request_Code := Key_Max + 35;
+ F_Delete_Line : constant Form_Request_Code := Key_Max + 36;
+ F_Delete_Word : constant Form_Request_Code := Key_Max + 37;
+ F_Clear_EOL : constant Form_Request_Code := Key_Max + 38;
+ F_Clear_EOF : constant Form_Request_Code := Key_Max + 39;
+ F_Clear_Field : constant Form_Request_Code := Key_Max + 40;
+ F_Overlay_Mode : constant Form_Request_Code := Key_Max + 41;
+ F_Insert_Mode : constant Form_Request_Code := Key_Max + 42;
+
+ -- Vertical Scrolling
+ F_ScrollForward_Line : constant Form_Request_Code := Key_Max + 43;
+ F_ScrollBackward_Line : constant Form_Request_Code := Key_Max + 44;
+ F_ScrollForward_Page : constant Form_Request_Code := Key_Max + 45;
+ F_ScrollBackward_Page : constant Form_Request_Code := Key_Max + 46;
+ F_ScrollForward_HalfPage : constant Form_Request_Code := Key_Max + 47;
+ F_ScrollBackward_HalfPage : constant Form_Request_Code := Key_Max + 48;
+
+ -- Horizontal Scrolling
+ F_HScrollForward_Char : constant Form_Request_Code := Key_Max + 49;
+ F_HScrollBackward_Char : constant Form_Request_Code := Key_Max + 50;
+ F_HScrollForward_Line : constant Form_Request_Code := Key_Max + 51;
+ F_HScrollBackward_Line : constant Form_Request_Code := Key_Max + 52;
+ F_HScrollForward_HalfLine : constant Form_Request_Code := Key_Max + 53;
+ F_HScrollBackward_HalfLine : constant Form_Request_Code := Key_Max + 54;
+
+ F_Validate_Field : constant Form_Request_Code := Key_Max + 55;
+ F_Next_Choice : constant Form_Request_Code := Key_Max + 56;
+ F_Previous_Choice : constant Form_Request_Code := Key_Max + 57;
+
+ -- For those who like the old 'C' style request names
+ REQ_NEXT_PAGE : Form_Request_Code renames F_Next_Page;
+ REQ_PREV_PAGE : Form_Request_Code renames F_Previous_Page;
+ REQ_FIRST_PAGE : Form_Request_Code renames F_First_Page;
+ REQ_LAST_PAGE : Form_Request_Code renames F_Last_Page;
+
+ REQ_NEXT_FIELD : Form_Request_Code renames F_Next_Field;
+ REQ_PREV_FIELD : Form_Request_Code renames F_Previous_Field;
+ REQ_FIRST_FIELD : Form_Request_Code renames F_First_Field;
+ REQ_LAST_FIELD : Form_Request_Code renames F_Last_Field;
+ REQ_SNEXT_FIELD : Form_Request_Code renames F_Sorted_Next_Field;
+ REQ_SPREV_FIELD : Form_Request_Code renames F_Sorted_Previous_Field;
+ REQ_SFIRST_FIELD : Form_Request_Code renames F_Sorted_First_Field;
+ REQ_SLAST_FIELD : Form_Request_Code renames F_Sorted_Last_Field;
+ REQ_LEFT_FIELD : Form_Request_Code renames F_Left_Field;
+ REQ_RIGHT_FIELD : Form_Request_Code renames F_Right_Field;
+ REQ_UP_FIELD : Form_Request_Code renames F_Up_Field;
+ REQ_DOWN_FIELD : Form_Request_Code renames F_Down_Field;
+
+ REQ_NEXT_CHAR : Form_Request_Code renames F_Next_Char;
+ REQ_PREV_CHAR : Form_Request_Code renames F_Previous_Char;
+ REQ_NEXT_LINE : Form_Request_Code renames F_Next_Line;
+ REQ_PREV_LINE : Form_Request_Code renames F_Previous_Line;
+ REQ_NEXT_WORD : Form_Request_Code renames F_Next_Word;
+ REQ_PREV_WORD : Form_Request_Code renames F_Previous_Word;
+ REQ_BEG_FIELD : Form_Request_Code renames F_Begin_Field;
+ REQ_END_FIELD : Form_Request_Code renames F_End_Field;
+ REQ_BEG_LINE : Form_Request_Code renames F_Begin_Line;
+ REQ_END_LINE : Form_Request_Code renames F_End_Line;
+ REQ_LEFT_CHAR : Form_Request_Code renames F_Left_Char;
+ REQ_RIGHT_CHAR : Form_Request_Code renames F_Right_Char;
+ REQ_UP_CHAR : Form_Request_Code renames F_Up_Char;
+ REQ_DOWN_CHAR : Form_Request_Code renames F_Down_Char;
+
+ REQ_NEW_LINE : Form_Request_Code renames F_New_Line;
+ REQ_INS_CHAR : Form_Request_Code renames F_Insert_Char;
+ REQ_INS_LINE : Form_Request_Code renames F_Insert_Line;
+ REQ_DEL_CHAR : Form_Request_Code renames F_Delete_Char;
+ REQ_DEL_PREV : Form_Request_Code renames F_Delete_Previous;
+ REQ_DEL_LINE : Form_Request_Code renames F_Delete_Line;
+ REQ_DEL_WORD : Form_Request_Code renames F_Delete_Word;
+ REQ_CLR_EOL : Form_Request_Code renames F_Clear_EOL;
+ REQ_CLR_EOF : Form_Request_Code renames F_Clear_EOF;
+ REQ_CLR_FIELD : Form_Request_Code renames F_Clear_Field;
+ REQ_OVL_MODE : Form_Request_Code renames F_Overlay_Mode;
+ REQ_INS_MODE : Form_Request_Code renames F_Insert_Mode;
+
+ REQ_SCR_FLINE : Form_Request_Code renames F_ScrollForward_Line;
+ REQ_SCR_BLINE : Form_Request_Code renames F_ScrollBackward_Line;
+ REQ_SCR_FPAGE : Form_Request_Code renames F_ScrollForward_Page;
+ REQ_SCR_BPAGE : Form_Request_Code renames F_ScrollBackward_Page;
+ REQ_SCR_FHPAGE : Form_Request_Code renames F_ScrollForward_HalfPage;
+ REQ_SCR_BHPAGE : Form_Request_Code renames F_ScrollBackward_HalfPage;
+
+ REQ_SCR_FCHAR : Form_Request_Code renames F_HScrollForward_Char;
+ REQ_SCR_BCHAR : Form_Request_Code renames F_HScrollBackward_Char;
+ REQ_SCR_HFLINE : Form_Request_Code renames F_HScrollForward_Line;
+ REQ_SCR_HBLINE : Form_Request_Code renames F_HScrollBackward_Line;
+ REQ_SCR_HFHALF : Form_Request_Code renames F_HScrollForward_HalfLine;
+ REQ_SCR_HBHALF : Form_Request_Code renames F_HScrollBackward_HalfLine;
+
+ REQ_VALIDATION : Form_Request_Code renames F_Validate_Field;
+ REQ_NEXT_CHOICE : Form_Request_Code renames F_Next_Choice;
+ REQ_PREV_CHOICE : Form_Request_Code renames F_Previous_Choice;
+
+ procedure Request_Name (Key : in Form_Request_Code;
+ Name : out String);
+
+ function Request_Name (Key : Form_Request_Code) return String;
+ -- Same as function
+ pragma Inline (Request_Name);
+
+ ------------------
+ -- Exceptions --
+ ------------------
+ Form_Exception : exception;
+
+ -- MANPAGE(`form_field_new.3x')
+
+ -- ANCHOR(`new_field()',`Create')
+ function Create (Height : Line_Count;
+ Width : Column_Count;
+ Top : Line_Position;
+ Left : Column_Position;
+ Off_Screen : Natural := 0;
+ More_Buffers : Buffer_Number := Buffer_Number'First)
+ return Field;
+ -- AKA
+ -- An overloaded Create is defined later. Pragma Inline appears there.
+
+ -- ANCHOR(`new_field()',`New_Field')
+ function New_Field (Height : Line_Count;
+ Width : Column_Count;
+ Top : Line_Position;
+ Left : Column_Position;
+ Off_Screen : Natural := 0;
+ More_Buffers : Buffer_Number := Buffer_Number'First)
+ return Field renames Create;
+ -- AKA
+ pragma Inline (New_Field);
+
+ -- ANCHOR(`free_field()',`Delete')
+ procedure Delete (Fld : in out Field);
+ -- AKA
+ -- Reset Fld to Null_Field
+ -- An overloaded Delete is defined later. Pragma Inline appears there.
+
+ -- ANCHOR(`dup_field()',`Duplicate')
+ function Duplicate (Fld : Field;
+ Top : Line_Position;
+ Left : Column_Position) return Field;
+ -- AKA
+ pragma Inline (Duplicate);
+
+ -- ANCHOR(`link_field()',`Link')
+ function Link (Fld : Field;
+ Top : Line_Position;
+ Left : Column_Position) return Field;
+ -- AKA
+ pragma Inline (Link);
+
+ -- MANPAGE(`form_field_just.3x')
+
+ -- ANCHOR(`set_field_just()',`Set_Justification')
+ procedure Set_Justification (Fld : in Field;
+ Just : in Field_Justification := None);
+ -- AKA
+ pragma Inline (Set_Justification);
+
+ -- ANCHOR(`field_just()',`Get_Justification')
+ function Get_Justification (Fld : Field) return Field_Justification;
+ -- AKA
+ pragma Inline (Get_Justification);
+
+ -- MANPAGE(`form_field_buffer.3x')
+
+ -- ANCHOR(`set_field_buffer()',`Set_Buffer')
+ procedure Set_Buffer
+ (Fld : in Field;
+ Buffer : in Buffer_Number := Buffer_Number'First;
+ Str : in String);
+ -- AKA
+ -- Not inlined
+
+ -- ANCHOR(`field_buffer()',`Get_Buffer')
+ procedure Get_Buffer
+ (Fld : in Field;
+ Buffer : in Buffer_Number := Buffer_Number'First;
+ Str : out String);
+ -- AKA
+
+ function Get_Buffer
+ (Fld : in Field;
+ Buffer : in Buffer_Number := Buffer_Number'First) return String;
+ -- AKA
+ -- Same but as function
+ pragma Inline (Get_Buffer);
+
+ -- ANCHOR(`set_field_status()',`Set_Status')
+ procedure Set_Status (Fld : in Field;
+ Status : in Boolean := True);
+ -- AKA
+ pragma Inline (Set_Status);
+
+ -- ANCHOR(`field_status()',`Changed')
+ function Changed (Fld : Field) return Boolean;
+ -- AKA
+ pragma Inline (Changed);
+
+ -- ANCHOR(`set_field_max()',`Set_Maximum_Size')
+ procedure Set_Maximum_Size (Fld : in Field;
+ Max : in Natural := 0);
+ -- AKA
+ pragma Inline (Set_Maximum_Size);
+
+ -- MANPAGE(`form_field_opts.3x')
+
+ -- ANCHOR(`set_field_opts()',`Set_Options')
+ procedure Set_Options (Fld : in Field;
+ Options : in Field_Option_Set);
+ -- AKA
+ -- An overloaded version is defined later. Pragma Inline appears there
+
+ -- ANCHOR(`field_opts_on()',`Switch_Options')
+ procedure Switch_Options (Fld : in Field;
+ Options : in Field_Option_Set;
+ On : Boolean := True);
+ -- AKA
+ -- ALIAS(`field_opts_off()')
+ -- An overloaded version is defined later. Pragma Inline appears there
+
+ -- ANCHOR(`field_opts()',`Get_Options')
+ procedure Get_Options (Fld : in Field;
+ Options : out Field_Option_Set);
+ -- AKA
+
+ -- ANCHOR(`field_opts()',`Get_Options')
+ function Get_Options (Fld : Field := Null_Field)
+ return Field_Option_Set;
+ -- AKA
+ -- An overloaded version is defined later. Pragma Inline appears there
+
+ -- MANPAGE(`form_field_attributes.3x')
+
+ -- ANCHOR(`set_field_fore()',`Set_Foreground')
+ procedure Set_Foreground
+ (Fld : in Field;
+ Fore : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First);
+ -- AKA
+ pragma Inline (Set_Foreground);
+
+ -- ANCHOR(`field_fore()',`Foreground')
+ procedure Foreground (Fld : in Field;
+ Fore : out Character_Attribute_Set);
+ -- AKA
+
+ -- ANCHOR(`field_fore()',`Foreground')
+ procedure Foreground (Fld : in Field;
+ Fore : out Character_Attribute_Set;
+ Color : out Color_Pair);
+ -- AKA
+ pragma Inline (Foreground);
+
+ -- ANCHOR(`set_field_back()',`Set_Background')
+ procedure Set_Background
+ (Fld : in Field;
+ Back : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First);
+ -- AKA
+ pragma Inline (Set_Background);
+
+ -- ANCHOR(`field_back()',`Background')
+ procedure Background (Fld : in Field;
+ Back : out Character_Attribute_Set);
+ -- AKA
+
+ -- ANCHOR(`field_back()',`Background')
+ procedure Background (Fld : in Field;
+ Back : out Character_Attribute_Set;
+ Color : out Color_Pair);
+ -- AKA
+ pragma Inline (Background);
+
+ -- ANCHOR(`set_field_pad()',`Set_Pad_Character')
+ procedure Set_Pad_Character (Fld : in Field;
+ Pad : in Character := Space);
+ -- AKA
+ pragma Inline (Set_Pad_Character);
+
+ -- ANCHOR(`field_pad()',`Pad_Character')
+ procedure Pad_Character (Fld : in Field;
+ Pad : out Character);
+ -- AKA
+ pragma Inline (Pad_Character);
+
+ -- MANPAGE(`form_field_info.3x')
+
+ -- ANCHOR(`field_info()',`Info')
+ procedure Info (Fld : in Field;
+ Lines : out Line_Count;
+ Columns : out Column_Count;
+ First_Row : out Line_Position;
+ First_Column : out Column_Position;
+ Off_Screen : out Natural;
+ Additional_Buffers : out Buffer_Number);
+ -- AKA
+ pragma Inline (Info);
+
+ -- ANCHOR(`dynamic_field_info()',`Dynamic_Info')
+ procedure Dynamic_Info (Fld : in Field;
+ Lines : out Line_Count;
+ Columns : out Column_Count;
+ Max : out Natural);
+ -- AKA
+ pragma Inline (Dynamic_Info);
+
+ -- MANPAGE(`form_win.3x')
+
+ -- ANCHOR(`set_form_win()',`Set_Window')
+ procedure Set_Window (Frm : in Form;
+ Win : in Window);
+ -- AKA
+ pragma Inline (Set_Window);
+
+ -- ANCHOR(`form_win()',`Get_Window')
+ function Get_Window (Frm : Form) return Window;
+ -- AKA
+ pragma Inline (Get_Window);
+
+ -- ANCHOR(`set_form_sub()',`Set_Sub_Window')
+ procedure Set_Sub_Window (Frm : in Form;
+ Win : in Window);
+ -- AKA
+ pragma Inline (Set_Sub_Window);
+
+ -- ANCHOR(`form_sub()',`Get_Sub_Window')
+ function Get_Sub_Window (Frm : Form) return Window;
+ -- AKA
+ pragma Inline (Get_Sub_Window);
+
+ -- ANCHOR(`scale_form()',`Scale')
+ procedure Scale (Frm : in Form;
+ Lines : out Line_Count;
+ Columns : out Column_Count);
+ -- AKA
+ pragma Inline (Scale);
+
+ -- MANPAGE(`form_hook.3x')
+
+ type Form_Hook_Function is access procedure (Frm : in Form);
+ pragma Convention (C, Form_Hook_Function);
+
+ -- ANCHOR(`set_field_init()',`Set_Field_Init_Hook')
+ procedure Set_Field_Init_Hook (Frm : in Form;
+ Proc : in Form_Hook_Function);
+ -- AKA
+ pragma Inline (Set_Field_Init_Hook);
+
+ -- ANCHOR(`set_field_term()',`Set_Field_Term_Hook')
+ procedure Set_Field_Term_Hook (Frm : in Form;
+ Proc : in Form_Hook_Function);
+ -- AKA
+ pragma Inline (Set_Field_Term_Hook);
+
+ -- ANCHOR(`set_form_init()',`Set_Form_Init_Hook')
+ procedure Set_Form_Init_Hook (Frm : in Form;
+ Proc : in Form_Hook_Function);
+ -- AKA
+ pragma Inline (Set_Form_Init_Hook);
+
+ -- ANCHOR(`set_form_term()',`Set_Form_Term_Hook')
+ procedure Set_Form_Term_Hook (Frm : in Form;
+ Proc : in Form_Hook_Function);
+ -- AKA
+ pragma Inline (Set_Form_Term_Hook);
+
+ -- ANCHOR(`field_init()',`Get_Field_Init_Hook')
+ function Get_Field_Init_Hook (Frm : Form) return Form_Hook_Function;
+ -- AKA
+ pragma Import (C, Get_Field_Init_Hook, "field_init");
+
+ -- ANCHOR(`field_term()',`Get_Field_Term_Hook')
+ function Get_Field_Term_Hook (Frm : Form) return Form_Hook_Function;
+ -- AKA
+ pragma Import (C, Get_Field_Term_Hook, "field_term");
+
+ -- ANCHOR(`form_init()',`Get_Form_Init_Hook')
+ function Get_Form_Init_Hook (Frm : Form) return Form_Hook_Function;
+ -- AKA
+ pragma Import (C, Get_Form_Init_Hook, "form_init");
+
+ -- ANCHOR(`form_term()',`Get_Form_Term_Hook')
+ function Get_Form_Term_Hook (Frm : Form) return Form_Hook_Function;
+ -- AKA
+ pragma Import (C, Get_Form_Term_Hook, "form_term");
+
+ -- MANPAGE(`form_field.3x')
+
+ -- ANCHOR(`set_form_fields()',`Redefine')
+ procedure Redefine (Frm : in Form;
+ Flds : in Field_Array_Access);
+ -- AKA
+ pragma Inline (Redefine);
+
+ -- ANCHOR(`set_form_fields()',`Set_Fields')
+ procedure Set_Fields (Frm : in Form;
+ Flds : in Field_Array_Access) renames Redefine;
+ -- AKA
+ -- pragma Inline (Set_Fields);
+
+ -- ANCHOR(`form_fields()',`Fields')
+ function Fields (Frm : Form;
+ Index : Positive) return Field;
+ -- AKA
+ pragma Inline (Fields);
+
+ -- ANCHOR(`field_count()',`Field_Count')
+ function Field_Count (Frm : Form) return Natural;
+ -- AKA
+ pragma Inline (Field_Count);
+
+ -- ANCHOR(`move_field()',`Move')
+ procedure Move (Fld : in Field;
+ Line : in Line_Position;
+ Column : in Column_Position);
+ -- AKA
+ pragma Inline (Move);
+
+ -- MANPAGE(`form_new.3x')
+
+ -- ANCHOR(`new_form()',`Create')
+ function Create (Fields : Field_Array_Access) return Form;
+ -- AKA
+ pragma Inline (Create);
+
+ -- ANCHOR(`new_form()',`New_Form')
+ function New_Form (Fields : Field_Array_Access) return Form
+ renames Create;
+ -- AKA
+ -- pragma Inline (New_Form);
+
+ -- ANCHOR(`free_form()',`Delete')
+ procedure Delete (Frm : in out Form);
+ -- AKA
+ -- Reset Frm to Null_Form
+ pragma Inline (Delete);
+
+ -- MANPAGE(`form_opts.3x')
+
+ -- ANCHOR(`set_form_opts()',`Set_Options')
+ procedure Set_Options (Frm : in Form;
+ Options : in Form_Option_Set);
+ -- AKA
+ pragma Inline (Set_Options);
+
+ -- ANCHOR(`form_opts_on()',`Switch_Options')
+ procedure Switch_Options (Frm : in Form;
+ Options : in Form_Option_Set;
+ On : Boolean := True);
+ -- AKA
+ -- ALIAS(`form_opts_off()')
+ pragma Inline (Switch_Options);
+
+ -- ANCHOR(`form_opts()',`Get_Options')
+ procedure Get_Options (Frm : in Form;
+ Options : out Form_Option_Set);
+ -- AKA
+
+ -- ANCHOR(`form_opts()',`Get_Options')
+ function Get_Options (Frm : Form := Null_Form) return Form_Option_Set;
+ -- AKA
+ pragma Inline (Get_Options);
+
+ -- MANPAGE(`form_post.3x')
+
+ -- ANCHOR(`post_form()',`Post')
+ procedure Post (Frm : in Form;
+ Post : in Boolean := True);
+ -- AKA
+ -- ALIAS(`unpost_form()')
+ pragma Inline (Post);
+
+ -- MANPAGE(`form_cursor.3x')
+
+ -- ANCHOR(`pos_form_cursor()',`Position_Cursor')
+ procedure Position_Cursor (Frm : Form);
+ -- AKA
+ pragma Inline (Position_Cursor);
+
+ -- MANPAGE(`form_data.3x')
+
+ -- ANCHOR(`data_ahead()',`Data_Ahead')
+ function Data_Ahead (Frm : Form) return Boolean;
+ -- AKA
+ pragma Inline (Data_Ahead);
+
+ -- ANCHOR(`data_behind()',`Data_Behind')
+ function Data_Behind (Frm : Form) return Boolean;
+ -- AKA
+ pragma Inline (Data_Behind);
+
+ -- MANPAGE(`form_driver.3x')
+
+ type Driver_Result is (Form_Ok,
+ Request_Denied,
+ Unknown_Request,
+ Invalid_Field);
+
+ -- ANCHOR(`form_driver()',`Driver')
+ function Driver (Frm : Form;
+ Key : Key_Code) return Driver_Result;
+ -- AKA
+ -- Driver not inlined
+
+ -- MANPAGE(`form_page.3x')
+
+ type Page_Number is new Natural;
+
+ -- ANCHOR(`set_current_field()',`Set_Current')
+ procedure Set_Current (Frm : in Form;
+ Fld : in Field);
+ -- AKA
+ pragma Inline (Set_Current);
+
+ -- ANCHOR(`current_field()',`Current')
+ function Current (Frm : in Form) return Field;
+ -- AKA
+ pragma Inline (Current);
+
+ -- ANCHOR(`set_form_page()',`Set_Page')
+ procedure Set_Page (Frm : in Form;
+ Page : in Page_Number := Page_Number'First);
+ -- AKA
+ pragma Inline (Set_Page);
+
+ -- ANCHOR(`form_page()',`Page')
+ function Page (Frm : Form) return Page_Number;
+ -- AKA
+ pragma Inline (Page);
+
+ -- ANCHOR(`field_index()',`Get_Index')
+ function Get_Index (Fld : Field) return Positive;
+ -- AKA
+ -- Please note that in this binding we start the numbering of fields
+ -- with 1. So this is number is one more than you get from the low
+ -- level call.
+ pragma Inline (Get_Index);
+
+ -- MANPAGE(`form_new_page.3x')
+
+ -- ANCHOR(`set_new_page()',`Set_New_Page')
+ procedure Set_New_Page (Fld : in Field;
+ New_Page : in Boolean := True);
+ -- AKA
+ pragma Inline (Set_New_Page);
+
+ -- ANCHOR(`new_page()',`Is_New_Page')
+ function Is_New_Page (Fld : Field) return Boolean;
+ -- AKA
+ pragma Inline (Is_New_Page);
+
+ -- MANPAGE(`form_requestname.3x')
+ -- Not Implemented: form_request_name, form_request_by_name
+
+------------------------------------------------------------------------------
+private
+ type Field is new System.Storage_Elements.Integer_Address;
+ type Form is new System.Storage_Elements.Integer_Address;
+
+ Null_Field : constant Field := 0;
+ Null_Form : constant Form := 0;
+
+end Terminal_Interface.Curses.Forms;
diff --git a/Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4
new file mode 100644
index 0000000..14b2466
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4
@@ -0,0 +1,75 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-menus-item_user_data__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Menus.Item_User_Data --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998,2006 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.16 $
+-- $Date: 2006/06/25 14:30:22 $
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+
+generic
+ type User is limited private;
+ type User_Access is access User;
+package Terminal_Interface.Curses.Menus.Item_User_Data is
+ pragma Preelaborate (Terminal_Interface.Curses.Menus.Item_User_Data);
+
+ -- The binding uses the same user pointer for menu items
+ -- as the low level C implementation. So you can safely
+ -- read or write the user pointer also with the C routines
+ --
+ -- MANPAGE(`mitem_userptr.3x')
+
+ -- ANCHOR(`set_item_userptr',`Set_User_Data')
+ procedure Set_User_Data (Itm : in Item;
+ Data : in User_Access);
+ -- AKA
+ pragma Inline (Set_User_Data);
+
+ -- ANCHOR(`item_userptr',`Get_User_Data')
+ procedure Get_User_Data (Itm : in Item;
+ Data : out User_Access);
+ -- AKA
+
+ -- ANCHOR(`item_userptr',`Get_User_Data')
+ function Get_User_Data (Itm : in Item) return User_Access;
+ -- AKA
+ -- Same as function
+ pragma Inline (Get_User_Data);
+
+end Terminal_Interface.Curses.Menus.Item_User_Data;
diff --git a/Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4
new file mode 100644
index 0000000..696149b
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4
@@ -0,0 +1,70 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-menus-menu_user_data__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Menus.Menu_User_Data --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.14 $
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+
+generic
+ type User is limited private;
+ type User_Access is access User;
+package Terminal_Interface.Curses.Menus.Menu_User_Data is
+ pragma Preelaborate (Terminal_Interface.Curses.Menus.Menu_User_Data);
+
+ -- MANPAGE(`menu_userptr.3x')
+
+ -- ANCHOR(`set_menu_userptr',`Set_User_Data')
+ procedure Set_User_Data (Men : in Menu;
+ Data : in User_Access);
+ -- AKA
+ pragma Inline (Set_User_Data);
+
+ -- ANCHOR(`menu_userptr',`Get_User_Data')
+ procedure Get_User_Data (Men : in Menu;
+ Data : out User_Access);
+ -- AKA
+
+ -- ANCHOR(`menu_userptr',`Get_User_Data')
+ function Get_User_Data (Men : in Menu) return User_Access;
+ -- AKA
+ -- Same as function
+ pragma Inline (Get_User_Data);
+
+end Terminal_Interface.Curses.Menus.Menu_User_Data;
diff --git a/Ada95/gen/terminal_interface-curses-menus.ads.m4 b/Ada95/gen/terminal_interface-curses-menus.ads.m4
new file mode 100644
index 0000000..17993e1
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-menus.ads.m4
@@ -0,0 +1,604 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-menus__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Menu --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998,2006 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.27 $
+-- $Date: 2007/05/05 20:20:52 $
+-- 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')
+ Space : Character renames Ada.Characters.Latin_1.Space;
+
+ type Item is private;
+ type Menu is private;
+
+ ---------------------------
+ -- Interface constants --
+ ---------------------------
+ Null_Item : constant Item;
+ Null_Menu : constant Menu;
+
+ subtype Menu_Request_Code is Key_Code
+ range (Key_Max + 1) .. (Key_Max + 17);
+
+ -- The prefix M_ stands for "Menu Request"
+ M_Left_Item : constant Menu_Request_Code := Key_Max + 1;
+ M_Right_Item : constant Menu_Request_Code := Key_Max + 2;
+ M_Up_Item : constant Menu_Request_Code := Key_Max + 3;
+ M_Down_Item : constant Menu_Request_Code := Key_Max + 4;
+ M_ScrollUp_Line : constant Menu_Request_Code := Key_Max + 5;
+ M_ScrollDown_Line : constant Menu_Request_Code := Key_Max + 6;
+ M_ScrollDown_Page : constant Menu_Request_Code := Key_Max + 7;
+ M_ScrollUp_Page : constant Menu_Request_Code := Key_Max + 8;
+ M_First_Item : constant Menu_Request_Code := Key_Max + 9;
+ M_Last_Item : constant Menu_Request_Code := Key_Max + 10;
+ M_Next_Item : constant Menu_Request_Code := Key_Max + 11;
+ M_Previous_Item : constant Menu_Request_Code := Key_Max + 12;
+ M_Toggle_Item : constant Menu_Request_Code := Key_Max + 13;
+ M_Clear_Pattern : constant Menu_Request_Code := Key_Max + 14;
+ M_Back_Pattern : constant Menu_Request_Code := Key_Max + 15;
+ M_Next_Match : constant Menu_Request_Code := Key_Max + 16;
+ M_Previous_Match : constant Menu_Request_Code := Key_Max + 17;
+
+ -- For those who like the old 'C' names for the request codes
+ REQ_LEFT_ITEM : Menu_Request_Code renames M_Left_Item;
+ REQ_RIGHT_ITEM : Menu_Request_Code renames M_Right_Item;
+ REQ_UP_ITEM : Menu_Request_Code renames M_Up_Item;
+ REQ_DOWN_ITEM : Menu_Request_Code renames M_Down_Item;
+ REQ_SCR_ULINE : Menu_Request_Code renames M_ScrollUp_Line;
+ REQ_SCR_DLINE : Menu_Request_Code renames M_ScrollDown_Line;
+ REQ_SCR_DPAGE : Menu_Request_Code renames M_ScrollDown_Page;
+ REQ_SCR_UPAGE : Menu_Request_Code renames M_ScrollUp_Page;
+ REQ_FIRST_ITEM : Menu_Request_Code renames M_First_Item;
+ REQ_LAST_ITEM : Menu_Request_Code renames M_Last_Item;
+ REQ_NEXT_ITEM : Menu_Request_Code renames M_Next_Item;
+ REQ_PREV_ITEM : Menu_Request_Code renames M_Previous_Item;
+ REQ_TOGGLE_ITEM : Menu_Request_Code renames M_Toggle_Item;
+ REQ_CLEAR_PATTERN : Menu_Request_Code renames M_Clear_Pattern;
+ REQ_BACK_PATTERN : Menu_Request_Code renames M_Back_Pattern;
+ REQ_NEXT_MATCH : Menu_Request_Code renames M_Next_Match;
+ REQ_PREV_MATCH : Menu_Request_Code renames M_Previous_Match;
+
+ procedure Request_Name (Key : in Menu_Request_Code;
+ Name : out String);
+
+ function Request_Name (Key : Menu_Request_Code) return String;
+ -- Same as function
+
+ ------------------
+ -- Exceptions --
+ ------------------
+
+ Menu_Exception : exception;
+ --
+ -- Menu options
+ --
+ pragma Warnings (Off);
+include(`Menu_Opt_Rep')dnl
+
+ pragma Warnings (On);
+
+ function Default_Menu_Options return Menu_Option_Set;
+ -- Initial default options for a menu.
+ pragma Inline (Default_Menu_Options);
+ --
+ -- Item options
+ --
+ pragma Warnings (Off);
+include(`Item_Rep')dnl
+
+ pragma Warnings (On);
+
+ function Default_Item_Options return Item_Option_Set;
+ -- Initial default options for an item.
+ pragma Inline (Default_Item_Options);
+
+ --
+ -- Item Array
+ --
+ type Item_Array is array (Positive range <>) of aliased Item;
+ pragma Convention (C, Item_Array);
+
+ type Item_Array_Access is access Item_Array;
+
+ procedure Free (IA : in out Item_Array_Access;
+ Free_Items : Boolean := False);
+ -- Release the memory for an allocated item array
+ -- If Free_Items is True, call Delete() for all the items in
+ -- the array.
+
+ -- MANPAGE(`mitem_new.3x')
+
+ -- ANCHOR(`new_item()',`Create')
+ function Create (Name : String;
+ Description : String := "") return Item;
+ -- AKA
+ -- Not inlined.
+
+ -- ANCHOR(`new_item()',`New_Item')
+ function New_Item (Name : String;
+ Description : String := "") return Item
+ renames Create;
+ -- AKA
+
+ -- ANCHOR(`free_item()',`Delete')
+ procedure Delete (Itm : in out Item);
+ -- AKA
+ -- Resets Itm to Null_Item
+
+ -- MANPAGE(`mitem_value.3x')
+
+ -- ANCHOR(`set_item_value()',`Set_Value')
+ procedure Set_Value (Itm : in Item;
+ Value : in Boolean := True);
+ -- AKA
+ pragma Inline (Set_Value);
+
+ -- ANCHOR(`item_value()',`Value')
+ function Value (Itm : Item) return Boolean;
+ -- AKA
+ pragma Inline (Value);
+
+ -- MANPAGE(`mitem_visible.3x')
+
+ -- ANCHOR(`item_visible()',`Visible')
+ function Visible (Itm : Item) return Boolean;
+ -- AKA
+ pragma Inline (Visible);
+
+ -- MANPAGE(`mitem_opts.3x')
+
+ -- ANCHOR(`set_item_opts()',`Set_Options')
+ procedure Set_Options (Itm : in Item;
+ Options : in Item_Option_Set);
+ -- AKA
+ -- An overloaded Set_Options is defined later. Pragma Inline appears there
+
+ -- ANCHOR(`item_opts_on()',`Switch_Options')
+ procedure Switch_Options (Itm : in Item;
+ Options : in Item_Option_Set;
+ On : Boolean := True);
+ -- AKA
+ -- ALIAS(`item_opts_off()')
+ -- An overloaded Switch_Options is defined later.
+ -- Pragma Inline appears there
+
+ -- ANCHOR(`item_opts()',`Get_Options')
+ procedure Get_Options (Itm : in Item;
+ Options : out Item_Option_Set);
+ -- AKA
+
+ -- ANCHOR(`item_opts()',`Get_Options')
+ function Get_Options (Itm : Item := Null_Item) return Item_Option_Set;
+ -- AKA
+ -- An overloaded Get_Options is defined later. Pragma Inline appears there
+
+ -- MANPAGE(`mitem_name.3x')
+
+ -- ANCHOR(`item_name()',`Name')
+ procedure Name (Itm : in Item;
+ Name : out String);
+ -- AKA
+ function Name (Itm : Item) return String;
+ -- AKA
+ -- Implemented as function
+ pragma Inline (Name);
+
+ -- ANCHOR(`item_description();',`Description')
+ procedure Description (Itm : in Item;
+ Description : out String);
+ -- AKA
+
+ function Description (Itm : Item) return String;
+ -- AKA
+ -- Implemented as function
+ pragma Inline (Description);
+
+ -- MANPAGE(`mitem_current.3x')
+
+ -- ANCHOR(`set_current_item()',`Set_Current')
+ procedure Set_Current (Men : in Menu;
+ Itm : in Item);
+ -- AKA
+ pragma Inline (Set_Current);
+
+ -- ANCHOR(`current_item()',`Current')
+ function Current (Men : Menu) return Item;
+ -- AKA
+ pragma Inline (Current);
+
+ -- ANCHOR(`set_top_row()',`Set_Top_Row')
+ procedure Set_Top_Row (Men : in Menu;
+ Line : in Line_Position);
+ -- AKA
+ pragma Inline (Set_Top_Row);
+
+ -- ANCHOR(`top_row()',`Top_Row')
+ function Top_Row (Men : Menu) return Line_Position;
+ -- AKA
+ pragma Inline (Top_Row);
+
+ -- ANCHOR(`item_index()',`Get_Index')
+ function Get_Index (Itm : Item) return Positive;
+ -- AKA
+ -- Please note that in this binding we start the numbering of items
+ -- with 1. So this is number is one more than you get from the low
+ -- level call.
+ pragma Inline (Get_Index);
+
+ -- MANPAGE(`menu_post.3x')
+
+ -- ANCHOR(`post_menu()',`Post')
+ procedure Post (Men : in Menu;
+ Post : in Boolean := True);
+ -- AKA
+ -- ALIAS(`unpost_menu()')
+ pragma Inline (Post);
+
+ -- MANPAGE(`menu_opts.3x')
+
+ -- ANCHOR(`set_menu_opts()',`Set_Options')
+ procedure Set_Options (Men : in Menu;
+ Options : in Menu_Option_Set);
+ -- AKA
+ pragma Inline (Set_Options);
+
+ -- ANCHOR(`menu_opts_on()',`Switch_Options')
+ procedure Switch_Options (Men : in Menu;
+ Options : in Menu_Option_Set;
+ On : Boolean := True);
+ -- AKA
+ -- ALIAS(`menu_opts_off()')
+ pragma Inline (Switch_Options);
+
+ -- ANCHOR(`menu_opts()',`Get_Options')
+ procedure Get_Options (Men : in Menu;
+ Options : out Menu_Option_Set);
+ -- AKA
+
+ -- ANCHOR(`menu_opts()',`Get_Options')
+ function Get_Options (Men : Menu := Null_Menu) return Menu_Option_Set;
+ -- AKA
+ pragma Inline (Get_Options);
+
+ -- MANPAGE(`menu_win.3x')
+
+ -- ANCHOR(`set_menu_win()',`Set_Window')
+ procedure Set_Window (Men : in Menu;
+ Win : in Window);
+ -- AKA
+ pragma Inline (Set_Window);
+
+ -- ANCHOR(`menu_win()',`Get_Window')
+ function Get_Window (Men : Menu) return Window;
+ -- AKA
+ pragma Inline (Get_Window);
+
+ -- ANCHOR(`set_menu_sub()',`Set_Sub_Window')
+ procedure Set_Sub_Window (Men : in Menu;
+ Win : in Window);
+ -- AKA
+ pragma Inline (Set_Sub_Window);
+
+ -- ANCHOR(`menu_sub()',`Get_Sub_Window')
+ function Get_Sub_Window (Men : Menu) return Window;
+ -- AKA
+ pragma Inline (Get_Sub_Window);
+
+ -- ANCHOR(`scale_menu()',`Scale')
+ procedure Scale (Men : in Menu;
+ Lines : out Line_Count;
+ Columns : out Column_Count);
+ -- AKA
+ pragma Inline (Scale);
+
+ -- MANPAGE(`menu_cursor.3x')
+
+ -- ANCHOR(`pos_menu_cursor()',`Position_Cursor')
+ procedure Position_Cursor (Men : Menu);
+ -- AKA
+ pragma Inline (Position_Cursor);
+
+ -- MANPAGE(`menu_mark.3x')
+
+ -- ANCHOR(`set_menu_mark()',`Set_Mark')
+ procedure Set_Mark (Men : in Menu;
+ Mark : in String);
+ -- AKA
+ pragma Inline (Set_Mark);
+
+ -- ANCHOR(`menu_mark()',`Mark')
+ procedure Mark (Men : in Menu;
+ Mark : out String);
+ -- AKA
+
+ function Mark (Men : Menu) return String;
+ -- AKA
+ -- Implemented as function
+ pragma Inline (Mark);
+
+ -- MANPAGE(`menu_attributes.3x')
+
+ -- ANCHOR(`set_menu_fore()',`Set_Foreground')
+ procedure Set_Foreground
+ (Men : in Menu;
+ Fore : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First);
+ -- AKA
+ pragma Inline (Set_Foreground);
+
+ -- ANCHOR(`menu_fore()',`Foreground')
+ procedure Foreground (Men : in Menu;
+ Fore : out Character_Attribute_Set);
+ -- AKA
+
+ -- ANCHOR(`menu_fore()',`Foreground')
+ procedure Foreground (Men : in Menu;
+ Fore : out Character_Attribute_Set;
+ Color : out Color_Pair);
+ -- AKA
+ pragma Inline (Foreground);
+
+ -- ANCHOR(`set_menu_back()',`Set_Background')
+ procedure Set_Background
+ (Men : in Menu;
+ Back : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First);
+ -- AKA
+ pragma Inline (Set_Background);
+
+ -- ANCHOR(`menu_back()',`Background')
+ procedure Background (Men : in Menu;
+ Back : out Character_Attribute_Set);
+ -- AKA
+ -- ANCHOR(`menu_back()',`Background')
+
+ procedure Background (Men : in Menu;
+ Back : out Character_Attribute_Set;
+ Color : out Color_Pair);
+ -- AKA
+ pragma Inline (Background);
+
+ -- ANCHOR(`set_menu_grey()',`Set_Grey')
+ procedure Set_Grey
+ (Men : in Menu;
+ Grey : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First);
+ -- AKA
+ pragma Inline (Set_Grey);
+
+ -- ANCHOR(`menu_grey()',`Grey')
+ procedure Grey (Men : in Menu;
+ Grey : out Character_Attribute_Set);
+ -- AKA
+
+ -- ANCHOR(`menu_grey()',`Grey')
+ procedure Grey
+ (Men : in Menu;
+ Grey : out Character_Attribute_Set;
+ Color : out Color_Pair);
+ -- AKA
+ pragma Inline (Grey);
+
+ -- ANCHOR(`set_menu_pad()',`Set_Pad_Character')
+ procedure Set_Pad_Character (Men : in Menu;
+ Pad : in Character := Space);
+ -- AKA
+ pragma Inline (Set_Pad_Character);
+
+ -- ANCHOR(`menu_pad()',`Pad_Character')
+ procedure Pad_Character (Men : in Menu;
+ Pad : out Character);
+ -- AKA
+ pragma Inline (Pad_Character);
+
+ -- MANPAGE(`menu_spacing.3x')
+
+ -- ANCHOR(`set_menu_spacing()',`Set_Spacing')
+ procedure Set_Spacing (Men : in Menu;
+ Descr : in Column_Position := 0;
+ Row : in Line_Position := 0;
+ Col : in Column_Position := 0);
+ -- AKA
+ pragma Inline (Set_Spacing);
+
+ -- ANCHOR(`menu_spacing()',`Spacing')
+ procedure Spacing (Men : in Menu;
+ Descr : out Column_Position;
+ Row : out Line_Position;
+ Col : out Column_Position);
+ -- AKA
+ pragma Inline (Spacing);
+
+ -- MANPAGE(`menu_pattern.3x')
+
+ -- ANCHOR(`set_menu_pattern()',`Set_Pattern')
+ function Set_Pattern (Men : Menu;
+ Text : String) return Boolean;
+ -- AKA
+ -- Return TRUE if the pattern matches, FALSE otherwise
+ pragma Inline (Set_Pattern);
+
+ -- ANCHOR(`menu_pattern()',`Pattern')
+ procedure Pattern (Men : in Menu;
+ Text : out String);
+ -- AKA
+ pragma Inline (Pattern);
+
+ -- MANPAGE(`menu_format.3x')
+
+ -- ANCHOR(`set_menu_format()',`Set_Format')
+ procedure Set_Format (Men : in Menu;
+ Lines : in Line_Count;
+ Columns : in Column_Count);
+ -- Not implemented: 0 argument for Lines or Columns;
+ -- instead use Format to get the current sizes
+ -- The default format is 16 rows, 1 column. Calling
+ -- set_menu_format with a null menu pointer will change this
+ -- default. A zero row or column argument to set_menu_format
+ -- is interpreted as a request not to change the current
+ -- value.
+ -- AKA
+ pragma Inline (Set_Format);
+
+ -- ANCHOR(`menu_format()',`Format')
+ procedure Format (Men : in Menu;
+ Lines : out Line_Count;
+ Columns : out Column_Count);
+ -- AKA
+ pragma Inline (Format);
+
+ -- MANPAGE(`menu_hook.3x')
+
+ type Menu_Hook_Function is access procedure (Men : in Menu);
+ pragma Convention (C, Menu_Hook_Function);
+
+ -- ANCHOR(`set_item_init()',`Set_Item_Init_Hook')
+ procedure Set_Item_Init_Hook (Men : in Menu;
+ Proc : in Menu_Hook_Function);
+ -- AKA
+ pragma Inline (Set_Item_Init_Hook);
+
+ -- ANCHOR(`set_item_term()',`Set_Item_Term_Hook')
+ procedure Set_Item_Term_Hook (Men : in Menu;
+ Proc : in Menu_Hook_Function);
+ -- AKA
+ pragma Inline (Set_Item_Term_Hook);
+
+ -- ANCHOR(`set_menu_init()',`Set_Menu_Init_Hook')
+ procedure Set_Menu_Init_Hook (Men : in Menu;
+ Proc : in Menu_Hook_Function);
+ -- AKA
+ pragma Inline (Set_Menu_Init_Hook);
+
+ -- ANCHOR(`set_menu_term()',`Set_Menu_Term_Hook')
+ procedure Set_Menu_Term_Hook (Men : in Menu;
+ Proc : in Menu_Hook_Function);
+ -- AKA
+ pragma Inline (Set_Menu_Term_Hook);
+
+ -- ANCHOR(`item_init()',`Get_Item_Init_Hook')
+ function Get_Item_Init_Hook (Men : Menu) return Menu_Hook_Function;
+ -- AKA
+ pragma Inline (Get_Item_Init_Hook);
+
+ -- ANCHOR(`item_term()',`Get_Item_Term_Hook')
+ function Get_Item_Term_Hook (Men : Menu) return Menu_Hook_Function;
+ -- AKA
+ pragma Inline (Get_Item_Term_Hook);
+
+ -- ANCHOR(`menu_init()',`Get_Menu_Init_Hook')
+ function Get_Menu_Init_Hook (Men : Menu) return Menu_Hook_Function;
+ -- AKA
+ pragma Inline (Get_Menu_Init_Hook);
+
+ -- ANCHOR(`menu_term()',`Get_Menu_Term_Hook')
+ function Get_Menu_Term_Hook (Men : Menu) return Menu_Hook_Function;
+ -- AKA
+ pragma Inline (Get_Menu_Term_Hook);
+
+ -- MANPAGE(`menu_items.3x')
+
+ -- ANCHOR(`set_menu_items()',`Redefine')
+ procedure Redefine (Men : in Menu;
+ Items : in Item_Array_Access);
+ -- AKA
+ pragma Inline (Redefine);
+
+ procedure Set_Items (Men : in Menu;
+ Items : in Item_Array_Access) renames Redefine;
+ -- pragma Inline (Set_Items);
+
+ -- ANCHOR(`menu_items()',`Items')
+ function Items (Men : Menu;
+ Index : Positive) return Item;
+ -- AKA
+ pragma Inline (Items);
+
+ -- ANCHOR(`item_count()',`Item_Count')
+ function Item_Count (Men : Menu) return Natural;
+ -- AKA
+ pragma Inline (Item_Count);
+
+ -- MANPAGE(`menu_new.3x')
+
+ -- ANCHOR(`new_menu()',`Create')
+ function Create (Items : Item_Array_Access) return Menu;
+ -- AKA
+ -- Not inlined
+
+ function New_Menu (Items : Item_Array_Access) return Menu renames Create;
+
+ -- ANCHOR(`free_menu()',`Delete')
+ procedure Delete (Men : in out Menu);
+ -- AKA
+ -- Reset Men to Null_Menu
+ -- Not inlined
+
+ -- MANPAGE(`menu_driver.3x')
+
+ type Driver_Result is (Menu_Ok,
+ Request_Denied,
+ Unknown_Request,
+ No_Match);
+
+ -- ANCHOR(`menu_driver()',`Driver')
+ function Driver (Men : Menu;
+ Key : Key_Code) return Driver_Result;
+ -- AKA
+ -- Driver is not inlined
+
+ -- ANCHOR(`menu_requestname.3x')
+ -- Not Implemented: menu_request_name, menu_request_by_name
+-------------------------------------------------------------------------------
+private
+ type Item is new System.Storage_Elements.Integer_Address;
+ type Menu is new System.Storage_Elements.Integer_Address;
+
+ Null_Item : constant Item := 0;
+ Null_Menu : constant Menu := 0;
+
+end Terminal_Interface.Curses.Menus;
diff --git a/Ada95/gen/terminal_interface-curses-mouse.ads.m4 b/Ada95/gen/terminal_interface-curses-mouse.ads.m4
new file mode 100644
index 0000000..b59ebbf
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-mouse.ads.m4
@@ -0,0 +1,182 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-mouse__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Mouse --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998-2004,2006 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.27 $
+-- $Date: 2006/06/25 14:30:22 $
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+include(`Mouse_Base_Defs')
+with System;
+
+package Terminal_Interface.Curses.Mouse is
+ pragma Preelaborate (Terminal_Interface.Curses.Mouse);
+
+ -- MANPAGE(`curs_mouse.3x')
+ -- Please note, that in ncurses-1.9.9e documentation mouse support
+ -- is still marked as experimental. So also this binding will change
+ -- if the ncurses methods change.
+ --
+ -- mouse_trafo, wmouse_trafo are implemented as Transform_Coordinates
+ -- in the parent package.
+ --
+ -- Not implemented:
+ -- REPORT_MOUSE_POSITION (i.e. as a parameter to Register_Reportable_Event
+ -- or Start_Mouse)
+ type Event_Mask is private;
+ No_Events : constant Event_Mask;
+ All_Events : constant Event_Mask;
+
+ type Mouse_Button is (Left, -- aka: Button 1
+ Middle, -- aka: Button 2
+ Right, -- aka: Button 3
+ Button4, -- aka: Button 4
+ Control, -- Control Key
+ Shift, -- Shift Key
+ Alt); -- ALT Key
+
+ subtype Real_Buttons is Mouse_Button range Left .. Button4;
+ subtype Modifier_Keys is Mouse_Button range Control .. Alt;
+
+ type Button_State is (Released,
+ Pressed,
+ Clicked,
+ Double_Clicked,
+ Triple_Clicked);
+
+ type Button_States is array (Button_State) of Boolean;
+ pragma Pack (Button_States);
+
+ All_Clicks : constant Button_States := (Clicked .. Triple_Clicked => True,
+ others => False);
+ All_States : constant Button_States := (others => True);
+
+ type Mouse_Event is private;
+
+ -- MANPAGE(`curs_mouse.3x')
+
+ function Has_Mouse return Boolean;
+ -- Return true if a mouse device is supported, false otherwise.
+
+ procedure Register_Reportable_Event
+ (Button : in Mouse_Button;
+ State : in Button_State;
+ Mask : in out Event_Mask);
+ -- Stores the event described by the button and the state in the mask.
+ -- Before you call this the first time, you should init the mask
+ -- with the Empty_Mask constant
+ pragma Inline (Register_Reportable_Event);
+
+ procedure Register_Reportable_Events
+ (Button : in Mouse_Button;
+ State : in Button_States;
+ Mask : in out Event_Mask);
+ -- Register all events described by the Button and the State bitmap.
+ -- Before you call this the first time, you should init the mask
+ -- with the Empty_Mask constant
+
+ -- ANCHOR(`mousemask()',`Start_Mouse')
+ -- There is one difference to mousmask(): we return the value of the
+ -- old mask, that means the event mask value before this call.
+ -- Not Implemented: The library version
+ -- returns a Mouse_Mask that tells which events are reported.
+ function Start_Mouse (Mask : Event_Mask := All_Events)
+ return Event_Mask;
+ -- AKA
+ pragma Inline (Start_Mouse);
+
+ procedure End_Mouse (Mask : in Event_Mask := No_Events);
+ -- Terminates the mouse, restores the specified event mask
+ pragma Inline (End_Mouse);
+
+ -- ANCHOR(`getmouse()',`Get_Mouse')
+ function Get_Mouse return Mouse_Event;
+ -- AKA
+ pragma Inline (Get_Mouse);
+
+ procedure Get_Event (Event : in Mouse_Event;
+ Y : out Line_Position;
+ X : out Column_Position;
+ Button : out Mouse_Button;
+ State : out Button_State);
+ -- !!! Warning: X and Y are screen coordinates. Due to ripped of lines they
+ -- may not be identical to window coordinates.
+ -- Not Implemented: Get_Event only reports one event, the C library
+ -- version supports multiple events, e.g. {click-1, click-3}
+ pragma Inline (Get_Event);
+
+ -- ANCHOR(`ungetmouse()',`Unget_Mouse')
+ procedure Unget_Mouse (Event : in Mouse_Event);
+ -- AKA
+ pragma Inline (Unget_Mouse);
+
+ -- ANCHOR(`wenclose()',`Enclosed_In_Window')
+ function Enclosed_In_Window (Win : Window := Standard_Window;
+ Event : Mouse_Event) return Boolean;
+ -- AKA
+ -- But : use event instead of screen coordinates.
+ pragma Inline (Enclosed_In_Window);
+
+ -- ANCHOR(`mouseinterval()',`Mouse_Interval')
+ function Mouse_Interval (Msec : Natural := 200) return Natural;
+ -- AKA
+ pragma Inline (Mouse_Interval);
+
+private
+ type Event_Mask is new Interfaces.C.unsigned_long;
+
+ type Mouse_Event is
+ record
+ Id : Integer range Integer (Interfaces.C.short'First) ..
+ Integer (Interfaces.C.short'Last);
+ X, Y, Z : Integer range Integer (Interfaces.C.int'First) ..
+ Integer (Interfaces.C.int'Last);
+ Bstate : Event_Mask;
+ 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;
+
+end Terminal_Interface.Curses.Mouse;
diff --git a/Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4
new file mode 100644
index 0000000..e6def9b
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4
@@ -0,0 +1,70 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-panels-user_data__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Panels.User_Data --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.14 $
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+
+generic
+ type User is limited private;
+ type User_Access is access all User;
+package Terminal_Interface.Curses.Panels.User_Data is
+ pragma Preelaborate (Terminal_Interface.Curses.Panels.User_Data);
+
+ -- MANPAGE(`panel.3x')
+
+ -- ANCHOR(`set_panel_userptr',`Set_User_Data')
+ procedure Set_User_Data (Pan : in Panel;
+ Data : in User_Access);
+ -- AKA
+ pragma Inline (Set_User_Data);
+
+ -- ANCHOR(`panel_userptr',`Get_User_Data')
+ procedure Get_User_Data (Pan : in Panel;
+ Data : out User_Access);
+ -- AKA
+
+ -- ANCHOR(`panel_userptr',`Get_User_Data')
+ function Get_User_Data (Pan : in Panel) return User_Access;
+ -- AKA
+ -- Same as function
+ pragma Inline (Get_User_Data);
+
+end Terminal_Interface.Curses.Panels.User_Data;
diff --git a/Ada95/gen/terminal_interface-curses-panels.ads.m4 b/Ada95/gen/terminal_interface-curses-panels.ads.m4
new file mode 100644
index 0000000..39b7260
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-panels.ads.m4
@@ -0,0 +1,147 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-panels__ads.htm')dnl
+include(M4MACRO)dnl
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Panels --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998,2006 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.19 $
+-- $Date: 2006/06/25 14:30:22 $
+-- 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')
+ type Panel is private;
+
+ ---------------------------
+ -- Interface constants --
+ ---------------------------
+ Null_Panel : constant Panel;
+
+ -------------------
+ -- Exceptions --
+ -------------------
+
+ Panel_Exception : exception;
+
+ -- MANPAGE(`panel.3x')
+
+ -- ANCHOR(`new_panel()',`Create')
+ function Create (Win : Window) return Panel;
+ -- AKA
+ pragma Inline (Create);
+
+ -- ANCHOR(`new_panel()',`New_Panel')
+ function New_Panel (Win : Window) return Panel renames Create;
+ -- AKA
+ -- pragma Inline (New_Panel);
+
+ -- ANCHOR(`bottom_panel()',`Bottom')
+ procedure Bottom (Pan : in Panel);
+ -- AKA
+ pragma Inline (Bottom);
+
+ -- ANCHOR(`top_panel()',`Top')
+ procedure Top (Pan : in Panel);
+ -- AKA
+ pragma Inline (Top);
+
+ -- ANCHOR(`show_panel()',`Show')
+ procedure Show (Pan : in Panel);
+ -- AKA
+ pragma Inline (Show);
+
+ -- ANCHOR(`update_panels()',`Update_Panels')
+ procedure Update_Panels;
+ -- AKA
+ pragma Import (C, Update_Panels, "update_panels");
+
+ -- ANCHOR(`hide_panel()',`Hide')
+ procedure Hide (Pan : in Panel);
+ -- AKA
+ pragma Inline (Hide);
+
+ -- ANCHOR(`panel_window()',`Get_Window')
+ function Get_Window (Pan : Panel) return Window;
+ -- AKA
+ pragma Inline (Get_Window);
+
+ -- ANCHOR(`panel_window()',`Panel_Window')
+ function Panel_Window (Pan : Panel) return Window renames Get_Window;
+ -- pragma Inline (Panel_Window);
+
+ -- ANCHOR(`replace_panel()',`Replace')
+ procedure Replace (Pan : in Panel;
+ Win : in Window);
+ -- AKA
+ pragma Inline (Replace);
+
+ -- ANCHOR(`move_panel()',`Move')
+ procedure Move (Pan : in Panel;
+ Line : in Line_Position;
+ Column : in Column_Position);
+ -- AKA
+ pragma Inline (Move);
+
+ -- ANCHOR(`panel_hidden()',`Is_Hidden')
+ function Is_Hidden (Pan : Panel) return Boolean;
+ -- AKA
+ pragma Inline (Is_Hidden);
+
+ -- ANCHOR(`panel_above()',`Above')
+ function Above (Pan : Panel) return Panel;
+ -- AKA
+ pragma Import (C, Above, "panel_above");
+
+ -- ANCHOR(`panel_below()',`Below')
+ function Below (Pan : Panel) return Panel;
+ -- AKA
+ pragma Import (C, Below, "panel_below");
+
+ -- ANCHOR(`del_panel()',`Delete')
+ procedure Delete (Pan : in out Panel);
+ -- AKA
+ pragma Inline (Delete);
+
+private
+ type Panel is new System.Storage_Elements.Integer_Address;
+ Null_Panel : constant Panel := 0;
+
+end Terminal_Interface.Curses.Panels;
diff --git a/Ada95/gen/terminal_interface-curses-trace.ads.m4 b/Ada95/gen/terminal_interface-curses-trace.ads.m4
new file mode 100644
index 0000000..546004f
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses-trace.ads.m4
@@ -0,0 +1,78 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses-trace__ads.htm')dnl
+include(M4MACRO)------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Trace --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 2000 Free Software Foundation, Inc. --
+-- --
+-- Permission is hereby granted, free of charge, to any person obtaining a --
+-- copy of this software and associated documentation files (the --
+-- "Software"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000
+-- Version Control:
+-- $Revision: 1.1 $
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+
+package Terminal_Interface.Curses.Trace is
+ pragma Preelaborate (Terminal_Interface.Curses.Trace);
+
+ pragma Warnings (Off);
+include(`Trace_Defs')
+
+ pragma Warnings (On);
+
+ Trace_Disable : constant Trace_Attribute_Set := (others => False);
+
+ Trace_Ordinary : constant Trace_Attribute_Set :=
+ (Times => True,
+ Tputs => True,
+ Update => True,
+ Cursor_Move => True,
+ Character_Output => True,
+ others => False);
+ Trace_Maximum : constant Trace_Attribute_Set := (others => True);
+
+------------------------------------------------------------------------------
+
+ -- MANPAGE(`curs_trace.3x')
+
+ -- ANCHOR(`trace()',`Trace_on')
+ procedure Trace_On (x : Trace_Attribute_Set);
+ -- The debugging library has trace.
+
+ -- ANCHOR(`_tracef()',`Trace_Put')
+ procedure Trace_Put (str : String);
+ -- AKA
+
+ Current_Trace_Setting : Trace_Attribute_Set;
+ pragma Import (C, Current_Trace_Setting, "_nc_tracing");
+
+end Terminal_Interface.Curses.Trace;
diff --git a/Ada95/gen/terminal_interface-curses.adb.m4 b/Ada95/gen/terminal_interface-curses.adb.m4
new file mode 100644
index 0000000..75ddb96
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses.adb.m4
@@ -0,0 +1,2502 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses__adb.htm')dnl
+include(M4MACRO)------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998-2007,2008 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.5 $
+-- $Date: 2008/07/26 18:46:32 $
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with System;
+
+with Terminal_Interface.Curses.Aux;
+with Interfaces.C; use Interfaces.C;
+with Interfaces.C.Strings; use Interfaces.C.Strings;
+with Ada.Characters.Handling; use Ada.Characters.Handling;
+with Ada.Strings.Fixed;
+
+package body Terminal_Interface.Curses is
+
+ use Aux;
+ use type System.Bit_Order;
+
+ package ASF renames Ada.Strings.Fixed;
+
+ type chtype_array is array (size_t range <>)
+ of aliased Attributed_Character;
+ pragma Convention (C, chtype_array);
+
+------------------------------------------------------------------------------
+ function Key_Name (Key : in Real_Key_Code) return String
+ is
+ function Keyname (K : C_Int) return chars_ptr;
+ pragma Import (C, Keyname, "keyname");
+
+ Ch : Character;
+ begin
+ if Key <= Character'Pos (Character'Last) then
+ Ch := Character'Val (Key);
+ if Is_Control (Ch) then
+ return Un_Control (Attributed_Character'(Ch => Ch,
+ Color => Color_Pair'First,
+ Attr => Normal_Video));
+ elsif Is_Graphic (Ch) then
+ declare
+ S : String (1 .. 1);
+ begin
+ S (1) := Ch;
+ return S;
+ end;
+ else
+ return "";
+ end if;
+ else
+ return Fill_String (Keyname (C_Int (Key)));
+ end if;
+ end Key_Name;
+
+ procedure Key_Name (Key : in Real_Key_Code;
+ Name : out String)
+ is
+ begin
+ ASF.Move (Key_Name (Key), Name);
+ end Key_Name;
+
+------------------------------------------------------------------------------
+ procedure Init_Screen
+ is
+ function Initscr return Window;
+ pragma Import (C, Initscr, "initscr");
+
+ W : Window;
+ begin
+ W := Initscr;
+ if W = Null_Window then
+ raise Curses_Exception;
+ end if;
+ end Init_Screen;
+
+ procedure End_Windows
+ is
+ function Endwin return C_Int;
+ pragma Import (C, Endwin, "endwin");
+ begin
+ if Endwin = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end End_Windows;
+
+ function Is_End_Window return Boolean
+ is
+ function Isendwin return Curses_Bool;
+ pragma Import (C, Isendwin, "isendwin");
+ begin
+ if Isendwin = Curses_Bool_False then
+ return False;
+ else
+ return True;
+ end if;
+ end Is_End_Window;
+------------------------------------------------------------------------------
+ procedure Move_Cursor (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position)
+ is
+ function Wmove (Win : Window;
+ Line : C_Int;
+ Column : C_Int
+ ) return C_Int;
+ pragma Import (C, Wmove, "wmove");
+ begin
+ if Wmove (Win, C_Int (Line), C_Int (Column)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Move_Cursor;
+------------------------------------------------------------------------------
+ procedure Add (Win : in Window := Standard_Window;
+ Ch : in Attributed_Character)
+ is
+ function Waddch (W : Window;
+ Ch : C_Chtype) return C_Int;
+ pragma Import (C, Waddch, "waddch");
+ begin
+ if Waddch (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Add;
+
+ procedure Add (Win : in Window := Standard_Window;
+ Ch : in Character)
+ is
+ begin
+ Add (Win,
+ Attributed_Character'(Ch => Ch,
+ Color => Color_Pair'First,
+ Attr => Normal_Video));
+ end Add;
+
+ procedure Add
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Ch : in Attributed_Character)
+ is
+ function mvwaddch (W : Window;
+ Y : C_Int;
+ X : C_Int;
+ Ch : C_Chtype) 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
+ raise Curses_Exception;
+ end if;
+ end Add;
+
+ procedure Add
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Ch : in Character)
+ is
+ begin
+ Add (Win,
+ Line,
+ Column,
+ Attributed_Character'(Ch => Ch,
+ Color => Color_Pair'First,
+ Attr => Normal_Video));
+ end Add;
+
+ procedure Add_With_Immediate_Echo
+ (Win : in Window := Standard_Window;
+ Ch : in Attributed_Character)
+ is
+ function Wechochar (W : Window;
+ Ch : C_Chtype) return C_Int;
+ pragma Import (C, Wechochar, "wechochar");
+ begin
+ if Wechochar (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Add_With_Immediate_Echo;
+
+ procedure Add_With_Immediate_Echo
+ (Win : in Window := Standard_Window;
+ Ch : in Character)
+ is
+ begin
+ Add_With_Immediate_Echo
+ (Win,
+ Attributed_Character'(Ch => Ch,
+ Color => Color_Pair'First,
+ Attr => Normal_Video));
+ end Add_With_Immediate_Echo;
+------------------------------------------------------------------------------
+ function Create (Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count;
+ First_Line_Position : Line_Position;
+ First_Column_Position : Column_Position) return Window
+ is
+ function Newwin (Number_Of_Lines : C_Int;
+ Number_Of_Columns : C_Int;
+ First_Line_Position : C_Int;
+ First_Column_Position : C_Int) return Window;
+ pragma Import (C, Newwin, "newwin");
+
+ W : Window;
+ begin
+ W := Newwin (C_Int (Number_Of_Lines),
+ C_Int (Number_Of_Columns),
+ C_Int (First_Line_Position),
+ C_Int (First_Column_Position));
+ if W = Null_Window then
+ raise Curses_Exception;
+ end if;
+ return W;
+ end Create;
+
+ procedure Delete (Win : in out Window)
+ is
+ function Wdelwin (W : Window) return C_Int;
+ pragma Import (C, Wdelwin, "delwin");
+ begin
+ if Wdelwin (Win) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ Win := Null_Window;
+ end Delete;
+
+ function Sub_Window
+ (Win : Window := Standard_Window;
+ Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count;
+ First_Line_Position : Line_Position;
+ First_Column_Position : Column_Position) return Window
+ is
+ function Subwin
+ (Win : Window;
+ Number_Of_Lines : C_Int;
+ Number_Of_Columns : C_Int;
+ First_Line_Position : C_Int;
+ First_Column_Position : C_Int) return Window;
+ pragma Import (C, Subwin, "subwin");
+
+ W : Window;
+ begin
+ W := Subwin (Win,
+ C_Int (Number_Of_Lines),
+ C_Int (Number_Of_Columns),
+ C_Int (First_Line_Position),
+ C_Int (First_Column_Position));
+ if W = Null_Window then
+ raise Curses_Exception;
+ end if;
+ return W;
+ end Sub_Window;
+
+ function Derived_Window
+ (Win : Window := Standard_Window;
+ Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count;
+ First_Line_Position : Line_Position;
+ First_Column_Position : Column_Position) return Window
+ is
+ function Derwin
+ (Win : Window;
+ Number_Of_Lines : C_Int;
+ Number_Of_Columns : C_Int;
+ First_Line_Position : C_Int;
+ First_Column_Position : C_Int) return Window;
+ pragma Import (C, Derwin, "derwin");
+
+ W : Window;
+ begin
+ W := Derwin (Win,
+ C_Int (Number_Of_Lines),
+ C_Int (Number_Of_Columns),
+ C_Int (First_Line_Position),
+ C_Int (First_Column_Position));
+ if W = Null_Window then
+ raise Curses_Exception;
+ end if;
+ return W;
+ end Derived_Window;
+
+ function Duplicate (Win : Window) return Window
+ is
+ function Dupwin (Win : Window) return Window;
+ pragma Import (C, Dupwin, "dupwin");
+
+ W : constant Window := Dupwin (Win);
+ begin
+ if W = Null_Window then
+ raise Curses_Exception;
+ end if;
+ return W;
+ end Duplicate;
+
+ procedure Move_Window (Win : in Window;
+ Line : in Line_Position;
+ Column : in Column_Position)
+ is
+ function Mvwin (Win : Window;
+ Line : C_Int;
+ Column : C_Int) return C_Int;
+ pragma Import (C, Mvwin, "mvwin");
+ begin
+ if Mvwin (Win, C_Int (Line), C_Int (Column)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Move_Window;
+
+ procedure Move_Derived_Window (Win : in Window;
+ Line : in Line_Position;
+ Column : in Column_Position)
+ is
+ function Mvderwin (Win : Window;
+ Line : C_Int;
+ Column : C_Int) return C_Int;
+ pragma Import (C, Mvderwin, "mvderwin");
+ begin
+ if Mvderwin (Win, C_Int (Line), C_Int (Column)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Move_Derived_Window;
+
+ procedure Set_Synch_Mode (Win : in Window := Standard_Window;
+ Mode : in Boolean := False)
+ is
+ function Syncok (Win : Window;
+ Mode : Curses_Bool) return C_Int;
+ pragma Import (C, Syncok, "syncok");
+ begin
+ if Syncok (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Synch_Mode;
+------------------------------------------------------------------------------
+ procedure Add (Win : in Window := Standard_Window;
+ Str : in String;
+ Len : in Integer := -1)
+ is
+ function Waddnstr (Win : Window;
+ Str : char_array;
+ Len : C_Int := -1) return C_Int;
+ pragma Import (C, Waddnstr, "waddnstr");
+
+ Txt : char_array (0 .. Str'Length);
+ Length : size_t;
+ begin
+ To_C (Str, Txt, Length);
+ if Waddnstr (Win, Txt, C_Int (Len)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Add;
+
+ procedure Add
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : in String;
+ Len : in Integer := -1)
+ is
+ begin
+ Move_Cursor (Win, Line, Column);
+ Add (Win, Str, Len);
+ end Add;
+------------------------------------------------------------------------------
+ procedure Add
+ (Win : in Window := Standard_Window;
+ Str : in Attributed_String;
+ Len : in Integer := -1)
+ is
+ function Waddchnstr (Win : Window;
+ Str : chtype_array;
+ Len : C_Int := -1) return C_Int;
+ pragma Import (C, Waddchnstr, "waddchnstr");
+
+ Txt : chtype_array (0 .. Str'Length);
+ begin
+ for Length in 1 .. size_t (Str'Length) loop
+ Txt (Length - 1) := Str (Natural (Length));
+ end loop;
+ Txt (Str'Length) := Default_Character;
+ if Waddchnstr (Win,
+ Txt,
+ C_Int (Len)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Add;
+
+ procedure Add
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : in Attributed_String;
+ Len : in Integer := -1)
+ is
+ begin
+ Move_Cursor (Win, Line, Column);
+ Add (Win, Str, Len);
+ end Add;
+------------------------------------------------------------------------------
+ procedure Border
+ (Win : in Window := Standard_Window;
+ Left_Side_Symbol : in Attributed_Character := Default_Character;
+ Right_Side_Symbol : in Attributed_Character := Default_Character;
+ Top_Side_Symbol : in Attributed_Character := Default_Character;
+ Bottom_Side_Symbol : in Attributed_Character := Default_Character;
+ Upper_Left_Corner_Symbol : in Attributed_Character := Default_Character;
+ Upper_Right_Corner_Symbol : in Attributed_Character := Default_Character;
+ Lower_Left_Corner_Symbol : in Attributed_Character := Default_Character;
+ Lower_Right_Corner_Symbol : in 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;
+ 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
+ then
+ raise Curses_Exception;
+ end if;
+ end Border;
+
+ procedure Box
+ (Win : in Window := Standard_Window;
+ Vertical_Symbol : in Attributed_Character := Default_Character;
+ Horizontal_Symbol : in Attributed_Character := Default_Character)
+ is
+ begin
+ Border (Win,
+ Vertical_Symbol, Vertical_Symbol,
+ Horizontal_Symbol, Horizontal_Symbol);
+ end Box;
+
+ procedure Horizontal_Line
+ (Win : in Window := Standard_Window;
+ Line_Size : in Natural;
+ Line_Symbol : in Attributed_Character := Default_Character)
+ is
+ function Whline (W : Window;
+ Ch : C_Chtype;
+ 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
+ raise Curses_Exception;
+ end if;
+ end Horizontal_Line;
+
+ procedure Vertical_Line
+ (Win : in Window := Standard_Window;
+ Line_Size : in Natural;
+ Line_Symbol : in Attributed_Character := Default_Character)
+ is
+ function Wvline (W : Window;
+ Ch : C_Chtype;
+ 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
+ raise Curses_Exception;
+ end if;
+ end Vertical_Line;
+
+------------------------------------------------------------------------------
+ function Get_Keystroke (Win : Window := Standard_Window)
+ return Real_Key_Code
+ is
+ function Wgetch (W : Window) return C_Int;
+ pragma Import (C, Wgetch, "wgetch");
+
+ C : constant C_Int := Wgetch (Win);
+ begin
+ if C = Curses_Err then
+ return Key_None;
+ else
+ return Real_Key_Code (C);
+ end if;
+ end Get_Keystroke;
+
+ procedure Undo_Keystroke (Key : in Real_Key_Code)
+ is
+ function Ungetch (Ch : C_Int) return C_Int;
+ pragma Import (C, Ungetch, "ungetch");
+ begin
+ if Ungetch (C_Int (Key)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Undo_Keystroke;
+
+ function Has_Key (Key : Special_Key_Code) return Boolean
+ is
+ function Haskey (Key : C_Int) return C_Int;
+ pragma Import (C, Haskey, "has_key");
+ begin
+ if Haskey (C_Int (Key)) = Curses_False then
+ return False;
+ else
+ return True;
+ end if;
+ end Has_Key;
+
+ function Is_Function_Key (Key : Special_Key_Code) return Boolean
+ is
+ L : constant Special_Key_Code := Special_Key_Code (Natural (Key_F0) +
+ Natural (Function_Key_Number'Last));
+ begin
+ if (Key >= Key_F0) and then (Key <= L) then
+ return True;
+ else
+ return False;
+ end if;
+ end Is_Function_Key;
+
+ function Function_Key (Key : Real_Key_Code)
+ return Function_Key_Number
+ is
+ begin
+ if Is_Function_Key (Key) then
+ return Function_Key_Number (Key - Key_F0);
+ else
+ raise Constraint_Error;
+ end if;
+ end Function_Key;
+
+ function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code
+ is
+ begin
+ return Real_Key_Code (Natural (Key_F0) + Natural (Key));
+ end Function_Key_Code;
+------------------------------------------------------------------------------
+ procedure Standout (Win : Window := Standard_Window;
+ On : Boolean := True)
+ is
+ function wstandout (Win : Window) return C_Int;
+ pragma Import (C, wstandout, "wstandout");
+ function wstandend (Win : Window) return C_Int;
+ pragma Import (C, wstandend, "wstandend");
+
+ Err : C_Int;
+ begin
+ if On then
+ Err := wstandout (Win);
+ else
+ Err := wstandend (Win);
+ end if;
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Standout;
+
+ procedure Switch_Character_Attribute
+ (Win : in Window := Standard_Window;
+ Attr : in Character_Attribute_Set := Normal_Video;
+ On : in Boolean := True)
+ is
+ function Wattron (Win : Window;
+ C_Attr : C_AttrType) return C_Int;
+ pragma Import (C, Wattron, "wattr_on");
+ function Wattroff (Win : Window;
+ C_Attr : C_AttrType) 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.
+ Err : C_Int;
+ AC : constant Attributed_Character := (Ch => Character'First,
+ Color => Color_Pair'First,
+ Attr => Attr);
+ begin
+ if On then
+ Err := Wattron (Win, AttrChar_To_AttrType (AC));
+ else
+ Err := Wattroff (Win, AttrChar_To_AttrType (AC));
+ end if;
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Switch_Character_Attribute;
+
+ procedure Set_Character_Attributes
+ (Win : in Window := Standard_Window;
+ Attr : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First)
+ is
+ function Wattrset (Win : Window;
+ C_Attr : C_AttrType) 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
+ raise Curses_Exception;
+ end if;
+ end Set_Character_Attributes;
+
+ function Get_Character_Attribute (Win : Window := Standard_Window)
+ return Character_Attribute_Set
+ is
+ function Wattrget (Win : Window;
+ Atr : access C_AttrType;
+ Col : access C_Short;
+ Opt : System.Address) return C_Int;
+ pragma Import (C, Wattrget, "wattr_get");
+
+ Attr : aliased C_AttrType;
+ 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;
+ else
+ raise Curses_Exception;
+ end if;
+ end Get_Character_Attribute;
+
+ function Get_Character_Attribute (Win : Window := Standard_Window)
+ return Color_Pair
+ is
+ function Wattrget (Win : Window;
+ Atr : access C_AttrType;
+ Col : access C_Short;
+ Opt : System.Address) return C_Int;
+ pragma Import (C, Wattrget, "wattr_get");
+
+ Attr : aliased C_AttrType;
+ 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;
+ else
+ raise Curses_Exception;
+ end if;
+ end Get_Character_Attribute;
+
+ procedure Set_Color (Win : in Window := Standard_Window;
+ Pair : in Color_Pair)
+ is
+ function Wset_Color (Win : Window;
+ Color : C_Short;
+ Opts : C_Void_Ptr) return C_Int;
+ pragma Import (C, Wset_Color, "wcolor_set");
+ begin
+ if Wset_Color (Win,
+ C_Short (Pair),
+ C_Void_Ptr (System.Null_Address)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Color;
+
+ procedure Change_Attributes
+ (Win : in Window := Standard_Window;
+ Count : in Integer := -1;
+ Attr : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First)
+ is
+ function Wchgat (Win : Window;
+ Cnt : C_Int;
+ Attr : C_AttrType;
+ 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
+ raise Curses_Exception;
+ end if;
+ end Change_Attributes;
+
+ procedure Change_Attributes
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position := Line_Position'First;
+ Column : in Column_Position := Column_Position'First;
+ Count : in Integer := -1;
+ Attr : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First)
+ is
+ begin
+ Move_Cursor (Win, Line, Column);
+ Change_Attributes (Win, Count, Attr, Color);
+ end Change_Attributes;
+------------------------------------------------------------------------------
+ procedure Beep
+ is
+ function Beeper return C_Int;
+ pragma Import (C, Beeper, "beep");
+ begin
+ if Beeper = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Beep;
+
+ procedure Flash_Screen
+ is
+ function Flash return C_Int;
+ pragma Import (C, Flash, "flash");
+ begin
+ if Flash = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Flash_Screen;
+------------------------------------------------------------------------------
+ procedure Set_Cbreak_Mode (SwitchOn : in Boolean := True)
+ is
+ function Cbreak return C_Int;
+ pragma Import (C, Cbreak, "cbreak");
+ function NoCbreak return C_Int;
+ pragma Import (C, NoCbreak, "nocbreak");
+
+ Err : C_Int;
+ begin
+ if SwitchOn then
+ Err := Cbreak;
+ else
+ Err := NoCbreak;
+ end if;
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Cbreak_Mode;
+
+ procedure Set_Raw_Mode (SwitchOn : in Boolean := True)
+ is
+ function Raw return C_Int;
+ pragma Import (C, Raw, "raw");
+ function NoRaw return C_Int;
+ pragma Import (C, NoRaw, "noraw");
+
+ Err : C_Int;
+ begin
+ if SwitchOn then
+ Err := Raw;
+ else
+ Err := NoRaw;
+ end if;
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Raw_Mode;
+
+ procedure Set_Echo_Mode (SwitchOn : in Boolean := True)
+ is
+ function Echo return C_Int;
+ pragma Import (C, Echo, "echo");
+ function NoEcho return C_Int;
+ pragma Import (C, NoEcho, "noecho");
+
+ Err : C_Int;
+ begin
+ if SwitchOn then
+ Err := Echo;
+ else
+ Err := NoEcho;
+ end if;
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Echo_Mode;
+
+ procedure Set_Meta_Mode (Win : in Window := Standard_Window;
+ SwitchOn : in Boolean := True)
+ is
+ function Meta (W : Window; Mode : Curses_Bool) return C_Int;
+ pragma Import (C, Meta, "meta");
+ begin
+ if Meta (Win, Curses_Bool (Boolean'Pos (SwitchOn))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Meta_Mode;
+
+ procedure Set_KeyPad_Mode (Win : in Window := Standard_Window;
+ SwitchOn : in Boolean := True)
+ is
+ function Keypad (W : Window; Mode : Curses_Bool) return C_Int;
+ pragma Import (C, Keypad, "keypad");
+ begin
+ if Keypad (Win, Curses_Bool (Boolean'Pos (SwitchOn))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_KeyPad_Mode;
+
+ function Get_KeyPad_Mode (Win : in Window := Standard_Window)
+ return Boolean
+ is
+ function Is_Keypad (W : Window) return Curses_Bool;
+ pragma Import (C, Is_Keypad, "is_keypad");
+ begin
+ return (Is_Keypad (Win) /= Curses_Bool_False);
+ end Get_KeyPad_Mode;
+
+ procedure Half_Delay (Amount : in Half_Delay_Amount)
+ is
+ function Halfdelay (Amount : C_Int) return C_Int;
+ pragma Import (C, Halfdelay, "halfdelay");
+ begin
+ if Halfdelay (C_Int (Amount)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Half_Delay;
+
+ procedure Set_Flush_On_Interrupt_Mode
+ (Win : in Window := Standard_Window;
+ Mode : in Boolean := True)
+ is
+ function Intrflush (Win : Window; Mode : Curses_Bool) return C_Int;
+ pragma Import (C, Intrflush, "intrflush");
+ begin
+ if Intrflush (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Flush_On_Interrupt_Mode;
+
+ procedure Set_Queue_Interrupt_Mode
+ (Win : in Window := Standard_Window;
+ Flush : in Boolean := True)
+ is
+ procedure Qiflush;
+ pragma Import (C, Qiflush, "qiflush");
+ procedure No_Qiflush;
+ pragma Import (C, No_Qiflush, "noqiflush");
+ begin
+ if Win = Null_Window then
+ raise Curses_Exception;
+ end if;
+ if Flush then
+ Qiflush;
+ else
+ No_Qiflush;
+ end if;
+ end Set_Queue_Interrupt_Mode;
+
+ procedure Set_NoDelay_Mode
+ (Win : in Window := Standard_Window;
+ Mode : in Boolean := False)
+ is
+ function Nodelay (Win : Window; Mode : Curses_Bool) return C_Int;
+ pragma Import (C, Nodelay, "nodelay");
+ begin
+ if Nodelay (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_NoDelay_Mode;
+
+ procedure Set_Timeout_Mode (Win : in Window := Standard_Window;
+ Mode : in Timeout_Mode;
+ Amount : in Natural)
+ is
+ procedure Wtimeout (Win : Window; Amount : C_Int);
+ pragma Import (C, Wtimeout, "wtimeout");
+
+ Time : C_Int;
+ begin
+ case Mode is
+ when Blocking => Time := -1;
+ when Non_Blocking => Time := 0;
+ when Delayed =>
+ if Amount = 0 then
+ raise Constraint_Error;
+ end if;
+ Time := C_Int (Amount);
+ end case;
+ Wtimeout (Win, Time);
+ end Set_Timeout_Mode;
+
+ procedure Set_Escape_Timer_Mode
+ (Win : in Window := Standard_Window;
+ Timer_Off : in Boolean := False)
+ is
+ function Notimeout (Win : Window; Mode : Curses_Bool) return C_Int;
+ pragma Import (C, Notimeout, "notimeout");
+ begin
+ if Notimeout (Win, Curses_Bool (Boolean'Pos (Timer_Off)))
+ = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Escape_Timer_Mode;
+
+------------------------------------------------------------------------------
+ procedure Set_NL_Mode (SwitchOn : in Boolean := True)
+ is
+ function NL return C_Int;
+ pragma Import (C, NL, "nl");
+ function NoNL return C_Int;
+ pragma Import (C, NoNL, "nonl");
+
+ Err : C_Int;
+ begin
+ if SwitchOn then
+ Err := NL;
+ else
+ Err := NoNL;
+ end if;
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_NL_Mode;
+
+ procedure Clear_On_Next_Update
+ (Win : in Window := Standard_Window;
+ Do_Clear : in Boolean := True)
+ is
+ function Clear_Ok (W : Window; Flag : Curses_Bool) return C_Int;
+ pragma Import (C, Clear_Ok, "clearok");
+ begin
+ if Clear_Ok (Win, Curses_Bool (Boolean'Pos (Do_Clear))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Clear_On_Next_Update;
+
+ procedure Use_Insert_Delete_Line
+ (Win : in Window := Standard_Window;
+ Do_Idl : in Boolean := True)
+ is
+ function IDL_Ok (W : Window; Flag : Curses_Bool) return C_Int;
+ pragma Import (C, IDL_Ok, "idlok");
+ begin
+ if IDL_Ok (Win, Curses_Bool (Boolean'Pos (Do_Idl))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Use_Insert_Delete_Line;
+
+ procedure Use_Insert_Delete_Character
+ (Win : in Window := Standard_Window;
+ Do_Idc : in Boolean := True)
+ is
+ procedure IDC_Ok (W : Window; Flag : Curses_Bool);
+ pragma Import (C, IDC_Ok, "idcok");
+ begin
+ IDC_Ok (Win, Curses_Bool (Boolean'Pos (Do_Idc)));
+ end Use_Insert_Delete_Character;
+
+ procedure Leave_Cursor_After_Update
+ (Win : in Window := Standard_Window;
+ Do_Leave : in Boolean := True)
+ is
+ function Leave_Ok (W : Window; Flag : Curses_Bool) return C_Int;
+ pragma Import (C, Leave_Ok, "leaveok");
+ begin
+ if Leave_Ok (Win, Curses_Bool (Boolean'Pos (Do_Leave))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Leave_Cursor_After_Update;
+
+ procedure Immediate_Update_Mode
+ (Win : in Window := Standard_Window;
+ Mode : in Boolean := False)
+ is
+ procedure Immedok (Win : Window; Mode : Curses_Bool);
+ pragma Import (C, Immedok, "immedok");
+ begin
+ Immedok (Win, Curses_Bool (Boolean'Pos (Mode)));
+ end Immediate_Update_Mode;
+
+ procedure Allow_Scrolling
+ (Win : in Window := Standard_Window;
+ Mode : in Boolean := False)
+ is
+ function Scrollok (Win : Window; Mode : Curses_Bool) return C_Int;
+ pragma Import (C, Scrollok, "scrollok");
+ begin
+ if Scrollok (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Allow_Scrolling;
+
+ function Scrolling_Allowed (Win : Window := Standard_Window)
+ return Boolean
+ is
+ function Is_Scroll_Ok (W : Window) return Curses_Bool;
+ pragma Import (C, Is_Scroll_Ok, "is_scrollok");
+ begin
+ return (Is_Scroll_Ok (Win) /= Curses_Bool_False);
+ end Scrolling_Allowed;
+
+ procedure Set_Scroll_Region
+ (Win : in Window := Standard_Window;
+ Top_Line : in Line_Position;
+ Bottom_Line : in Line_Position)
+ is
+ function Wsetscrreg (Win : Window;
+ Lin : C_Int;
+ Col : C_Int) return C_Int;
+ pragma Import (C, Wsetscrreg, "wsetscrreg");
+ begin
+ if Wsetscrreg (Win, C_Int (Top_Line), C_Int (Bottom_Line))
+ = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Scroll_Region;
+------------------------------------------------------------------------------
+ procedure Update_Screen
+ is
+ function Do_Update return C_Int;
+ pragma Import (C, Do_Update, "doupdate");
+ begin
+ if Do_Update = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Update_Screen;
+
+ procedure Refresh (Win : in Window := Standard_Window)
+ is
+ function Wrefresh (W : Window) return C_Int;
+ pragma Import (C, Wrefresh, "wrefresh");
+ begin
+ if Wrefresh (Win) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Refresh;
+
+ procedure Refresh_Without_Update
+ (Win : in Window := Standard_Window)
+ is
+ function Wnoutrefresh (W : Window) return C_Int;
+ pragma Import (C, Wnoutrefresh, "wnoutrefresh");
+ begin
+ if Wnoutrefresh (Win) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Refresh_Without_Update;
+
+ procedure Redraw (Win : in Window := Standard_Window)
+ is
+ function Redrawwin (Win : Window) return C_Int;
+ pragma Import (C, Redrawwin, "redrawwin");
+ begin
+ if Redrawwin (Win) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Redraw;
+
+ procedure Redraw
+ (Win : in Window := Standard_Window;
+ Begin_Line : in Line_Position;
+ Line_Count : in Positive)
+ is
+ function Wredrawln (Win : Window; First : C_Int; Cnt : C_Int)
+ return C_Int;
+ pragma Import (C, Wredrawln, "wredrawln");
+ begin
+ if Wredrawln (Win,
+ C_Int (Begin_Line),
+ C_Int (Line_Count)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Redraw;
+
+------------------------------------------------------------------------------
+ procedure Erase (Win : in Window := Standard_Window)
+ is
+ function Werase (W : Window) return C_Int;
+ pragma Import (C, Werase, "werase");
+ begin
+ if Werase (Win) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Erase;
+
+ procedure Clear (Win : in Window := Standard_Window)
+ is
+ function Wclear (W : Window) return C_Int;
+ pragma Import (C, Wclear, "wclear");
+ begin
+ if Wclear (Win) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Clear;
+
+ procedure Clear_To_End_Of_Screen (Win : in Window := Standard_Window)
+ is
+ function Wclearbot (W : Window) return C_Int;
+ pragma Import (C, Wclearbot, "wclrtobot");
+ begin
+ if Wclearbot (Win) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Clear_To_End_Of_Screen;
+
+ procedure Clear_To_End_Of_Line (Win : in Window := Standard_Window)
+ is
+ function Wcleareol (W : Window) return C_Int;
+ pragma Import (C, Wcleareol, "wclrtoeol");
+ begin
+ if Wcleareol (Win) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Clear_To_End_Of_Line;
+------------------------------------------------------------------------------
+ procedure Set_Background
+ (Win : in Window := Standard_Window;
+ Ch : in Attributed_Character)
+ is
+ procedure WBackground (W : in Window; Ch : in C_Chtype);
+ pragma Import (C, WBackground, "wbkgdset");
+ begin
+ WBackground (Win, AttrChar_To_Chtype (Ch));
+ end Set_Background;
+
+ procedure Change_Background
+ (Win : in Window := Standard_Window;
+ Ch : in Attributed_Character)
+ is
+ function WChangeBkgd (W : Window; Ch : C_Chtype) return C_Int;
+ pragma Import (C, WChangeBkgd, "wbkgd");
+ begin
+ if WChangeBkgd (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Change_Background;
+
+ function Get_Background (Win : Window := Standard_Window)
+ return Attributed_Character
+ is
+ function Wgetbkgd (Win : Window) return C_Chtype;
+ pragma Import (C, Wgetbkgd, "getbkgd");
+ begin
+ return Chtype_To_AttrChar (Wgetbkgd (Win));
+ end Get_Background;
+------------------------------------------------------------------------------
+ procedure Change_Lines_Status (Win : in Window := Standard_Window;
+ Start : in Line_Position;
+ Count : in Positive;
+ State : in Boolean)
+ is
+ function Wtouchln (Win : Window;
+ Sta : C_Int;
+ Cnt : C_Int;
+ Chg : C_Int) return C_Int;
+ pragma Import (C, Wtouchln, "wtouchln");
+ begin
+ if Wtouchln (Win, C_Int (Start), C_Int (Count),
+ C_Int (Boolean'Pos (State))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Change_Lines_Status;
+
+ procedure Touch (Win : in Window := Standard_Window)
+ is
+ Y : Line_Position;
+ X : Column_Position;
+ begin
+ Get_Size (Win, Y, X);
+ Change_Lines_Status (Win, 0, Positive (Y), True);
+ end Touch;
+
+ procedure Untouch (Win : in Window := Standard_Window)
+ is
+ Y : Line_Position;
+ X : Column_Position;
+ begin
+ Get_Size (Win, Y, X);
+ Change_Lines_Status (Win, 0, Positive (Y), False);
+ end Untouch;
+
+ procedure Touch (Win : in Window := Standard_Window;
+ Start : in Line_Position;
+ Count : in Positive)
+ is
+ begin
+ Change_Lines_Status (Win, Start, Count, True);
+ end Touch;
+
+ function Is_Touched
+ (Win : Window := Standard_Window;
+ Line : Line_Position) return Boolean
+ is
+ function WLineTouched (W : Window; L : C_Int) return Curses_Bool;
+ pragma Import (C, WLineTouched, "is_linetouched");
+ begin
+ if WLineTouched (Win, C_Int (Line)) = Curses_Bool_False then
+ return False;
+ else
+ return True;
+ end if;
+ end Is_Touched;
+
+ function Is_Touched
+ (Win : Window := Standard_Window) return Boolean
+ is
+ function WWinTouched (W : Window) return Curses_Bool;
+ pragma Import (C, WWinTouched, "is_wintouched");
+ begin
+ if WWinTouched (Win) = Curses_Bool_False then
+ return False;
+ else
+ return True;
+ end if;
+ end Is_Touched;
+------------------------------------------------------------------------------
+ procedure Copy
+ (Source_Window : in Window;
+ Destination_Window : in Window;
+ Source_Top_Row : in Line_Position;
+ Source_Left_Column : in Column_Position;
+ Destination_Top_Row : in Line_Position;
+ Destination_Left_Column : in Column_Position;
+ Destination_Bottom_Row : in Line_Position;
+ Destination_Right_Column : in Column_Position;
+ Non_Destructive_Mode : in Boolean := True)
+ is
+ function Copywin (Src : Window;
+ Dst : Window;
+ Str : C_Int;
+ Slc : C_Int;
+ Dtr : C_Int;
+ Dlc : C_Int;
+ Dbr : C_Int;
+ Drc : C_Int;
+ Ndm : C_Int) return C_Int;
+ pragma Import (C, Copywin, "copywin");
+ begin
+ if Copywin (Source_Window,
+ Destination_Window,
+ C_Int (Source_Top_Row),
+ C_Int (Source_Left_Column),
+ C_Int (Destination_Top_Row),
+ C_Int (Destination_Left_Column),
+ C_Int (Destination_Bottom_Row),
+ C_Int (Destination_Right_Column),
+ Boolean'Pos (Non_Destructive_Mode)
+ ) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Copy;
+
+ procedure Overwrite
+ (Source_Window : in Window;
+ Destination_Window : in Window)
+ is
+ function Overwrite (Src : Window; Dst : Window) return C_Int;
+ pragma Import (C, Overwrite, "overwrite");
+ begin
+ if Overwrite (Source_Window, Destination_Window) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Overwrite;
+
+ procedure Overlay
+ (Source_Window : in Window;
+ Destination_Window : in Window)
+ is
+ function Overlay (Src : Window; Dst : Window) return C_Int;
+ pragma Import (C, Overlay, "overlay");
+ begin
+ if Overlay (Source_Window, Destination_Window) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Overlay;
+
+------------------------------------------------------------------------------
+ procedure Insert_Delete_Lines
+ (Win : in Window := Standard_Window;
+ Lines : in Integer := 1) -- default is to insert one line above
+ is
+ function Winsdelln (W : Window; N : C_Int) return C_Int;
+ pragma Import (C, Winsdelln, "winsdelln");
+ begin
+ if Winsdelln (Win, C_Int (Lines)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Insert_Delete_Lines;
+
+ procedure Delete_Line (Win : in Window := Standard_Window)
+ is
+ begin
+ Insert_Delete_Lines (Win, -1);
+ end Delete_Line;
+
+ procedure Insert_Line (Win : in Window := Standard_Window)
+ is
+ begin
+ Insert_Delete_Lines (Win, 1);
+ end Insert_Line;
+------------------------------------------------------------------------------
+
+ procedure Get_Size
+ (Win : in Window := Standard_Window;
+ Number_Of_Lines : out Line_Count;
+ Number_Of_Columns : out Column_Count)
+ is
+ function GetMaxY (W : Window) return C_Int;
+ pragma Import (C, GetMaxY, "getmaxy");
+
+ function GetMaxX (W : Window) return C_Int;
+ pragma Import (C, GetMaxX, "getmaxx");
+
+ Y : constant C_Int := GetMaxY (Win)
+ + C_Int (Offset_XY);
+ X : constant C_Int := GetMaxX (Win)
+ + C_Int (Offset_XY);
+ begin
+ Number_Of_Lines := Line_Count (Y);
+ Number_Of_Columns := Column_Count (X);
+ end Get_Size;
+
+ procedure Get_Window_Position
+ (Win : in Window := Standard_Window;
+ Top_Left_Line : out Line_Position;
+ Top_Left_Column : out Column_Position)
+ is
+ function GetBegY (W : Window) return C_Int;
+ pragma Import (C, GetBegY, "getbegy");
+
+ function GetBegX (W : Window) return C_Int;
+ pragma Import (C, GetBegX, "getbegx");
+
+ Y : constant C_Short := C_Short (GetBegY (Win));
+ X : constant C_Short := C_Short (GetBegX (Win));
+ begin
+ Top_Left_Line := Line_Position (Y);
+ Top_Left_Column := Column_Position (X);
+ end Get_Window_Position;
+
+ procedure Get_Cursor_Position
+ (Win : in Window := Standard_Window;
+ Line : out Line_Position;
+ Column : out Column_Position)
+ is
+ function GetCurY (W : Window) return C_Int;
+ pragma Import (C, GetCurY, "getcury");
+
+ function GetCurX (W : Window) return C_Int;
+ pragma Import (C, GetCurX, "getcurx");
+
+ Y : constant C_Short := C_Short (GetCurY (Win));
+ X : constant C_Short := C_Short (GetCurX (Win));
+ begin
+ Line := Line_Position (Y);
+ Column := Column_Position (X);
+ end Get_Cursor_Position;
+
+ procedure Get_Origin_Relative_To_Parent
+ (Win : in Window;
+ Top_Left_Line : out Line_Position;
+ Top_Left_Column : out Column_Position;
+ Is_Not_A_Subwindow : out Boolean)
+ is
+ function GetParY (W : Window) return C_Int;
+ pragma Import (C, GetParY, "getpary");
+
+ function GetParX (W : Window) return C_Int;
+ pragma Import (C, GetParX, "getparx");
+
+ Y : constant C_Int := GetParY (Win);
+ X : constant C_Int := GetParX (Win);
+ begin
+ if Y = -1 then
+ Top_Left_Line := Line_Position'Last;
+ Top_Left_Column := Column_Position'Last;
+ Is_Not_A_Subwindow := True;
+ else
+ Top_Left_Line := Line_Position (Y);
+ Top_Left_Column := Column_Position (X);
+ Is_Not_A_Subwindow := False;
+ end if;
+ end Get_Origin_Relative_To_Parent;
+------------------------------------------------------------------------------
+ function New_Pad (Lines : Line_Count;
+ Columns : Column_Count) return Window
+ is
+ function Newpad (Lines : C_Int; Columns : C_Int) return Window;
+ pragma Import (C, Newpad, "newpad");
+
+ W : Window;
+ begin
+ W := Newpad (C_Int (Lines), C_Int (Columns));
+ if W = Null_Window then
+ raise Curses_Exception;
+ end if;
+ return W;
+ end New_Pad;
+
+ function Sub_Pad
+ (Pad : Window;
+ Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count;
+ First_Line_Position : Line_Position;
+ First_Column_Position : Column_Position) return Window
+ is
+ function Subpad
+ (Pad : Window;
+ Number_Of_Lines : C_Int;
+ Number_Of_Columns : C_Int;
+ First_Line_Position : C_Int;
+ First_Column_Position : C_Int) return Window;
+ pragma Import (C, Subpad, "subpad");
+
+ W : Window;
+ begin
+ W := Subpad (Pad,
+ C_Int (Number_Of_Lines),
+ C_Int (Number_Of_Columns),
+ C_Int (First_Line_Position),
+ C_Int (First_Column_Position));
+ if W = Null_Window then
+ raise Curses_Exception;
+ end if;
+ return W;
+ end Sub_Pad;
+
+ procedure Refresh
+ (Pad : in Window;
+ Source_Top_Row : in Line_Position;
+ Source_Left_Column : in Column_Position;
+ Destination_Top_Row : in Line_Position;
+ Destination_Left_Column : in Column_Position;
+ Destination_Bottom_Row : in Line_Position;
+ Destination_Right_Column : in Column_Position)
+ is
+ function Prefresh
+ (Pad : Window;
+ Source_Top_Row : C_Int;
+ Source_Left_Column : C_Int;
+ Destination_Top_Row : C_Int;
+ Destination_Left_Column : C_Int;
+ Destination_Bottom_Row : C_Int;
+ Destination_Right_Column : C_Int) return C_Int;
+ pragma Import (C, Prefresh, "prefresh");
+ begin
+ if Prefresh (Pad,
+ C_Int (Source_Top_Row),
+ C_Int (Source_Left_Column),
+ C_Int (Destination_Top_Row),
+ C_Int (Destination_Left_Column),
+ C_Int (Destination_Bottom_Row),
+ C_Int (Destination_Right_Column)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Refresh;
+
+ procedure Refresh_Without_Update
+ (Pad : in Window;
+ Source_Top_Row : in Line_Position;
+ Source_Left_Column : in Column_Position;
+ Destination_Top_Row : in Line_Position;
+ Destination_Left_Column : in Column_Position;
+ Destination_Bottom_Row : in Line_Position;
+ Destination_Right_Column : in Column_Position)
+ is
+ function Pnoutrefresh
+ (Pad : Window;
+ Source_Top_Row : C_Int;
+ Source_Left_Column : C_Int;
+ Destination_Top_Row : C_Int;
+ Destination_Left_Column : C_Int;
+ Destination_Bottom_Row : C_Int;
+ Destination_Right_Column : C_Int) return C_Int;
+ pragma Import (C, Pnoutrefresh, "pnoutrefresh");
+ begin
+ if Pnoutrefresh (Pad,
+ C_Int (Source_Top_Row),
+ C_Int (Source_Left_Column),
+ C_Int (Destination_Top_Row),
+ C_Int (Destination_Left_Column),
+ C_Int (Destination_Bottom_Row),
+ C_Int (Destination_Right_Column)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Refresh_Without_Update;
+
+ procedure Add_Character_To_Pad_And_Echo_It
+ (Pad : in Window;
+ Ch : in Attributed_Character)
+ is
+ function Pechochar (Pad : Window; Ch : C_Chtype)
+ return C_Int;
+ pragma Import (C, Pechochar, "pechochar");
+ begin
+ if Pechochar (Pad, AttrChar_To_Chtype (Ch)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Add_Character_To_Pad_And_Echo_It;
+
+ procedure Add_Character_To_Pad_And_Echo_It
+ (Pad : in Window;
+ Ch : in Character)
+ is
+ begin
+ Add_Character_To_Pad_And_Echo_It
+ (Pad,
+ Attributed_Character'(Ch => Ch,
+ Color => Color_Pair'First,
+ Attr => Normal_Video));
+ end Add_Character_To_Pad_And_Echo_It;
+------------------------------------------------------------------------------
+ procedure Scroll (Win : in Window := Standard_Window;
+ Amount : in Integer := 1)
+ is
+ function Wscrl (Win : Window; N : C_Int) return C_Int;
+ pragma Import (C, Wscrl, "wscrl");
+
+ begin
+ if Wscrl (Win, C_Int (Amount)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Scroll;
+
+------------------------------------------------------------------------------
+ procedure Delete_Character (Win : in Window := Standard_Window)
+ is
+ function Wdelch (Win : Window) return C_Int;
+ pragma Import (C, Wdelch, "wdelch");
+ begin
+ if Wdelch (Win) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Delete_Character;
+
+ procedure Delete_Character
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position)
+ is
+ function Mvwdelch (Win : Window;
+ Lin : C_Int;
+ Col : C_Int) return C_Int;
+ pragma Import (C, Mvwdelch, "mvwdelch");
+ begin
+ if Mvwdelch (Win, C_Int (Line), C_Int (Column)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Delete_Character;
+------------------------------------------------------------------------------
+ function Peek (Win : Window := Standard_Window)
+ return Attributed_Character
+ is
+ function Winch (Win : Window) return C_Chtype;
+ pragma Import (C, Winch, "winch");
+ begin
+ return Chtype_To_AttrChar (Winch (Win));
+ end Peek;
+
+ function Peek
+ (Win : Window := Standard_Window;
+ Line : Line_Position;
+ Column : Column_Position) return Attributed_Character
+ is
+ function Mvwinch (Win : Window;
+ Lin : C_Int;
+ Col : C_Int) return C_Chtype;
+ pragma Import (C, Mvwinch, "mvwinch");
+ begin
+ return Chtype_To_AttrChar (Mvwinch (Win, C_Int (Line), C_Int (Column)));
+ end Peek;
+------------------------------------------------------------------------------
+ procedure Insert (Win : in Window := Standard_Window;
+ Ch : in Attributed_Character)
+ is
+ function Winsch (Win : Window; Ch : C_Chtype) return C_Int;
+ pragma Import (C, Winsch, "winsch");
+ begin
+ if Winsch (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Insert;
+
+ procedure Insert
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Ch : in Attributed_Character)
+ is
+ function Mvwinsch (Win : Window;
+ Lin : C_Int;
+ Col : C_Int;
+ Ch : C_Chtype) 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
+ raise Curses_Exception;
+ end if;
+ end Insert;
+------------------------------------------------------------------------------
+ procedure Insert (Win : in Window := Standard_Window;
+ Str : in String;
+ Len : in Integer := -1)
+ is
+ function Winsnstr (Win : Window;
+ Str : char_array;
+ Len : Integer := -1) return C_Int;
+ pragma Import (C, Winsnstr, "winsnstr");
+
+ Txt : char_array (0 .. Str'Length);
+ Length : size_t;
+ begin
+ To_C (Str, Txt, Length);
+ if Winsnstr (Win, Txt, Len) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Insert;
+
+ procedure Insert
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : in String;
+ Len : in Integer := -1)
+ is
+ function Mvwinsnstr (Win : Window;
+ Line : C_Int;
+ Column : C_Int;
+ Str : char_array;
+ Len : C_Int) return C_Int;
+ pragma Import (C, Mvwinsnstr, "mvwinsnstr");
+
+ Txt : char_array (0 .. Str'Length);
+ Length : size_t;
+ begin
+ To_C (Str, Txt, Length);
+ if Mvwinsnstr (Win, C_Int (Line), C_Int (Column), Txt, C_Int (Len))
+ = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Insert;
+------------------------------------------------------------------------------
+ procedure Peek (Win : in Window := Standard_Window;
+ Str : out String;
+ Len : in Integer := -1)
+ is
+ function Winnstr (Win : Window;
+ Str : char_array;
+ Len : C_Int) return C_Int;
+ pragma Import (C, Winnstr, "winnstr");
+
+ N : Integer := Len;
+ Txt : char_array (0 .. Str'Length);
+ Cnt : Natural;
+ begin
+ if N < 0 then
+ N := Str'Length;
+ end if;
+ if N > Str'Length then
+ raise Constraint_Error;
+ end if;
+ Txt (0) := Interfaces.C.char'First;
+ if Winnstr (Win, Txt, C_Int (N)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ To_Ada (Txt, Str, Cnt, True);
+ if Cnt < Str'Length then
+ Str ((Str'First + Cnt) .. Str'Last) := (others => ' ');
+ end if;
+ end Peek;
+
+ procedure Peek
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : out String;
+ Len : in Integer := -1)
+ is
+ begin
+ Move_Cursor (Win, Line, Column);
+ Peek (Win, Str, Len);
+ end Peek;
+------------------------------------------------------------------------------
+ procedure Peek
+ (Win : in Window := Standard_Window;
+ Str : out Attributed_String;
+ Len : in Integer := -1)
+ is
+ function Winchnstr (Win : Window;
+ Str : chtype_array; -- out
+ Len : C_Int) return C_Int;
+ pragma Import (C, Winchnstr, "winchnstr");
+
+ N : Integer := Len;
+ Txt : constant chtype_array (0 .. Str'Length)
+ := (0 => Default_Character);
+ Cnt : Natural := 0;
+ begin
+ if N < 0 then
+ N := Str'Length;
+ end if;
+ if N > Str'Length then
+ raise Constraint_Error;
+ end if;
+ if Winchnstr (Win, Txt, C_Int (N)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ for To in Str'Range loop
+ exit when Txt (size_t (Cnt)) = Default_Character;
+ Str (To) := Txt (size_t (Cnt));
+ Cnt := Cnt + 1;
+ end loop;
+ if Cnt < Str'Length then
+ Str ((Str'First + Cnt) .. Str'Last) :=
+ (others => (Ch => ' ',
+ Color => Color_Pair'First,
+ Attr => Normal_Video));
+ end if;
+ end Peek;
+
+ procedure Peek
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : out Attributed_String;
+ Len : in Integer := -1)
+ is
+ begin
+ Move_Cursor (Win, Line, Column);
+ Peek (Win, Str, Len);
+ end Peek;
+------------------------------------------------------------------------------
+ procedure Get (Win : in Window := Standard_Window;
+ Str : out String;
+ Len : in Integer := -1)
+ is
+ function Wgetnstr (Win : Window;
+ Str : char_array;
+ Len : C_Int) return C_Int;
+ pragma Import (C, Wgetnstr, "wgetnstr");
+
+ N : Integer := Len;
+ Txt : char_array (0 .. Str'Length);
+ Cnt : Natural;
+ begin
+ if N < 0 then
+ N := Str'Length;
+ end if;
+ if N > Str'Length then
+ raise Constraint_Error;
+ end if;
+ Txt (0) := Interfaces.C.char'First;
+ if Wgetnstr (Win, Txt, C_Int (N)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ To_Ada (Txt, Str, Cnt, True);
+ if Cnt < Str'Length then
+ Str ((Str'First + Cnt) .. Str'Last) := (others => ' ');
+ end if;
+ end Get;
+
+ procedure Get
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : out String;
+ Len : in Integer := -1)
+ is
+ begin
+ Move_Cursor (Win, Line, Column);
+ Get (Win, Str, Len);
+ end Get;
+------------------------------------------------------------------------------
+ procedure Init_Soft_Label_Keys
+ (Format : in Soft_Label_Key_Format := Three_Two_Three)
+ is
+ function Slk_Init (Fmt : C_Int) return C_Int;
+ pragma Import (C, Slk_Init, "slk_init");
+ begin
+ if Slk_Init (Soft_Label_Key_Format'Pos (Format)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Init_Soft_Label_Keys;
+
+ procedure Set_Soft_Label_Key (Label : in Label_Number;
+ Text : in String;
+ Fmt : in Label_Justification := Left)
+ is
+ function Slk_Set (Label : C_Int;
+ Txt : char_array;
+ Fmt : C_Int) return C_Int;
+ pragma Import (C, Slk_Set, "slk_set");
+
+ Txt : char_array (0 .. Text'Length);
+ Len : size_t;
+ begin
+ To_C (Text, Txt, Len);
+ if Slk_Set (C_Int (Label), Txt,
+ C_Int (Label_Justification'Pos (Fmt))) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Soft_Label_Key;
+
+ procedure Refresh_Soft_Label_Keys
+ is
+ function Slk_Refresh return C_Int;
+ pragma Import (C, Slk_Refresh, "slk_refresh");
+ begin
+ if Slk_Refresh = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Refresh_Soft_Label_Keys;
+
+ procedure Refresh_Soft_Label_Keys_Without_Update
+ is
+ function Slk_Noutrefresh return C_Int;
+ pragma Import (C, Slk_Noutrefresh, "slk_noutrefresh");
+ begin
+ if Slk_Noutrefresh = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Refresh_Soft_Label_Keys_Without_Update;
+
+ procedure Get_Soft_Label_Key (Label : in Label_Number;
+ Text : out String)
+ is
+ function Slk_Label (Label : C_Int) return chars_ptr;
+ pragma Import (C, Slk_Label, "slk_label");
+ begin
+ Fill_String (Slk_Label (C_Int (Label)), Text);
+ end Get_Soft_Label_Key;
+
+ function Get_Soft_Label_Key (Label : in Label_Number) return String
+ is
+ function Slk_Label (Label : C_Int) return chars_ptr;
+ pragma Import (C, Slk_Label, "slk_label");
+ begin
+ return Fill_String (Slk_Label (C_Int (Label)));
+ end Get_Soft_Label_Key;
+
+ procedure Clear_Soft_Label_Keys
+ is
+ function Slk_Clear return C_Int;
+ pragma Import (C, Slk_Clear, "slk_clear");
+ begin
+ if Slk_Clear = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Clear_Soft_Label_Keys;
+
+ procedure Restore_Soft_Label_Keys
+ is
+ function Slk_Restore return C_Int;
+ pragma Import (C, Slk_Restore, "slk_restore");
+ begin
+ if Slk_Restore = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Restore_Soft_Label_Keys;
+
+ procedure Touch_Soft_Label_Keys
+ is
+ function Slk_Touch return C_Int;
+ pragma Import (C, Slk_Touch, "slk_touch");
+ begin
+ if Slk_Touch = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Touch_Soft_Label_Keys;
+
+ procedure Switch_Soft_Label_Key_Attributes
+ (Attr : in Character_Attribute_Set;
+ On : in Boolean := True)
+ is
+ function Slk_Attron (Ch : C_Chtype) return C_Int;
+ pragma Import (C, Slk_Attron, "slk_attron");
+ function Slk_Attroff (Ch : C_Chtype) return C_Int;
+ pragma Import (C, Slk_Attroff, "slk_attroff");
+
+ Err : C_Int;
+ Ch : constant Attributed_Character := (Ch => Character'First,
+ Attr => Attr,
+ Color => Color_Pair'First);
+ begin
+ if On then
+ Err := Slk_Attron (AttrChar_To_Chtype (Ch));
+ else
+ Err := Slk_Attroff (AttrChar_To_Chtype (Ch));
+ end if;
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Switch_Soft_Label_Key_Attributes;
+
+ procedure Set_Soft_Label_Key_Attributes
+ (Attr : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First)
+ is
+ function Slk_Attrset (Ch : C_Chtype) 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
+ 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;
+ pragma Import (C, Slk_Attr, "slk_attr");
+
+ Attr : constant C_Chtype := Slk_Attr;
+ begin
+ return Chtype_To_AttrChar (Attr).Attr;
+ end Get_Soft_Label_Key_Attributes;
+
+ function Get_Soft_Label_Key_Attributes return Color_Pair
+ is
+ function Slk_Attr return C_Chtype;
+ pragma Import (C, Slk_Attr, "slk_attr");
+
+ Attr : constant C_Chtype := Slk_Attr;
+ begin
+ return Chtype_To_AttrChar (Attr).Color;
+ end Get_Soft_Label_Key_Attributes;
+
+ procedure Set_Soft_Label_Key_Color (Pair : in Color_Pair)
+ is
+ function Slk_Color (Color : in C_Short) return C_Int;
+ pragma Import (C, Slk_Color, "slk_color");
+ begin
+ if Slk_Color (C_Short (Pair)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Set_Soft_Label_Key_Color;
+
+------------------------------------------------------------------------------
+ procedure Enable_Key (Key : in Special_Key_Code;
+ Enable : in Boolean := True)
+ is
+ function Keyok (Keycode : C_Int;
+ On_Off : Curses_Bool) return C_Int;
+ pragma Import (C, Keyok, "keyok");
+ begin
+ if Keyok (C_Int (Key), Curses_Bool (Boolean'Pos (Enable)))
+ = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Enable_Key;
+------------------------------------------------------------------------------
+ procedure Define_Key (Definition : in String;
+ Key : in Special_Key_Code)
+ is
+ function Defkey (Def : char_array;
+ Key : C_Int) return C_Int;
+ pragma Import (C, Defkey, "define_key");
+
+ Txt : char_array (0 .. Definition'Length);
+ Length : size_t;
+ begin
+ To_C (Definition, Txt, Length);
+ if Defkey (Txt, C_Int (Key)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Define_Key;
+------------------------------------------------------------------------------
+ procedure Un_Control (Ch : in Attributed_Character;
+ Str : out String)
+ is
+ function Unctrl (Ch : C_Chtype) return chars_ptr;
+ pragma Import (C, Unctrl, "unctrl");
+ begin
+ Fill_String (Unctrl (AttrChar_To_Chtype (Ch)), Str);
+ end Un_Control;
+
+ function Un_Control (Ch : in Attributed_Character) return String
+ is
+ function Unctrl (Ch : C_Chtype) return chars_ptr;
+ pragma Import (C, Unctrl, "unctrl");
+ begin
+ return Fill_String (Unctrl (AttrChar_To_Chtype (Ch)));
+ end Un_Control;
+
+ procedure Delay_Output (Msecs : in Natural)
+ is
+ function Delayoutput (Msecs : C_Int) return C_Int;
+ pragma Import (C, Delayoutput, "delay_output");
+ begin
+ if Delayoutput (C_Int (Msecs)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Delay_Output;
+
+ procedure Flush_Input
+ is
+ function Flushinp return C_Int;
+ pragma Import (C, Flushinp, "flushinp");
+ begin
+ if Flushinp = Curses_Err then -- docu says that never happens, but...
+ raise Curses_Exception;
+ end if;
+ end Flush_Input;
+------------------------------------------------------------------------------
+ function Baudrate return Natural
+ is
+ function Baud return C_Int;
+ pragma Import (C, Baud, "baudrate");
+ begin
+ return Natural (Baud);
+ end Baudrate;
+
+ function Erase_Character return Character
+ is
+ function Erasechar return C_Int;
+ pragma Import (C, Erasechar, "erasechar");
+ begin
+ return Character'Val (Erasechar);
+ end Erase_Character;
+
+ function Kill_Character return Character
+ is
+ function Killchar return C_Int;
+ pragma Import (C, Killchar, "killchar");
+ begin
+ return Character'Val (Killchar);
+ end Kill_Character;
+
+ function Has_Insert_Character return Boolean
+ is
+ function Has_Ic return Curses_Bool;
+ pragma Import (C, Has_Ic, "has_ic");
+ begin
+ if Has_Ic = Curses_Bool_False then
+ return False;
+ else
+ return True;
+ end if;
+ end Has_Insert_Character;
+
+ function Has_Insert_Line return Boolean
+ is
+ function Has_Il return Curses_Bool;
+ pragma Import (C, Has_Il, "has_il");
+ begin
+ if Has_Il = Curses_Bool_False then
+ return False;
+ else
+ return True;
+ end if;
+ end Has_Insert_Line;
+
+ function Supported_Attributes return Character_Attribute_Set
+ is
+ function Termattrs return C_Chtype;
+ pragma Import (C, Termattrs, "termattrs");
+
+ Ch : constant Attributed_Character := Chtype_To_AttrChar (Termattrs);
+ begin
+ return Ch.Attr;
+ end Supported_Attributes;
+
+ procedure Long_Name (Name : out String)
+ is
+ function Longname return chars_ptr;
+ pragma Import (C, Longname, "longname");
+ begin
+ Fill_String (Longname, Name);
+ end Long_Name;
+
+ function Long_Name return String
+ is
+ function Longname return chars_ptr;
+ pragma Import (C, Longname, "longname");
+ begin
+ return Fill_String (Longname);
+ end Long_Name;
+
+ procedure Terminal_Name (Name : out String)
+ is
+ function Termname return chars_ptr;
+ pragma Import (C, Termname, "termname");
+ begin
+ Fill_String (Termname, Name);
+ end Terminal_Name;
+
+ function Terminal_Name return String
+ is
+ function Termname return chars_ptr;
+ pragma Import (C, Termname, "termname");
+ begin
+ return Fill_String (Termname);
+ end Terminal_Name;
+------------------------------------------------------------------------------
+ procedure Init_Pair (Pair : in Redefinable_Color_Pair;
+ Fore : in Color_Number;
+ Back : in Color_Number)
+ is
+ function Initpair (Pair : C_Short;
+ Fore : C_Short;
+ Back : C_Short) return C_Int;
+ pragma Import (C, Initpair, "init_pair");
+ begin
+ if Integer (Pair) >= Number_Of_Color_Pairs then
+ raise Constraint_Error;
+ end if;
+ if Integer (Fore) >= Number_Of_Colors or else
+ 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
+ raise Curses_Exception;
+ end if;
+ end Init_Pair;
+
+ procedure Pair_Content (Pair : in Color_Pair;
+ Fore : out Color_Number;
+ Back : out Color_Number)
+ is
+ type C_Short_Access is access all C_Short;
+ function Paircontent (Pair : C_Short;
+ Fp : C_Short_Access;
+ Bp : C_Short_Access) return C_Int;
+ pragma Import (C, Paircontent, "pair_content");
+
+ F, B : aliased C_Short;
+ begin
+ if Paircontent (C_Short (Pair), F'Access, B'Access) = Curses_Err then
+ raise Curses_Exception;
+ else
+ Fore := Color_Number (F);
+ Back := Color_Number (B);
+ end if;
+ end Pair_Content;
+
+ function Has_Colors return Boolean
+ is
+ function Hascolors return Curses_Bool;
+ pragma Import (C, Hascolors, "has_colors");
+ begin
+ if Hascolors = Curses_Bool_False then
+ return False;
+ else
+ return True;
+ end if;
+ end Has_Colors;
+
+ procedure Init_Color (Color : in Color_Number;
+ Red : in RGB_Value;
+ Green : in RGB_Value;
+ Blue : in RGB_Value)
+ is
+ function Initcolor (Col : C_Short;
+ Red : C_Short;
+ Green : C_Short;
+ Blue : C_Short) return C_Int;
+ pragma Import (C, Initcolor, "init_color");
+ begin
+ if Initcolor (C_Short (Color), C_Short (Red), C_Short (Green),
+ C_Short (Blue)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Init_Color;
+
+ function Can_Change_Color return Boolean
+ is
+ function Canchangecolor return Curses_Bool;
+ pragma Import (C, Canchangecolor, "can_change_color");
+ begin
+ if Canchangecolor = Curses_Bool_False then
+ return False;
+ else
+ return True;
+ end if;
+ end Can_Change_Color;
+
+ procedure Color_Content (Color : in Color_Number;
+ Red : out RGB_Value;
+ Green : out RGB_Value;
+ Blue : out RGB_Value)
+ is
+ type C_Short_Access is access all C_Short;
+
+ function Colorcontent (Color : C_Short; R, G, B : C_Short_Access)
+ return C_Int;
+ pragma Import (C, Colorcontent, "color_content");
+
+ R, G, B : aliased C_Short;
+ begin
+ if Colorcontent (C_Short (Color), R'Access, G'Access, B'Access) =
+ Curses_Err then
+ raise Curses_Exception;
+ else
+ Red := RGB_Value (R);
+ Green := RGB_Value (G);
+ Blue := RGB_Value (B);
+ end if;
+ end Color_Content;
+
+------------------------------------------------------------------------------
+ procedure Save_Curses_Mode (Mode : in Curses_Mode)
+ is
+ function Def_Prog_Mode return C_Int;
+ pragma Import (C, Def_Prog_Mode, "def_prog_mode");
+ function Def_Shell_Mode return C_Int;
+ pragma Import (C, Def_Shell_Mode, "def_shell_mode");
+
+ Err : C_Int;
+ begin
+ case Mode is
+ when Curses => Err := Def_Prog_Mode;
+ when Shell => Err := Def_Shell_Mode;
+ end case;
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Save_Curses_Mode;
+
+ procedure Reset_Curses_Mode (Mode : in Curses_Mode)
+ is
+ function Reset_Prog_Mode return C_Int;
+ pragma Import (C, Reset_Prog_Mode, "reset_prog_mode");
+ function Reset_Shell_Mode return C_Int;
+ pragma Import (C, Reset_Shell_Mode, "reset_shell_mode");
+
+ Err : C_Int;
+ begin
+ case Mode is
+ when Curses => Err := Reset_Prog_Mode;
+ when Shell => Err := Reset_Shell_Mode;
+ end case;
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Reset_Curses_Mode;
+
+ procedure Save_Terminal_State
+ is
+ function Savetty return C_Int;
+ pragma Import (C, Savetty, "savetty");
+ begin
+ if Savetty = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Save_Terminal_State;
+
+ procedure Reset_Terminal_State
+ is
+ function Resetty return C_Int;
+ pragma Import (C, Resetty, "resetty");
+ begin
+ if Resetty = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Reset_Terminal_State;
+
+ procedure Rip_Off_Lines (Lines : in Integer;
+ Proc : in Stdscr_Init_Proc)
+ is
+ function Ripoffline (Lines : C_Int;
+ Proc : Stdscr_Init_Proc) return C_Int;
+ pragma Import (C, Ripoffline, "_nc_ripoffline");
+ begin
+ if Ripoffline (C_Int (Lines), Proc) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Rip_Off_Lines;
+
+ procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility)
+ is
+ function Curs_Set (Curs : C_Int) return C_Int;
+ pragma Import (C, Curs_Set, "curs_set");
+
+ Res : C_Int;
+ begin
+ Res := Curs_Set (Cursor_Visibility'Pos (Visibility));
+ if Res /= Curses_Err then
+ Visibility := Cursor_Visibility'Val (Res);
+ end if;
+ end Set_Cursor_Visibility;
+
+ procedure Nap_Milli_Seconds (Ms : in Natural)
+ is
+ function Napms (Ms : C_Int) return C_Int;
+ pragma Import (C, Napms, "napms");
+ begin
+ if Napms (C_Int (Ms)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Nap_Milli_Seconds;
+------------------------------------------------------------------------------
+include(`Public_Variables')
+------------------------------------------------------------------------------
+ procedure Transform_Coordinates
+ (W : in Window := Standard_Window;
+ Line : in out Line_Position;
+ Column : in out Column_Position;
+ Dir : in Transform_Direction := From_Screen)
+ is
+ type Int_Access is access all C_Int;
+ function Transform (W : Window;
+ Y, X : Int_Access;
+ Dir : Curses_Bool) return C_Int;
+ pragma Import (C, Transform, "wmouse_trafo");
+
+ X : aliased C_Int := C_Int (Column);
+ Y : aliased C_Int := C_Int (Line);
+ D : Curses_Bool := Curses_Bool_False;
+ R : C_Int;
+ begin
+ if Dir = To_Screen then
+ D := 1;
+ end if;
+ R := Transform (W, Y'Access, X'Access, D);
+ if R = Curses_False then
+ raise Curses_Exception;
+ else
+ Line := Line_Position (Y);
+ Column := Column_Position (X);
+ end if;
+ end Transform_Coordinates;
+------------------------------------------------------------------------------
+ procedure Use_Default_Colors is
+ function C_Use_Default_Colors return C_Int;
+ pragma Import (C, C_Use_Default_Colors, "use_default_colors");
+ Err : constant C_Int := C_Use_Default_Colors;
+ begin
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Use_Default_Colors;
+
+ procedure Assume_Default_Colors (Fore : Color_Number := Default_Color;
+ Back : Color_Number := Default_Color)
+ is
+ function C_Assume_Default_Colors (Fore : C_Int;
+ Back : C_Int) return C_Int;
+ pragma Import (C, C_Assume_Default_Colors, "assume_default_colors");
+
+ Err : constant C_Int := C_Assume_Default_Colors (C_Int (Fore),
+ C_Int (Back));
+ begin
+ if Err = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Assume_Default_Colors;
+------------------------------------------------------------------------------
+ function Curses_Version return String
+ is
+ function curses_versionC return chars_ptr;
+ pragma Import (C, curses_versionC, "curses_version");
+ Result : constant chars_ptr := curses_versionC;
+ begin
+ return Fill_String (Result);
+ end Curses_Version;
+------------------------------------------------------------------------------
+ procedure Curses_Free_All is
+ procedure curses_freeall;
+ pragma Import (C, curses_freeall, "_nc_freeall");
+ begin
+ -- Use this only for testing: you cannot use curses after calling it,
+ -- so it has to be the "last" thing done before exiting the program.
+ -- This will not really free ALL of memory used by curses. That is
+ -- because it cannot free the memory used for stdout's setbuf. The
+ -- _nc_free_and_exit() procedure can do that, but it can be invoked
+ -- safely only from C - and again, that only as the "last" thing done
+ -- before exiting the program.
+ curses_freeall;
+ end Curses_Free_All;
+------------------------------------------------------------------------------
+ function Use_Extended_Names (Enable : Boolean) return Boolean
+ is
+ function use_extended_namesC (e : Curses_Bool) return C_Int;
+ pragma Import (C, use_extended_namesC, "use_extended_names");
+
+ Res : constant C_Int :=
+ use_extended_namesC (Curses_Bool (Boolean'Pos (Enable)));
+ begin
+ if Res = C_Int (Curses_Bool_False) then
+ return False;
+ else
+ return True;
+ end if;
+ end Use_Extended_Names;
+------------------------------------------------------------------------------
+ procedure Screen_Dump_To_File (Filename : in String)
+ is
+ function scr_dump (f : char_array) return C_Int;
+ pragma Import (C, scr_dump, "scr_dump");
+ Txt : char_array (0 .. Filename'Length);
+ Length : size_t;
+ begin
+ To_C (Filename, Txt, Length);
+ if Curses_Err = scr_dump (Txt) then
+ raise Curses_Exception;
+ end if;
+ end Screen_Dump_To_File;
+
+ procedure Screen_Restore_From_File (Filename : in String)
+ is
+ function scr_restore (f : char_array) return C_Int;
+ pragma Import (C, scr_restore, "scr_restore");
+ Txt : char_array (0 .. Filename'Length);
+ Length : size_t;
+ begin
+ To_C (Filename, Txt, Length);
+ if Curses_Err = scr_restore (Txt) then
+ raise Curses_Exception;
+ end if;
+ end Screen_Restore_From_File;
+
+ procedure Screen_Init_From_File (Filename : in String)
+ is
+ function scr_init (f : char_array) return C_Int;
+ pragma Import (C, scr_init, "scr_init");
+ Txt : char_array (0 .. Filename'Length);
+ Length : size_t;
+ begin
+ To_C (Filename, Txt, Length);
+ if Curses_Err = scr_init (Txt) then
+ raise Curses_Exception;
+ end if;
+ end Screen_Init_From_File;
+
+ procedure Screen_Set_File (Filename : in String)
+ is
+ function scr_set (f : char_array) return C_Int;
+ pragma Import (C, scr_set, "scr_set");
+ Txt : char_array (0 .. Filename'Length);
+ Length : size_t;
+ begin
+ To_C (Filename, Txt, Length);
+ if Curses_Err = scr_set (Txt) then
+ raise Curses_Exception;
+ end if;
+ end Screen_Set_File;
+------------------------------------------------------------------------------
+ procedure Resize (Win : Window := Standard_Window;
+ Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count) is
+ function wresize (win : Window;
+ lines : C_Int;
+ columns : C_Int) return C_Int;
+ pragma Import (C, wresize);
+ begin
+ if wresize (Win,
+ C_Int (Number_Of_Lines),
+ C_Int (Number_Of_Columns)) = Curses_Err then
+ raise Curses_Exception;
+ end if;
+ end Resize;
+------------------------------------------------------------------------------
+
+end Terminal_Interface.Curses;
diff --git a/Ada95/gen/terminal_interface-curses.ads.m4 b/Ada95/gen/terminal_interface-curses.ads.m4
new file mode 100644
index 0000000..4abc55e
--- /dev/null
+++ b/Ada95/gen/terminal_interface-curses.ads.m4
@@ -0,0 +1,1559 @@
+-- -*- ada -*-
+define(`HTMLNAME',`terminal_interface-curses__ads.htm')dnl
+include(M4MACRO)------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998-2006,2007 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"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
+-- Version Control:
+-- $Revision: 1.41 $
+-- $Date: 2007/05/05 20:33:52 $
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+include(`Base_Defs')
+with System.Storage_Elements;
+with Interfaces.C; -- We need this for some assertions.
+
+package Terminal_Interface.Curses is
+ pragma Preelaborate (Terminal_Interface.Curses);
+include(`Linker_Options')
+include(`Version_Info')
+ type Window is private;
+ Null_Window : constant Window;
+
+ type Line_Position is new Natural; -- line coordinate
+ type Column_Position is new Natural; -- column coordinate
+
+ subtype Line_Count is Line_Position range 1 .. Line_Position'Last;
+ -- Type to count lines. We do not allow null windows, so must be positive
+ subtype Column_Count is Column_Position range 1 .. Column_Position'Last;
+ -- Type to count columns. We do not allow null windows, so must be positive
+
+ type Key_Code is new Integer;
+ -- That is anything including real characters, special keys and logical
+ -- request codes.
+
+ -- FIXME: The "-1" should be Curses_Err
+ subtype Real_Key_Code is Key_Code range -1 .. M4_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;
+ -- 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.
+
+ -- Constants for function- and special keys
+ --
+ Key_None : constant Special_Key_Code := M4_SPECIAL_FIRST;
+include(`Key_Definitions')
+ Key_Max : constant Special_Key_Code
+ := Special_Key_Code'Last;
+
+ subtype User_Key_Code is Key_Code
+ range (Key_Max + 129) .. Key_Code'Last;
+ -- 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;
+ -- (n)curses uses a short for the color index
+ -- The model is, that a Color_Number is an index into an array of
+ -- (potentially) definable colors. Some of those indices are
+ -- predefined (see below), although they may not really exist.
+
+include(`Color_Defs')
+ 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.
+
+ type Color_Pair is range 0 .. 255;
+ for Color_Pair'Size use 8;
+ subtype Redefinable_Color_Pair is Color_Pair range 1 .. 255;
+ -- (n)curses reserves 1 Byte for the color-pair number. Color Pair 0
+ -- is fixed (Black & White). A color pair is simply a combination of
+ -- 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.
+
+ Normal_Video : constant Character_Attribute_Set := (others => False);
+
+ type Attributed_Character is
+ record
+ Attr : Character_Attribute_Set;
+ Color : Color_Pair;
+ Ch : Character;
+ end record;
+ pragma Convention (C, Attributed_Character);
+ -- This is the counterpart for the chtype in C.
+
+include(`AC_Rep')
+ 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);
+ -- In this binding we allow strings of attributed characters.
+
+ ------------------
+ -- Exceptions --
+ ------------------
+ Curses_Exception : exception;
+ Wrong_Curses_Version : exception;
+
+ -- Those exceptions are raised by the ETI (Extended Terminal Interface)
+ -- subpackets for Menu and Forms handling.
+ --
+ Eti_System_Error : exception;
+ Eti_Bad_Argument : exception;
+ Eti_Posted : exception;
+ Eti_Connected : exception;
+ Eti_Bad_State : exception;
+ Eti_No_Room : exception;
+ Eti_Not_Posted : exception;
+ Eti_Unknown_Command : exception;
+ Eti_No_Match : exception;
+ Eti_Not_Selectable : exception;
+ Eti_Not_Connected : exception;
+ Eti_Request_Denied : exception;
+ Eti_Invalid_Field : exception;
+ Eti_Current : exception;
+
+ --------------------------------------------------------------------------
+ -- External C variables
+ -- Conceptually even in C this are kind of constants, but they are
+ -- initialized and sometimes changed by the library routines at runtime
+ -- depending on the type of terminal. I believe the best way to model
+ -- this is to use functions.
+ --------------------------------------------------------------------------
+
+ function Lines return Line_Count;
+ pragma Inline (Lines);
+
+ function Columns return Column_Count;
+ pragma Inline (Columns);
+
+ function Tab_Size return Natural;
+ pragma Inline (Tab_Size);
+
+ function Number_Of_Colors return Natural;
+ pragma Inline (Number_Of_Colors);
+
+ function Number_Of_Color_Pairs return Natural;
+ pragma Inline (Number_Of_Color_Pairs);
+
+include(`ACS_Map')dnl
+
+ -- MANPAGE(`curs_initscr.3x')
+ -- | Not implemented: newterm, set_term, delscreen
+
+ -- ANCHOR(`stdscr',`Standard_Window')
+ function Standard_Window return Window;
+ -- AKA
+ pragma Inline (Standard_Window);
+
+ -- ANCHOR(`curscr',`Current_Window')
+ function Current_Window return Window;
+ -- AKA
+ pragma Inline (Current_Window);
+
+ -- ANCHOR(`initscr()',`Init_Screen')
+ procedure Init_Screen;
+
+ -- ANCHOR(`initscr()',`Init_Windows')
+ procedure Init_Windows renames Init_Screen;
+ -- AKA
+ pragma Inline (Init_Screen);
+ -- pragma Inline (Init_Windows);
+
+ -- ANCHOR(`endwin()',`End_Windows')
+ procedure End_Windows;
+ -- AKA
+ procedure End_Screen renames End_Windows;
+ pragma Inline (End_Windows);
+ -- pragma Inline (End_Screen);
+
+ -- ANCHOR(`isendwin()',`Is_End_Window')
+ function Is_End_Window return Boolean;
+ -- AKA
+ pragma Inline (Is_End_Window);
+
+ -- MANPAGE(`curs_move.3x')
+
+ -- ANCHOR(`wmove()',`Move_Cursor')
+ procedure Move_Cursor (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position);
+ -- AKA
+ -- ALIAS(`move()')
+ pragma Inline (Move_Cursor);
+
+ -- MANPAGE(`curs_addch.3x')
+
+ -- ANCHOR(`waddch()',`Add')
+ procedure Add (Win : in Window := Standard_Window;
+ Ch : in Attributed_Character);
+ -- AKA
+ -- ALIAS(`addch()')
+
+ procedure Add (Win : in Window := Standard_Window;
+ Ch : in Character);
+ -- Add a single character at the current logical cursor position to
+ -- the window. Use the current windows attributes.
+
+ -- ANCHOR(`mvwaddch()',`Add')
+ procedure Add
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Ch : in Attributed_Character);
+ -- AKA
+ -- ALIAS(`mvaddch()')
+
+ procedure Add
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Ch : in Character);
+ -- Move to the position and add a single character into the window
+ -- There are more Add routines, so the Inline pragma follows later
+
+ -- ANCHOR(`wechochar()',`Add_With_Immediate_Echo')
+ procedure Add_With_Immediate_Echo
+ (Win : in Window := Standard_Window;
+ Ch : in Attributed_Character);
+ -- AKA
+ -- ALIAS(`echochar()')
+
+ procedure Add_With_Immediate_Echo
+ (Win : in Window := Standard_Window;
+ Ch : in Character);
+ -- Add a character and do an immediate refresh of the screen.
+ pragma Inline (Add_With_Immediate_Echo);
+
+ -- MANPAGE(`curs_window.3x')
+ -- Not Implemented: wcursyncup
+
+ -- ANCHOR(`newwin()',`Create')
+ function Create
+ (Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count;
+ First_Line_Position : Line_Position;
+ First_Column_Position : Column_Position) return Window;
+ -- Not Implemented: Default Number_Of_Lines, Number_Of_Columns
+ -- the C version lets them be 0, see the man page.
+ -- AKA
+ pragma Inline (Create);
+
+ function New_Window
+ (Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count;
+ First_Line_Position : Line_Position;
+ First_Column_Position : Column_Position) return Window
+ renames Create;
+ -- pragma Inline (New_Window);
+
+ -- ANCHOR(`delwin()',`Delete')
+ procedure Delete (Win : in out Window);
+ -- AKA
+ -- Reset Win to Null_Window
+ pragma Inline (Delete);
+
+ -- ANCHOR(`subwin()',`Sub_Window')
+ function Sub_Window
+ (Win : Window := Standard_Window;
+ Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count;
+ First_Line_Position : Line_Position;
+ First_Column_Position : Column_Position) return Window;
+ -- AKA
+ pragma Inline (Sub_Window);
+
+ -- ANCHOR(`derwin()',`Derived_Window')
+ function Derived_Window
+ (Win : Window := Standard_Window;
+ Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count;
+ First_Line_Position : Line_Position;
+ First_Column_Position : Column_Position) return Window;
+ -- AKA
+ pragma Inline (Derived_Window);
+
+ -- ANCHOR(`dupwin()',`Duplicate')
+ function Duplicate (Win : Window) return Window;
+ -- AKA
+ pragma Inline (Duplicate);
+
+ -- ANCHOR(`mvwin()',`Move_Window')
+ procedure Move_Window (Win : in Window;
+ Line : in Line_Position;
+ Column : in Column_Position);
+ -- AKA
+ pragma Inline (Move_Window);
+
+ -- ANCHOR(`mvderwin()',`Move_Derived_Window')
+ procedure Move_Derived_Window (Win : in Window;
+ Line : in Line_Position;
+ Column : in Column_Position);
+ -- AKA
+ pragma Inline (Move_Derived_Window);
+
+ -- ANCHOR(`wsyncup()',`Synchronize_Upwards')
+ procedure Synchronize_Upwards (Win : in Window);
+ -- AKA
+ pragma Import (C, Synchronize_Upwards, "wsyncup");
+
+ -- ANCHOR(`wsyncdown()',`Synchronize_Downwards')
+ procedure Synchronize_Downwards (Win : in Window);
+ -- AKA
+ pragma Import (C, Synchronize_Downwards, "wsyncdown");
+
+ -- ANCHOR(`syncok()',`Set_Synch_Mode')
+ procedure Set_Synch_Mode (Win : in Window := Standard_Window;
+ Mode : in Boolean := False);
+ -- AKA
+ pragma Inline (Set_Synch_Mode);
+
+ -- MANPAGE(`curs_addstr.3x')
+
+ -- ANCHOR(`waddnstr()',`Add')
+ procedure Add (Win : in Window := Standard_Window;
+ Str : in String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`waddstr()')
+ -- ALIAS(`addnstr()')
+ -- ALIAS(`addstr()')
+
+ -- ANCHOR(`mvwaddnstr()',`Add')
+ procedure Add (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : in String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`mvwaddstr()')
+ -- ALIAS(`mvaddnstr()')
+ -- ALIAS(`mvaddstr()')
+
+ -- MANPAGE(`curs_addchstr.3x')
+
+ -- ANCHOR(`waddchnstr()',`Add')
+ procedure Add (Win : in Window := Standard_Window;
+ Str : in Attributed_String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`waddchstr()')
+ -- ALIAS(`addchnstr()')
+ -- ALIAS(`addchstr()')
+
+ -- ANCHOR(`mvwaddchnstr()',`Add')
+ procedure Add (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : in Attributed_String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`mvwaddchstr()')
+ -- ALIAS(`mvaddchnstr()')
+ -- ALIAS(`mvaddchstr()')
+ pragma Inline (Add);
+
+ -- MANPAGE(`curs_border.3x')
+ -- | Not implemented: mvhline, mvwhline, mvvline, mvwvline
+ -- | use Move_Cursor then Horizontal_Line or Vertical_Line
+
+ -- ANCHOR(`wborder()',`Border')
+ procedure Border
+ (Win : in Window := Standard_Window;
+ Left_Side_Symbol : in Attributed_Character := Default_Character;
+ Right_Side_Symbol : in Attributed_Character := Default_Character;
+ Top_Side_Symbol : in Attributed_Character := Default_Character;
+ Bottom_Side_Symbol : in Attributed_Character := Default_Character;
+ Upper_Left_Corner_Symbol : in Attributed_Character := Default_Character;
+ Upper_Right_Corner_Symbol : in Attributed_Character := Default_Character;
+ Lower_Left_Corner_Symbol : in Attributed_Character := Default_Character;
+ Lower_Right_Corner_Symbol : in Attributed_Character := Default_Character
+ );
+ -- AKA
+ -- ALIAS(`border()')
+ pragma Inline (Border);
+
+ -- ANCHOR(`box()',`Box')
+ procedure Box
+ (Win : in Window := Standard_Window;
+ Vertical_Symbol : in Attributed_Character := Default_Character;
+ Horizontal_Symbol : in Attributed_Character := Default_Character);
+ -- AKA
+ pragma Inline (Box);
+
+ -- ANCHOR(`whline()',`Horizontal_Line')
+ procedure Horizontal_Line
+ (Win : in Window := Standard_Window;
+ Line_Size : in Natural;
+ Line_Symbol : in Attributed_Character := Default_Character);
+ -- AKA
+ -- ALIAS(`hline()')
+ pragma Inline (Horizontal_Line);
+
+ -- ANCHOR(`wvline()',`Vertical_Line')
+ procedure Vertical_Line
+ (Win : in Window := Standard_Window;
+ Line_Size : in Natural;
+ Line_Symbol : in Attributed_Character := Default_Character);
+ -- AKA
+ -- ALIAS(`vline()')
+ pragma Inline (Vertical_Line);
+
+ -- MANPAGE(`curs_getch.3x')
+ -- Not implemented: mvgetch, mvwgetch
+
+ -- ANCHOR(`wgetch()',`Get_Keystroke')
+ function Get_Keystroke (Win : Window := Standard_Window)
+ return Real_Key_Code;
+ -- AKA
+ -- ALIAS(`getch()')
+ -- Get a character from the keyboard and echo it - if enabled - to the
+ -- window.
+ -- If for any reason (i.e. a timeout) we couldn't get a character the
+ -- returned keycode is Key_None.
+ pragma Inline (Get_Keystroke);
+
+ -- ANCHOR(`ungetch()',`Undo_Keystroke')
+ procedure Undo_Keystroke (Key : in Real_Key_Code);
+ -- AKA
+ pragma Inline (Undo_Keystroke);
+
+ -- ANCHOR(`has_key()',`Has_Key')
+ function Has_Key (Key : Special_Key_Code) return Boolean;
+ -- AKA
+ pragma Inline (Has_Key);
+
+ -- |
+ -- | Some helper functions
+ -- |
+ function Is_Function_Key (Key : Special_Key_Code) return Boolean;
+ -- Return True if the Key is a function key (i.e. one of F0 .. F63)
+ pragma Inline (Is_Function_Key);
+
+ subtype Function_Key_Number is Integer range 0 .. 63;
+ -- (n)curses allows for 64 function keys.
+
+ function Function_Key (Key : Real_Key_Code) return Function_Key_Number;
+ -- Return the number of the function key. If the code is not a
+ -- function key, a CONSTRAINT_ERROR will be raised.
+ pragma Inline (Function_Key);
+
+ function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code;
+ -- Return the key code for a given function-key number.
+ pragma Inline (Function_Key_Code);
+
+ -- MANPAGE(`curs_attr.3x')
+ -- | Not implemented attr_off, wattr_off,
+ -- | attr_on, wattr_on, attr_set, wattr_set
+
+ -- PAIR_NUMBER
+ -- PAIR_NUMBER(c) is the same as c.Color
+
+ -- ANCHOR(`standout()',`Standout')
+ procedure Standout (Win : Window := Standard_Window;
+ On : Boolean := True);
+ -- ALIAS(`wstandout()')
+ -- ALIAS(`wstandend()')
+
+ -- ANCHOR(`wattron()',`Switch_Character_Attribute')
+ procedure Switch_Character_Attribute
+ (Win : in Window := Standard_Window;
+ Attr : in Character_Attribute_Set := Normal_Video;
+ On : in Boolean := True); -- if False we switch Off.
+ -- Switches those Attributes set to true in the list.
+ -- AKA
+ -- ALIAS(`wattroff()')
+ -- ALIAS(`attron()')
+ -- ALIAS(`attroff()')
+
+ -- ANCHOR(`wattrset()',`Set_Character_Attributes')
+ procedure Set_Character_Attributes
+ (Win : in Window := Standard_Window;
+ Attr : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First);
+ -- AKA
+ -- ALIAS(`attrset()')
+ pragma Inline (Set_Character_Attributes);
+
+ -- ANCHOR(`wattr_get()',`Get_Character_Attributes')
+ function Get_Character_Attribute
+ (Win : in Window := Standard_Window) return Character_Attribute_Set;
+ -- AKA
+ -- ALIAS(`attr_get()')
+
+ -- ANCHOR(`wattr_get()',`Get_Character_Attribute')
+ function Get_Character_Attribute
+ (Win : in Window := Standard_Window) return Color_Pair;
+ -- AKA
+ pragma Inline (Get_Character_Attribute);
+
+ -- ANCHOR(`wcolor_set()',`Set_Color')
+ procedure Set_Color (Win : in Window := Standard_Window;
+ Pair : in Color_Pair);
+ -- AKA
+ -- ALIAS(`color_set()')
+ pragma Inline (Set_Color);
+
+ -- ANCHOR(`wchgat()',`Change_Attributes')
+ procedure Change_Attributes
+ (Win : in Window := Standard_Window;
+ Count : in Integer := -1;
+ Attr : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First);
+ -- AKA
+ -- ALIAS(`chgat()')
+
+ -- ANCHOR(`mvwchgat()',`Change_Attributes')
+ procedure Change_Attributes
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position := Line_Position'First;
+ Column : in Column_Position := Column_Position'First;
+ Count : in Integer := -1;
+ Attr : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First);
+ -- AKA
+ -- ALIAS(`mvchgat()')
+ pragma Inline (Change_Attributes);
+
+ -- MANPAGE(`curs_beep.3x')
+
+ -- ANCHOR(`beep()',`Beep')
+ procedure Beep;
+ -- AKA
+ pragma Inline (Beep);
+
+ -- ANCHOR(`flash()',`Flash_Screen')
+ procedure Flash_Screen;
+ -- AKA
+ pragma Inline (Flash_Screen);
+
+ -- MANPAGE(`curs_inopts.3x')
+
+ -- | Not implemented : typeahead
+ --
+ -- ANCHOR(`cbreak()',`Set_Cbreak_Mode')
+ procedure Set_Cbreak_Mode (SwitchOn : in Boolean := True);
+ -- AKA
+ -- ALIAS(`nocbreak()')
+ pragma Inline (Set_Cbreak_Mode);
+
+ -- ANCHOR(`raw()',`Set_Raw_Mode')
+ procedure Set_Raw_Mode (SwitchOn : in Boolean := True);
+ -- AKA
+ -- ALIAS(`noraw()')
+ pragma Inline (Set_Raw_Mode);
+
+ -- ANCHOR(`echo()',`Set_Echo_Mode')
+ procedure Set_Echo_Mode (SwitchOn : in Boolean := True);
+ -- AKA
+ -- ALIAS(`noecho()')
+ pragma Inline (Set_Echo_Mode);
+
+ -- ANCHOR(`meta()',`Set_Meta_Mode')
+ procedure Set_Meta_Mode (Win : in Window := Standard_Window;
+ SwitchOn : in Boolean := True);
+ -- AKA
+ pragma Inline (Set_Meta_Mode);
+
+ -- ANCHOR(`keypad()',`Set_KeyPad_Mode')
+ procedure Set_KeyPad_Mode (Win : in Window := Standard_Window;
+ SwitchOn : in Boolean := True);
+ -- AKA
+ pragma Inline (Set_KeyPad_Mode);
+
+ function Get_KeyPad_Mode (Win : in Window := Standard_Window)
+ return Boolean;
+ -- This has no pendant in C. There you've to look into the WINDOWS
+ -- structure to get the value. Bad practice, not repeated in Ada.
+
+ type Half_Delay_Amount is range 1 .. 255;
+
+ -- ANCHOR(`halfdelay()',`Half_Delay')
+ procedure Half_Delay (Amount : in Half_Delay_Amount);
+ -- AKA
+ pragma Inline (Half_Delay);
+
+ -- ANCHOR(`intrflush()',`Set_Flush_On_Interrupt_Mode')
+ procedure Set_Flush_On_Interrupt_Mode
+ (Win : in Window := Standard_Window;
+ Mode : in Boolean := True);
+ -- AKA
+ pragma Inline (Set_Flush_On_Interrupt_Mode);
+
+ -- ANCHOR(`qiflush()',`Set_Queue_Interrupt_Mode')
+ procedure Set_Queue_Interrupt_Mode
+ (Win : in Window := Standard_Window;
+ Flush : in Boolean := True);
+ -- AKA
+ -- ALIAS(`noqiflush()')
+ pragma Inline (Set_Queue_Interrupt_Mode);
+
+ -- ANCHOR(`nodelay()',`Set_NoDelay_Mode')
+ procedure Set_NoDelay_Mode
+ (Win : in Window := Standard_Window;
+ Mode : in Boolean := False);
+ -- AKA
+ pragma Inline (Set_NoDelay_Mode);
+
+ type Timeout_Mode is (Blocking, Non_Blocking, Delayed);
+
+ -- ANCHOR(`wtimeout()',`Set_Timeout_Mode')
+ procedure Set_Timeout_Mode (Win : in Window := Standard_Window;
+ Mode : in Timeout_Mode;
+ Amount : in Natural); -- in Milliseconds
+ -- AKA
+ -- ALIAS(`timeout()')
+ -- Instead of overloading the semantic of the sign of amount, we
+ -- introduce the Timeout_Mode parameter. This should improve
+ -- readability. For Blocking and Non_Blocking, the Amount is not
+ -- evaluated.
+ -- We don't inline this procedure.
+
+ -- ANCHOR(`notimeout()',`Set_Escape_Time_Mode')
+ procedure Set_Escape_Timer_Mode
+ (Win : in Window := Standard_Window;
+ Timer_Off : in Boolean := False);
+ -- AKA
+ pragma Inline (Set_Escape_Timer_Mode);
+
+ -- MANPAGE(`curs_outopts.3x')
+
+ -- ANCHOR(`nl()',`Set_NL_Mode')
+ procedure Set_NL_Mode (SwitchOn : in Boolean := True);
+ -- AKA
+ -- ALIAS(`nonl()')
+ pragma Inline (Set_NL_Mode);
+
+ -- ANCHOR(`clearok()',`Clear_On_Next_Update')
+ procedure Clear_On_Next_Update
+ (Win : in Window := Standard_Window;
+ Do_Clear : in Boolean := True);
+ -- AKA
+ pragma Inline (Clear_On_Next_Update);
+
+ -- ANCHOR(`idlok()',`Use_Insert_Delete_Line')
+ procedure Use_Insert_Delete_Line
+ (Win : in Window := Standard_Window;
+ Do_Idl : in Boolean := True);
+ -- AKA
+ pragma Inline (Use_Insert_Delete_Line);
+
+ -- ANCHOR(`idcok()',`Use_Insert_Delete_Character')
+ procedure Use_Insert_Delete_Character
+ (Win : in Window := Standard_Window;
+ Do_Idc : in Boolean := True);
+ -- AKA
+ pragma Inline (Use_Insert_Delete_Character);
+
+ -- ANCHOR(`leaveok()',`Leave_Cursor_After_Update')
+ procedure Leave_Cursor_After_Update
+ (Win : in Window := Standard_Window;
+ Do_Leave : in Boolean := True);
+ -- AKA
+ pragma Inline (Leave_Cursor_After_Update);
+
+ -- ANCHOR(`immedok()',`Immediate_Update_Mode')
+ procedure Immediate_Update_Mode
+ (Win : in Window := Standard_Window;
+ Mode : in Boolean := False);
+ -- AKA
+ pragma Inline (Immediate_Update_Mode);
+
+ -- ANCHOR(`scrollok()',`Allow_Scrolling')
+ procedure Allow_Scrolling
+ (Win : in Window := Standard_Window;
+ Mode : in Boolean := False);
+ -- AKA
+ pragma Inline (Allow_Scrolling);
+
+ function Scrolling_Allowed (Win : Window := Standard_Window) return Boolean;
+ -- There is no such function in the C interface.
+ pragma Inline (Scrolling_Allowed);
+
+ -- ANCHOR(`wsetscrreg()',`Set_Scroll_Region')
+ procedure Set_Scroll_Region
+ (Win : in Window := Standard_Window;
+ Top_Line : in Line_Position;
+ Bottom_Line : in Line_Position);
+ -- AKA
+ -- ALIAS(`setscrreg()')
+ pragma Inline (Set_Scroll_Region);
+
+ -- MANPAGE(`curs_refresh.3x')
+
+ -- ANCHOR(`doupdate()',`Update_Screen')
+ procedure Update_Screen;
+ -- AKA
+ pragma Inline (Update_Screen);
+
+ -- ANCHOR(`wrefresh()',`Refresh')
+ procedure Refresh (Win : in Window := Standard_Window);
+ -- AKA
+ -- There is an overloaded Refresh for Pads.
+ -- The Inline pragma appears there
+ -- ALIAS(`refresh()')
+
+ -- ANCHOR(`wnoutrefresh()',`Refresh_Without_Update')
+ procedure Refresh_Without_Update
+ (Win : in Window := Standard_Window);
+ -- AKA
+ -- There is an overloaded Refresh_Without_Update for Pads.
+ -- The Inline pragma appears there
+
+ -- ANCHOR(`redrawwin()',`Redraw')
+ procedure Redraw (Win : in Window := Standard_Window);
+ -- AKA
+
+ -- ANCHOR(`wredrawln()',`Redraw')
+ procedure Redraw (Win : in Window := Standard_Window;
+ Begin_Line : in Line_Position;
+ Line_Count : in Positive);
+ -- AKA
+ pragma Inline (Redraw);
+
+ -- MANPAGE(`curs_clear.3x')
+
+ -- ANCHOR(`werase()',`Erase')
+ procedure Erase (Win : in Window := Standard_Window);
+ -- AKA
+ -- ALIAS(`erase()')
+ pragma Inline (Erase);
+
+ -- ANCHOR(`wclear()',`Clear')
+ procedure Clear
+ (Win : in Window := Standard_Window);
+ -- AKA
+ -- ALIAS(`clear()')
+ pragma Inline (Clear);
+
+ -- ANCHOR(`wclrtobot()',`Clear_To_End_Of_Screen')
+ procedure Clear_To_End_Of_Screen
+ (Win : in Window := Standard_Window);
+ -- AKA
+ -- ALIAS(`clrtobot()')
+ pragma Inline (Clear_To_End_Of_Screen);
+
+ -- ANCHOR(`wclrtoeol()',`Clear_To_End_Of_Line')
+ procedure Clear_To_End_Of_Line
+ (Win : in Window := Standard_Window);
+ -- AKA
+ -- ALIAS(`clrtoeol()')
+ pragma Inline (Clear_To_End_Of_Line);
+
+ -- MANPAGE(`curs_bkgd.3x')
+
+ -- ANCHOR(`wbkgdset()',`Set_Background')
+ -- TODO: we could have Set_Background(Window; Character_Attribute_Set)
+ -- because in C it is common to see bkgdset(A_BOLD) or
+ -- bkgdset(COLOR_PAIR(n))
+ procedure Set_Background
+ (Win : in Window := Standard_Window;
+ Ch : in Attributed_Character);
+ -- AKA
+ -- ALIAS(`bkgdset()')
+ pragma Inline (Set_Background);
+
+ -- ANCHOR(`wbkgd()',`Change_Background')
+ procedure Change_Background
+ (Win : in Window := Standard_Window;
+ Ch : in Attributed_Character);
+ -- AKA
+ -- ALIAS(`bkgd()')
+ pragma Inline (Change_Background);
+
+ -- ANCHOR(`wbkgdget()',`Get_Background')
+ -- ? wbkgdget is not listed in curs_bkgd, getbkgd is thpough.
+ function Get_Background (Win : Window := Standard_Window)
+ return Attributed_Character;
+ -- AKA
+ -- ALIAS(`bkgdget()')
+ pragma Inline (Get_Background);
+
+ -- MANPAGE(`curs_touch.3x')
+
+ -- ANCHOR(`untouchwin()',`Untouch')
+ procedure Untouch (Win : in Window := Standard_Window);
+ -- AKA
+ pragma Inline (Untouch);
+
+ -- ANCHOR(`touchwin()',`Touch')
+ procedure Touch (Win : in Window := Standard_Window);
+ -- AKA
+
+ -- ANCHOR(`touchline()',`Touch')
+ procedure Touch (Win : in Window := Standard_Window;
+ Start : in Line_Position;
+ Count : in Positive);
+ -- AKA
+ pragma Inline (Touch);
+
+ -- ANCHOR(`wtouchln()',`Change_Line_Status')
+ procedure Change_Lines_Status (Win : in Window := Standard_Window;
+ Start : in Line_Position;
+ Count : in Positive;
+ State : in Boolean);
+ -- AKA
+ pragma Inline (Change_Lines_Status);
+
+ -- ANCHOR(`is_linetouched()',`Is_Touched')
+ function Is_Touched (Win : Window := Standard_Window;
+ Line : Line_Position) return Boolean;
+ -- AKA
+
+ -- ANCHOR(`is_wintouched()',`Is_Touched')
+ function Is_Touched (Win : Window := Standard_Window) return Boolean;
+ -- AKA
+ pragma Inline (Is_Touched);
+
+ -- MANPAGE(`curs_overlay.3x')
+
+ -- ANCHOR(`copywin()',`Copy')
+ procedure Copy
+ (Source_Window : in Window;
+ Destination_Window : in Window;
+ Source_Top_Row : in Line_Position;
+ Source_Left_Column : in Column_Position;
+ Destination_Top_Row : in Line_Position;
+ Destination_Left_Column : in Column_Position;
+ Destination_Bottom_Row : in Line_Position;
+ Destination_Right_Column : in Column_Position;
+ Non_Destructive_Mode : in Boolean := True);
+ -- AKA
+ pragma Inline (Copy);
+
+ -- ANCHOR(`overwrite()',`Overwrite')
+ procedure Overwrite (Source_Window : in Window;
+ Destination_Window : in Window);
+ -- AKA
+ pragma Inline (Overwrite);
+
+ -- ANCHOR(`overlay()',`Overlay')
+ procedure Overlay (Source_Window : in Window;
+ Destination_Window : in Window);
+ -- AKA
+ pragma Inline (Overlay);
+
+ -- MANPAGE(`curs_deleteln.3x')
+
+ -- ANCHOR(`winsdelln()',`Insert_Delete_Lines')
+ procedure Insert_Delete_Lines
+ (Win : in Window := Standard_Window;
+ Lines : in Integer := 1); -- default is to insert one line above
+ -- AKA
+ -- ALIAS(`insdelln()')
+ pragma Inline (Insert_Delete_Lines);
+
+ -- ANCHOR(`wdeleteln()',`Delete_Line')
+ procedure Delete_Line (Win : in Window := Standard_Window);
+ -- AKA
+ -- ALIAS(`deleteln()')
+ pragma Inline (Delete_Line);
+
+ -- ANCHOR(`winsertln()',`Insert_Line')
+ procedure Insert_Line (Win : in Window := Standard_Window);
+ -- AKA
+ -- ALIAS(`insertln()')
+ pragma Inline (Insert_Line);
+
+ -- MANPAGE(`curs_getyx.3x')
+
+ -- ANCHOR(`getmaxyx()',`Get_Size')
+ procedure Get_Size
+ (Win : in Window := Standard_Window;
+ Number_Of_Lines : out Line_Count;
+ Number_Of_Columns : out Column_Count);
+ -- AKA
+ pragma Inline (Get_Size);
+
+ -- ANCHOR(`getbegyx()',`Get_Window_Position')
+ procedure Get_Window_Position
+ (Win : in Window := Standard_Window;
+ Top_Left_Line : out Line_Position;
+ Top_Left_Column : out Column_Position);
+ -- AKA
+ pragma Inline (Get_Window_Position);
+
+ -- ANCHOR(`getyx()',`Get_Cursor_Position')
+ procedure Get_Cursor_Position
+ (Win : in Window := Standard_Window;
+ Line : out Line_Position;
+ Column : out Column_Position);
+ -- AKA
+ pragma Inline (Get_Cursor_Position);
+
+ -- ANCHOR(`getparyx()',`Get_Origin_Relative_To_Parent')
+ procedure Get_Origin_Relative_To_Parent
+ (Win : in Window;
+ Top_Left_Line : out Line_Position;
+ Top_Left_Column : out Column_Position;
+ Is_Not_A_Subwindow : out Boolean);
+ -- AKA
+ -- Instead of placing -1 in the coordinates as return, we use a boolean
+ -- to return the info that the window has no parent.
+ pragma Inline (Get_Origin_Relative_To_Parent);
+
+ -- MANPAGE(`curs_pad.3x')
+
+ -- ANCHOR(`newpad()',`New_Pad')
+ function New_Pad (Lines : Line_Count;
+ Columns : Column_Count) return Window;
+ -- AKA
+ pragma Inline (New_Pad);
+
+ -- ANCHOR(`subpad()',`Sub_Pad')
+ function Sub_Pad
+ (Pad : Window;
+ Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count;
+ First_Line_Position : Line_Position;
+ First_Column_Position : Column_Position) return Window;
+ -- AKA
+ pragma Inline (Sub_Pad);
+
+ -- ANCHOR(`prefresh()',`Refresh')
+ procedure Refresh
+ (Pad : in Window;
+ Source_Top_Row : in Line_Position;
+ Source_Left_Column : in Column_Position;
+ Destination_Top_Row : in Line_Position;
+ Destination_Left_Column : in Column_Position;
+ Destination_Bottom_Row : in Line_Position;
+ Destination_Right_Column : in Column_Position);
+ -- AKA
+ pragma Inline (Refresh);
+
+ -- ANCHOR(`pnoutrefresh()',`Refresh_Without_Update')
+ procedure Refresh_Without_Update
+ (Pad : in Window;
+ Source_Top_Row : in Line_Position;
+ Source_Left_Column : in Column_Position;
+ Destination_Top_Row : in Line_Position;
+ Destination_Left_Column : in Column_Position;
+ Destination_Bottom_Row : in Line_Position;
+ Destination_Right_Column : in Column_Position);
+ -- AKA
+ pragma Inline (Refresh_Without_Update);
+
+ -- ANCHOR(`pechochar()',`Add_Character_To_Pad_And_Echo_It')
+ procedure Add_Character_To_Pad_And_Echo_It
+ (Pad : in Window;
+ Ch : in Attributed_Character);
+ -- AKA
+
+ procedure Add_Character_To_Pad_And_Echo_It
+ (Pad : in Window;
+ Ch : in Character);
+ pragma Inline (Add_Character_To_Pad_And_Echo_It);
+
+ -- MANPAGE(`curs_scroll.3x')
+
+ -- ANCHOR(`wscrl()',`Scroll')
+ procedure Scroll (Win : in Window := Standard_Window;
+ Amount : in Integer := 1);
+ -- AKA
+ -- ALIAS(`scroll()')
+ -- ALIAS(`scrl()')
+ pragma Inline (Scroll);
+
+ -- MANPAGE(`curs_delch.3x')
+
+ -- ANCHOR(`wdelch()',`Delete_Character')
+ procedure Delete_Character (Win : in Window := Standard_Window);
+ -- AKA
+ -- ALIAS(`delch()')
+
+ -- ANCHOR(`mvwdelch()',`Delete_Character')
+ procedure Delete_Character
+ (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position);
+ -- AKA
+ -- ALIAS(`mvdelch()')
+ pragma Inline (Delete_Character);
+
+ -- MANPAGE(`curs_inch.3x')
+
+ -- ANCHOR(`winch()',`Peek')
+ function Peek (Win : Window := Standard_Window)
+ return Attributed_Character;
+ -- ALIAS(`inch()')
+ -- AKA
+
+ -- ANCHOR(`mvwinch()',`Peek')
+ function Peek
+ (Win : Window := Standard_Window;
+ Line : Line_Position;
+ Column : Column_Position) return Attributed_Character;
+ -- AKA
+ -- ALIAS(`mvinch()')
+ -- More Peek's follow, pragma Inline appears later.
+
+ -- MANPAGE(`curs_insch.3x')
+
+ -- ANCHOR(`winsch()',`Insert')
+ procedure Insert (Win : in Window := Standard_Window;
+ Ch : in Attributed_Character);
+ -- AKA
+ -- ALIAS(`insch()')
+
+ -- ANCHOR(`mvwinsch()',`Insert')
+ procedure Insert (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Ch : in Attributed_Character);
+ -- AKA
+ -- ALIAS(`mvinsch()')
+
+ -- MANPAGE(`curs_insstr.3x')
+
+ -- ANCHOR(`winsnstr()',`Insert')
+ procedure Insert (Win : in Window := Standard_Window;
+ Str : in String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`winsstr()')
+ -- ALIAS(`insnstr()')
+ -- ALIAS(`insstr()')
+
+ -- ANCHOR(`mvwinsnstr()',`Insert')
+ procedure Insert (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : in String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`mvwinsstr()')
+ -- ALIAS(`mvinsnstr()')
+ -- ALIAS(`mvinsstr()')
+ pragma Inline (Insert);
+
+ -- MANPAGE(`curs_instr.3x')
+
+ -- ANCHOR(`winnstr()',`Peek')
+ procedure Peek (Win : in Window := Standard_Window;
+ Str : out String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`winstr()')
+ -- ALIAS(`innstr()')
+ -- ALIAS(`instr()')
+
+ -- ANCHOR(`mvwinnstr()',`Peek')
+ procedure Peek (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : out String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`mvwinstr()')
+ -- ALIAS(`mvinnstr()')
+ -- ALIAS(`mvinstr()')
+
+ -- MANPAGE(`curs_inchstr.3x')
+
+ -- ANCHOR(`winchnstr()',`Peek')
+ procedure Peek (Win : in Window := Standard_Window;
+ Str : out Attributed_String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`winchstr()')
+ -- ALIAS(`inchnstr()')
+ -- ALIAS(`inchstr()')
+
+ -- ANCHOR(`mvwinchnstr()',`Peek')
+ procedure Peek (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : out Attributed_String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`mvwinchstr()')
+ -- ALIAS(`mvinchnstr()')
+ -- ALIAS(`mvinchstr()')
+ -- We don't inline the Peek procedures
+
+ -- MANPAGE(`curs_getstr.3x')
+
+ -- ANCHOR(`wgetnstr()',`Get')
+ procedure Get (Win : in Window := Standard_Window;
+ Str : out String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`wgetstr()')
+ -- ALIAS(`getnstr()')
+ -- ALIAS(`getstr()')
+ -- actually getstr is not supported because that results in buffer
+ -- overflows.
+
+ -- ANCHOR(`mvwgetnstr()',`Get')
+ procedure Get (Win : in Window := Standard_Window;
+ Line : in Line_Position;
+ Column : in Column_Position;
+ Str : out String;
+ Len : in Integer := -1);
+ -- AKA
+ -- ALIAS(`mvwgetstr()')
+ -- ALIAS(`mvgetnstr()')
+ -- ALIAS(`mvgetstr()')
+ -- Get is not inlined
+
+ -- MANPAGE(`curs_slk.3x')
+
+ -- Not Implemented: slk_attr_on, slk_attr_off, slk_attr_set
+
+ type Soft_Label_Key_Format is (Three_Two_Three,
+ Four_Four,
+ PC_Style, -- ncurses specific
+ PC_Style_With_Index); -- "
+ type Label_Number is new Positive range 1 .. 12;
+ type Label_Justification is (Left, Centered, Right);
+
+ -- ANCHOR(`slk_init()',`Init_Soft_Label_Keys')
+ procedure Init_Soft_Label_Keys
+ (Format : in Soft_Label_Key_Format := Three_Two_Three);
+ -- AKA
+ pragma Inline (Init_Soft_Label_Keys);
+
+ -- ANCHOR(`slk_set()',`Set_Soft_Label_Key')
+ procedure Set_Soft_Label_Key (Label : in Label_Number;
+ Text : in String;
+ Fmt : in Label_Justification := Left);
+ -- AKA
+ -- We don't inline this procedure
+
+ -- ANCHOR(`slk_refresh()',`Refresh_Soft_Label_Key')
+ procedure Refresh_Soft_Label_Keys;
+ -- AKA
+ pragma Inline (Refresh_Soft_Label_Keys);
+
+ -- ANCHOR(`slk_noutrefresh()',`Refresh_Soft_Label_Keys_Without_Update')
+ procedure Refresh_Soft_Label_Keys_Without_Update;
+ -- AKA
+ pragma Inline (Refresh_Soft_Label_Keys_Without_Update);
+
+ -- ANCHOR(`slk_label()',`Get_Soft_Label_Key')
+ procedure Get_Soft_Label_Key (Label : in Label_Number;
+ Text : out String);
+ -- AKA
+
+ -- ANCHOR(`slk_label()',`Get_Soft_Label_Key')
+ function Get_Soft_Label_Key (Label : in Label_Number) return String;
+ -- AKA
+ -- Same as function
+ pragma Inline (Get_Soft_Label_Key);
+
+ -- ANCHOR(`slk_clear()',`Clear_Soft_Label_Keys')
+ procedure Clear_Soft_Label_Keys;
+ -- AKA
+ pragma Inline (Clear_Soft_Label_Keys);
+
+ -- ANCHOR(`slk_restore()',`Restore_Soft_Label_Keys')
+ procedure Restore_Soft_Label_Keys;
+ -- AKA
+ pragma Inline (Restore_Soft_Label_Keys);
+
+ -- ANCHOR(`slk_touch()',`Touch_Soft_Label_Keys')
+ procedure Touch_Soft_Label_Keys;
+ -- AKA
+ pragma Inline (Touch_Soft_Label_Keys);
+
+ -- ANCHOR(`slk_attron()',`Switch_Soft_Label_Key_Attributes')
+ procedure Switch_Soft_Label_Key_Attributes
+ (Attr : in Character_Attribute_Set;
+ On : in Boolean := True);
+ -- AKA
+ -- ALIAS(`slk_attroff()')
+ pragma Inline (Switch_Soft_Label_Key_Attributes);
+
+ -- ANCHOR(`slk_attrset()',`Set_Soft_Label_Key_Attributes')
+ procedure Set_Soft_Label_Key_Attributes
+ (Attr : in Character_Attribute_Set := Normal_Video;
+ Color : in Color_Pair := Color_Pair'First);
+ -- AKA
+ pragma Inline (Set_Soft_Label_Key_Attributes);
+
+ -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes')
+ function Get_Soft_Label_Key_Attributes return Character_Attribute_Set;
+ -- AKA
+
+ -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes')
+ function Get_Soft_Label_Key_Attributes return Color_Pair;
+ -- AKA
+ pragma Inline (Get_Soft_Label_Key_Attributes);
+
+ -- ANCHOR(`slk_color()',`Set_Soft_Label_Key_Color')
+ procedure Set_Soft_Label_Key_Color (Pair : in Color_Pair);
+ -- AKA
+ pragma Inline (Set_Soft_Label_Key_Color);
+
+ -- MANPAGE(`keybound.3x')
+ -- Not Implemented: keybound
+
+ -- MANPAGE(`keyok.3x')
+
+ -- ANCHOR(`keyok()',`Enable_Key')
+ procedure Enable_Key (Key : in Special_Key_Code;
+ Enable : in Boolean := True);
+ -- AKA
+ pragma Inline (Enable_Key);
+
+ -- MANPAGE(`define_key.3x')
+
+ -- ANCHOR(`define_key()',`Define_Key')
+ procedure Define_Key (Definition : in String;
+ Key : in Special_Key_Code);
+ -- AKA
+ pragma Inline (Define_Key);
+
+ -- MANPAGE(`curs_util.3x')
+
+ -- | Not implemented : filter, use_env
+ -- | putwin, getwin are in the child package PutWin
+ --
+
+ -- ANCHOR(`keyname()',`Key_Name')
+ procedure Key_Name (Key : in Real_Key_Code;
+ Name : out String);
+ -- AKA
+ -- The external name for a real keystroke.
+
+ -- ANCHOR(`keyname()',`Key_Name')
+ function Key_Name (Key : in Real_Key_Code) return String;
+ -- AKA
+ -- Same as function
+ -- We don't inline this routine
+
+ -- ANCHOR(`unctrl()',`Un_Control')
+ procedure Un_Control (Ch : in Attributed_Character;
+ Str : out String);
+ -- AKA
+
+ -- ANCHOR(`unctrl()',`Un_Control')
+ function Un_Control (Ch : in Attributed_Character) return String;
+ -- AKA
+ -- Same as function
+ pragma Inline (Un_Control);
+
+ -- ANCHOR(`delay_output()',`Delay_Output')
+ procedure Delay_Output (Msecs : in Natural);
+ -- AKA
+ pragma Inline (Delay_Output);
+
+ -- ANCHOR(`flushinp()',`Flush_Input')
+ procedure Flush_Input;
+ -- AKA
+ pragma Inline (Flush_Input);
+
+ -- MANPAGE(`curs_termattrs.3x')
+
+ -- ANCHOR(`baudrate()',`Baudrate')
+ function Baudrate return Natural;
+ -- AKA
+ pragma Inline (Baudrate);
+
+ -- ANCHOR(`erasechar()',`Erase_Character')
+ function Erase_Character return Character;
+ -- AKA
+ pragma Inline (Erase_Character);
+
+ -- ANCHOR(`killchar()',`Kill_Character')
+ function Kill_Character return Character;
+ -- AKA
+ pragma Inline (Kill_Character);
+
+ -- ANCHOR(`has_ic()',`Has_Insert_Character')
+ function Has_Insert_Character return Boolean;
+ -- AKA
+ pragma Inline (Has_Insert_Character);
+
+ -- ANCHOR(`has_il()',`Has_Insert_Line')
+ function Has_Insert_Line return Boolean;
+ -- AKA
+ pragma Inline (Has_Insert_Line);
+
+ -- ANCHOR(`termattrs()',`Supported_Attributes')
+ function Supported_Attributes return Character_Attribute_Set;
+ -- AKA
+ pragma Inline (Supported_Attributes);
+
+ -- ANCHOR(`longname()',`Long_Name')
+ procedure Long_Name (Name : out String);
+ -- AKA
+
+ -- ANCHOR(`longname()',`Long_Name')
+ function Long_Name return String;
+ -- AKA
+ -- Same as function
+ pragma Inline (Long_Name);
+
+ -- ANCHOR(`termname()',`Terminal_Name')
+ procedure Terminal_Name (Name : out String);
+ -- AKA
+
+ -- ANCHOR(`termname()',`Terminal_Name')
+ function Terminal_Name return String;
+ -- AKA
+ -- Same as function
+ pragma Inline (Terminal_Name);
+
+ -- MANPAGE(`curs_color.3x')
+
+ -- COLOR_PAIR
+ -- COLOR_PAIR(n) in C is the same as
+ -- Attributed_Character(Ch => Nul, Color => n, Attr => Normal_Video)
+ -- In C you often see something like c = c | COLOR_PAIR(n);
+ -- This is equivalent to c.Color := n;
+
+ -- ANCHOR(`start_color()',`Start_Color')
+ procedure Start_Color;
+ -- AKA
+ pragma Import (C, Start_Color, "start_color");
+
+ -- ANCHOR(`init_pair()',`Init_Pair')
+ procedure Init_Pair (Pair : in Redefinable_Color_Pair;
+ Fore : in Color_Number;
+ Back : in Color_Number);
+ -- AKA
+ pragma Inline (Init_Pair);
+
+ -- ANCHOR(`pair_content()',`Pair_Content')
+ procedure Pair_Content (Pair : in Color_Pair;
+ Fore : out Color_Number;
+ Back : out Color_Number);
+ -- AKA
+ pragma Inline (Pair_Content);
+
+ -- ANCHOR(`has_colors()',`Has_Colors')
+ function Has_Colors return Boolean;
+ -- AKA
+ pragma Inline (Has_Colors);
+
+ -- ANCHOR(`init_color()',`Init_Color')
+ procedure Init_Color (Color : in Color_Number;
+ Red : in RGB_Value;
+ Green : in RGB_Value;
+ Blue : in RGB_Value);
+ -- AKA
+ pragma Inline (Init_Color);
+
+ -- ANCHOR(`can_change_color()',`Can_Change_Color')
+ function Can_Change_Color return Boolean;
+ -- AKA
+ pragma Inline (Can_Change_Color);
+
+ -- ANCHOR(`color_content()',`Color_Content')
+ procedure Color_Content (Color : in Color_Number;
+ Red : out RGB_Value;
+ Green : out RGB_Value;
+ Blue : out RGB_Value);
+ -- AKA
+ pragma Inline (Color_Content);
+
+ -- MANPAGE(`curs_kernel.3x')
+ -- | Not implemented: getsyx, setsyx
+ --
+ type Curses_Mode is (Curses, Shell);
+
+ -- ANCHOR(`def_prog_mode()',`Save_Curses_Mode')
+ procedure Save_Curses_Mode (Mode : in Curses_Mode);
+ -- AKA
+ -- ALIAS(`def_shell_mode()')
+ pragma Inline (Save_Curses_Mode);
+
+ -- ANCHOR(`reset_prog_mode()',`Reset_Curses_Mode')
+ procedure Reset_Curses_Mode (Mode : in Curses_Mode);
+ -- AKA
+ -- ALIAS(`reset_shell_mode()')
+ pragma Inline (Reset_Curses_Mode);
+
+ -- ANCHOR(`savetty()',`Save_Terminal_State')
+ procedure Save_Terminal_State;
+ -- AKA
+ pragma Inline (Save_Terminal_State);
+
+ -- ANCHOR(`resetty();',`Reset_Terminal_State')
+ procedure Reset_Terminal_State;
+ -- AKA
+ pragma Inline (Reset_Terminal_State);
+
+ type Stdscr_Init_Proc is access
+ function (Win : Window;
+ Columns : Column_Count) return Integer;
+ pragma Convention (C, Stdscr_Init_Proc);
+ -- N.B.: the return value is actually ignored, but it seems to be
+ -- a good practice to return 0 if you think all went fine
+ -- and -1 otherwise.
+
+ -- ANCHOR(`ripoffline()',`Rip_Off_Lines')
+ procedure Rip_Off_Lines (Lines : in Integer;
+ Proc : in Stdscr_Init_Proc);
+ -- AKA
+ -- N.B.: to be more precise, this uses a ncurses specific enhancement of
+ -- ripoffline(), in which the Lines argument absolute value is the
+ -- number of lines to be ripped of. The official ripoffline() only
+ -- uses the sign of Lines to rip of a single line from bottom or top.
+ pragma Inline (Rip_Off_Lines);
+
+ type Cursor_Visibility is (Invisible, Normal, Very_Visible);
+
+ -- ANCHOR(`curs_set()',`Set_Cursor_Visibility')
+ procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility);
+ -- AKA
+ pragma Inline (Set_Cursor_Visibility);
+
+ -- ANCHOR(`napms()',`Nap_Milli_Seconds')
+ procedure Nap_Milli_Seconds (Ms : in Natural);
+ -- AKA
+ pragma Inline (Nap_Milli_Seconds);
+
+ -- |=====================================================================
+ -- | Some useful helpers.
+ -- |=====================================================================
+ type Transform_Direction is (From_Screen, To_Screen);
+ procedure Transform_Coordinates
+ (W : in Window := Standard_Window;
+ Line : in out Line_Position;
+ Column : in out Column_Position;
+ Dir : in Transform_Direction := From_Screen);
+ -- This procedure transforms screen coordinates into coordinates relative
+ -- to the window and vice versa, depending on the Dir parameter.
+ -- Screen coordinates are the position informations on the physical device.
+ -- An Curses_Exception will be raised if Line and Column are not in the
+ -- Window or if you pass the Null_Window as argument.
+ -- We don't inline this procedure
+
+ -- MANPAGE(`default_colors.3x')
+
+ -- ANCHOR(`use_default_colors()',`Use_Default_Colors')
+ procedure Use_Default_Colors;
+ -- AKA
+ pragma Inline (Use_Default_Colors);
+
+ -- ANCHOR(`assume_default_colors()',`Assume_Default_Colors')
+ procedure Assume_Default_Colors (Fore : Color_Number := Default_Color;
+ Back : Color_Number := Default_Color);
+ -- AKA
+ pragma Inline (Assume_Default_Colors);
+
+ -- MANPAGE(`curs_extend.3x')
+
+ -- ANCHOR(`curses_version()',`Curses_Version')
+ function Curses_Version return String;
+ -- AKA
+
+ -- ANCHOR(`use_extended_names()',`Use_Extended_Names')
+ -- The returnvalue is the previous setting of the flag
+ function Use_Extended_Names (Enable : Boolean) return Boolean;
+ -- AKA
+
+ -- MANPAGE(`curs_trace.3x')
+
+ -- ANCHOR(`_nc_freeall()',`Curses_Free_All')
+ procedure Curses_Free_All;
+ -- AKA
+
+ -- MANPAGE(`curs_scr_dump.3x')
+
+ -- ANCHOR(`scr_dump()',`Screen_Dump_To_File')
+ procedure Screen_Dump_To_File (Filename : in String);
+ -- AKA
+
+ -- ANCHOR(`scr_restore()',`Screen_Restore_From_File')
+ procedure Screen_Restore_From_File (Filename : in String);
+ -- AKA
+
+ -- ANCHOR(`scr_init()',`Screen_Init_From_File')
+ procedure Screen_Init_From_File (Filename : in String);
+ -- AKA
+
+ -- ANCHOR(`scr_set()',`Screen_Set_File')
+ procedure Screen_Set_File (Filename : in String);
+ -- AKA
+
+ -- MANPAGE(`curs_print.3x')
+ -- Not implemented: mcprint
+
+ -- MANPAGE(`curs_printw.3x')
+ -- Not implemented: printw, wprintw, mvprintw, mvwprintw, vwprintw,
+ -- vw_printw
+ -- Please use the Ada style Text_IO child packages for formatted
+ -- printing. It doesn't make a lot of sense to map the printf style
+ -- C functions to Ada.
+
+ -- MANPAGE(`curs_scanw.3x')
+ -- Not implemented: scanw, wscanw, mvscanw, mvwscanw, vwscanw, vw_scanw
+
+ -- MANPAGE(`resizeterm.3x')
+ -- Not Implemented: resizeterm
+
+ -- MANPAGE(`wresize.3x')
+
+ -- ANCHOR(`wresize()',`Resize')
+ procedure Resize (Win : Window := Standard_Window;
+ Number_Of_Lines : Line_Count;
+ Number_Of_Columns : Column_Count);
+ -- AKA
+
+private
+ type Window is new System.Storage_Elements.Integer_Address;
+ Null_Window : constant Window := 0;
+
+ -- The next constants are generated and may be different on your
+ -- architecture.
+ --
+include(`Window_Offsets')dnl
+ Curses_Bool_False : constant Curses_Bool := 0;
+
+end Terminal_Interface.Curses;