- Announcing ncurses 4.1
+ Announcing ncurses 4.2
The ncurses (new curses) library is a freeware emulation of System V
Release 4.0 curses. It uses terminfo format, supports pads and color
tput(1), tset(1), and a termcap conversion tool captoinfo(1). Full
manual pages are provided for the library and tools.
- The ncurses distribution is available via anonymous FTP at:
- [1]ftp://ftp.clark.net/pub/dickey/ncurses. and
- [2]ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses. It is also carried on
- the GNU distribution site at [3]ftp://prep.ai.mit.edu/pub/gnu.
+ The ncurses distribution is available via anonymous FTP at the GNU
+ distribution site [1]ftp://prep.ai.mit.edu/pub/gnu. It is also
+ available at [2]ftp://ftp.clark.net/pub/dickey/ncurses.
Features of ncurses
- The ncurses package is fully compatible with SVr4 curses:
+ The ncurses package is fully compatible with SVr4 (System V Release 4)
+ curses:
* All 257 of the SVr4 calls have been implemented (and are
documented).
* Full support for SVr4 curses features including keyboard mapping,
color, forms-drawing with ACS characters, and automatic
recognition of keypad and function keys.
- * An emulation of the System V Release 4 panels library, supporting
- a stack of windows with backing store, is included.
- * An emulation of the System V Release 4 menus library, supporting a
- uniform but flexible interface for menu programming, is included.
- * An emulation of the System V Release 4 form library, supporting
- data collection through on-screen forms, is included.
+ * An emulation of the SVr4 panels library, supporting a stack of
+ windows with backing store, is included.
+ * An emulation of the SVr4 menus library, supporting a uniform but
+ flexible interface for menu programming, is included.
+ * An emulation of the SVr4 form library, supporting data collection
+ through on-screen forms, is included.
* Binary terminfo entries generated by the ncurses tic(1)
implementation are bit-for-bit-compatible with the entry format
SVr4 curses uses.
capability.
* (PC-clone boxes only) Support for access to the IBM PC ROM
characters 0-32 through the highlight A_ALTCHARSET.
+ * Ada95 and C++ bindings.
* Support for mouse event reporting under xterm.
+ * Extended mouse support via Alessandro Rubini's gpm package.
* The function wresize() allows you to resize windows, preserving
their data.
+ * The function use_default_colors() allows you to use the terminal's
+ default colors for the default color pair, achieving the effect of
+ transparent colors.
+ * The functions keyok() and define_key() allow you to better control
+ the use of function keys, e.g., disabling the ncurses KEY_MOUSE,
+ or by defining more than one control sequence to map to a given
+ key code.
+ * Support for 16-color terminals, such as aixterm and XFree86 xterm.
* Better cursor-movement optimization. The package now features a
cursor-local-movement computation more efficient than either BSD's
or System V's.
including:
ded
- directory-editor [4]ftp://ftp.clark.net/pub/dickey/ded.
+ directory-editor [3]ftp://ftp.clark.net/pub/dickey/ded.
dialog
the underlying application used in Slackware's setup, and the
lynx-2.7
the character-screen WWW browser
+ Midnight Commander 4.1
+ file manager
+
+ mutt 0.88
+ mail utility
+
ncftp 2.0
file-transfer utility
terminal emulator
tin-unoff
- tin (unofficial) newsreader, supporting color, MIME
- [5]ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff.
+ tin 1.4 newsreader, supporting color, MIME
+ [4]ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff.
vile
- vi-like-emacs [6]ftp://ftp.clark.net/pub/dickey/vile.
+ vi-like-emacs [5]ftp://ftp.clark.net/pub/dickey/vile.
The ncurses distribution includes a selection of test programs
(including a few games).
Who's Who and What's What
- The original maintainer of ncurses is [7]Zeyd Ben-Halim.
- Unfortunately, he can only work on the package part time. As a result,
- since 1.8.1, much of the enhancement work and documentation has been
- done by [8]Eric S. Raymond. The current primary maintainers are
- [9]Thomas Dickey and [10]Juergen Pfeifer.
-
- There is an ncurses mailing list. It is a majordomo list; to join,
- write to ncurses-request@mailgate.bsdi.com with a message containing
- the line:
-
+ The original developers of ncurses are [6]Zeyd Ben-Halim and [7]Eric
+ S. Raymond. Ongoing work is being done by [8]Thomas Dickey and
+ [9]JĂĽrgen Pfeifer. [10]Florian La Roche acts as the maintainer for the
+ Free Software Foundation, which holds the copyright on ncurses.
+ Contact the current maintainers at [11]bug-ncurses@gnu.org.
+
+ To join the ncurses mailing list, please write email to
+ bug-ncurses-request@gnu.org containing the line:
subscribe <name>@<host.domain>
This list is open to anyone interested in helping with the development
and testing of this package.
Beta versions of ncurses and patches to the current release are made
- available at [11]ftp://ftp.clark.net/pub/dickey/ncurses.
+ available at [12]ftp://ftp.clark.net/pub/dickey/ncurses.
Future Plans
- * Extended mouse support via Alessandro Rubini's gpm package.
* Extended-level XPG4 conformance, with internationalization
support.
* Ports to more systems, including DOS and Windows.
We need people to help with these projects. If you are interested in
working on them, please join the ncurses list.
-The terminfo/termcap Database
-
- The distribution includes and uses a copy of the terminfo-format
- terminal description file maintained by Eric Raymond. You can download
- either the [12]termcap or [13]terminfo versions of the terminal-type
- database from Eric's ncurses page,
- [14]http://www.ccil.org/~esr/ncurses.html.
-
Other Related Resources
+ The distribution includes and uses a version of the terminfo-format
+ terminal description file maintained by Eric Raymond.
+ [13]http://earthspace.net/~esr/terminfo.
+
You can find lots of information on terminal-related topics not
- covered in the terminfo file at [15]Richard Shuford's archive.
+ covered in the terminfo file at [14]Richard Shuford's archive.
References
- 1. ftp://ftp.clark.net/pub/dickey/ncurses
- 2. ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses
- 3. ftp://prep.ai.mit.edu/pub/gnu
- 4. ftp://ftp.clark.net/pub/dickey/ded
- 5. ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff
- 6. ftp://ftp.clark.net/pub/dickey/vile
- 7. mailto:zmbenhal@netcom.com
- 8. http://www.ccil.org/~esr/home.html
- 9. mailto:dickey@clark.net
- 10. mailto:Juergen.Pfeifer@T-Online.de
- 11. ftp://ftp.clark.net/pub/dickey/ncurses
- 12. http://www.ccil.org/~esr/terminfo/termtypes.tc.gz
- 13. http://www.ccil.org/~esr/terminfo/termtypes.ti.gz
- 14. http://www.ccil.org/~esr/ncurses.html
- 15. http://www.cs.utk.edu/~shuford/terminal_index.html
+ 1. ftp://prep.ai.mit.edu/pub/gnu
+ 2. ftp://ftp.clark.net/pub/dickey/ncurses
+ 3. ftp://ftp.clark.net/pub/dickey/ded
+ 4. ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff
+ 5. ftp://ftp.clark.net/pub/dickey/vile
+ 6. mailto:zmbenhal@netcom.com
+ 7. http://www.ccil.org/~esr/home.html
+ 8. mailto:dickey@clark.net
+ 9. mailto:Juergen.Pfeifer@T-Online.de
+ 10. mailto:florian@gnu.org
+ 11. mailto:bug-ncurses@gnu.org
+ 12. ftp://ftp.clark.net/pub/dickey/ncurses
+ 13. http://earthspace.net/~esr/terminfo
+ 14. http://www.cs.utk.edu/~shuford/terminal_index.html
-#----------------------------------------------------------------------------
-# --
-# GNAT ncurses Binding --
-# Makefile --
-# --
-# Version 00.92 --
-# --
-# The ncurses Ada95 binding is copyrighted 1996 by --
-# Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
-# --
-# Permission is hereby granted to reproduce and distribute this --
-# binding by any means and for any fee, whether alone or as part --
-# of a larger distribution, in source or in binary form, PROVIDED --
-# this notice is included with any such distribution, and is not --
-# removed from any of its header files. Mention of ncurses and the --
-# author of this binding in any applications linked with it is --
-# highly appreciated. --
-# --
-# This binding comes AS IS with no warranty, implied or expressed. --
-#----------------------------------------------------------------------------
+##############################################################################
+# 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 <Juergen.Pfeifer@T-Online.de> 1996
+#
# Version Control
-# $Revision: 1.3 $
+# $Revision: 1.10 $
#
SHELL = /bin/sh
THIS = Makefile
SUBDIRS = @ADA_SUBDIRS@
-all ::
+all \
+sources \
+install \
+install.libs \
+uninstall \
+uninstall.libs ::
for d in $(SUBDIRS); do \
(cd $$d ; $(MAKE) $@) ;\
done
-clean ::
+clean \
+mostlyclean ::
for d in $(SUBDIRS); do \
(cd $$d ; $(MAKE) $@) ;\
done
-distclean ::
- for d in $(SUBDIRS); do \
- (cd $$d ; $(MAKE) $@) ;\
- done
- rm -f Makefile
-
+distclean \
realclean ::
for d in $(SUBDIRS); do \
(cd $$d ; $(MAKE) $@) ;\
done
rm -f Makefile
-mostlyclean ::
- for d in $(SUBDIRS); do \
- (cd $$d ; $(MAKE) $@) ;\
- done
-
-install ::
+install.data :
+ @
-The ncurses Ada95 binding is copyrighted 1996 by Juergen Pfeifer
-Email: Juergen.Pfeifer@T-Online.de
-
-Permission is hereby granted to reproduce and distribute this
-binding by any means and for any fee, whether alone or as part
-of a larger distribution, in source or in binary form, PROVIDED
-this notice is included with any such distribution, and is not
-removed from any of its header files. Mention of ncurses and the
-author of this binding in any applications linked with it is
-highly appreciated.
-
-This binding comes AS IS with no warranty, implied or expressed.
-----------------------------------------------------------------------
+-------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
Caveats:
This is the first delivery of this binding. It has not been
-#----------------------------------------------------------------------------
-# --
-# GNAT ncurses Binding --
-# src/Makefile --
-# --
-# Version 00.92 --
-# --
-# The ncurses Ada95 binding is copyrighted 1996 by --
-# Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
-# --
-# Permission is hereby granted to reproduce and distribute this --
-# binding by any means and for any fee, whether alone or as part --
-# of a larger distribution, in source or in binary form, PROVIDED --
-# this notice is included with any such distribution, and is not --
-# removed from any of its header files. Mention of ncurses and the --
-# author of this binding in any applications linked with it is --
-# highly appreciated. --
-# --
-# This binding comes AS IS with no warranty, implied or expressed. --
-#----------------------------------------------------------------------------
+##############################################################################
+# 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 <Juergen.Pfeifer@T-Online.de> 1996
+#
# Version Control
-# $Revision: 1.6 $
+# $Revision: 1.13 $
#
.SUFFIXES:
includedir = @includedir@
datadir = @datadir@
ticdir = $(datadir)/terminfo
+ADA_INCLUDE = @ADA_INCLUDE@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
RANLIB = @RANLIB@
################################################################################
-ADA = @nc_ada_compiler@
+ADA = @cf_ada_compiler@
ADAFLAGS = @ADAFLAGS@ -I. -I$(srcdir)
-ADAMAKE = @nc_ada_make@
+ADAMAKE = @cf_ada_make@
ADAMAKEFLAGS =
CARGS = -cargs $(ADAFLAGS)
LARGS =
-ALIB = @nc_ada_package@
+ALIB = @cf_ada_package@
ABASE = $(ALIB)-curses
ADA_OBJDIR = ../ada_objects
OBJDIR = ../objects
-LIBALIS=$(ADA_OBJDIR)/$(ALIB).ali \
- $(ADA_OBJDIR)/$(ABASE)-aux.ali \
- $(ADA_OBJDIR)/$(ABASE).ali \
- $(ADA_OBJDIR)/$(ABASE)-mouse.ali \
- $(ADA_OBJDIR)/$(ABASE)-panels.ali \
- $(ADA_OBJDIR)/$(ABASE)-menus.ali \
- $(ADA_OBJDIR)/$(ABASE)-forms.ali \
- $(ADA_OBJDIR)/$(ABASE)-text_io.ali \
+LIBALIS=$(ADA_OBJDIR)/$(ALIB).ali \
+ $(ADA_OBJDIR)/$(ABASE)-aux.ali \
+ $(ADA_OBJDIR)/$(ABASE).ali \
+ $(ADA_OBJDIR)/$(ABASE)-mouse.ali \
+ $(ADA_OBJDIR)/$(ABASE)-panels.ali \
+ $(ADA_OBJDIR)/$(ABASE)-menus.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alpha.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alphanumeric.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-intfield.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-numeric.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-regexp.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-ipv4_address.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user-choice.ali \
+ $(ADA_OBJDIR)/$(ABASE)-text_io.ali \
$(ADA_OBJDIR)/$(ABASE)-text_io-aux.ali
-LIBOBJS=$(ADA_OBJDIR)/$(ALIB).o \
- $(ADA_OBJDIR)/$(ABASE)-aux.o \
- $(ADA_OBJDIR)/$(ABASE).o \
- $(ADA_OBJDIR)/$(ABASE)-mouse.o \
- $(ADA_OBJDIR)/$(ABASE)-panels.o \
- $(ADA_OBJDIR)/$(ABASE)-menus.o \
- $(ADA_OBJDIR)/$(ABASE)-forms.o \
- $(ADA_OBJDIR)/$(ABASE)-text_io.o \
+# Ada Library files for generic packages. Since gnat 3.10 they are
+# also compiled
+GENALIS=$(ADA_OBJDIR)/$(ABASE)-menus-menu_user_data.ali \
+ $(ADA_OBJDIR)/$(ABASE)-menus-item_user_data.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-form_user_data.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_user_data.ali \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration-ada.ali \
+ $(ADA_OBJDIR)/$(ABASE)-panels-user_data.ali \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-integer_io.ali \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-float_io.ali \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-fixed_io.ali \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-decimal_io.ali \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-enumeration_io.ali \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-modular_io.ali \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-complex_io.ali
+
+LIBOBJS=$(ADA_OBJDIR)/$(ALIB).o \
+ $(ADA_OBJDIR)/$(ABASE)-aux.o \
+ $(ADA_OBJDIR)/$(ABASE).o \
+ $(ADA_OBJDIR)/$(ABASE)-mouse.o \
+ $(ADA_OBJDIR)/$(ABASE)-panels.o \
+ $(ADA_OBJDIR)/$(ABASE)-menus.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alpha.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alphanumeric.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-intfield.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-numeric.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-regexp.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-ipv4_address.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user-choice.o \
+ $(ADA_OBJDIR)/$(ABASE)-text_io.o \
$(ADA_OBJDIR)/$(ABASE)-text_io-aux.o
-
-all :: $(LIBALIS)
+# Ada object files for generic packages. Since gnat 3.10 they are
+# also compiled
+GENOBJS=$(ADA_OBJDIR)/$(ABASE)-menus-menu_user_data.o \
+ $(ADA_OBJDIR)/$(ABASE)-menus-item_user_data.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-form_user_data.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_user_data.o \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration-ada.o \
+ $(ADA_OBJDIR)/$(ABASE)-panels-user_data.o \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-integer_io.o \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-float_io.o \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-fixed_io.o \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-decimal_io.o \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-enumeration_io.o \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-modular_io.o \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-complex_io.o
+
+
+all :: $(LIBALIS) @cf_compile_generics@
@echo done
-clean ::
+sources :
+ @
+
+install ::
+install.libs ::
+uninstall ::
+uninstall.libs ::
+
+generics: $(GENALIS)
+ @
+
+mostlyclean ::
rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] *.a
-mostlyclean :: clean
+clean :: mostlyclean
rm -f $(LIBALIS) $(LIBOBJS)
-distclean :: mostlyclean
+distclean :: clean
rm -f Makefile
realclean :: distclean
rm -f $(ABASE)-forms.ali ;\
fi
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types.o: \
+ $(ABASE)-forms-field_types.ads \
+ $(srcdir)/$(ABASE)-forms-field_types.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types.o
+ if [ -f $(ABASE)-forms-field_types.ali ]; then \
+ ln -f $(ABASE)-forms-field_types.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-alpha.o: \
+ $(srcdir)/$(ABASE)-forms-field_types-alpha.ads \
+ $(srcdir)/$(ABASE)-forms-field_types-alpha.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-alpha.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-alpha.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alpha.o
+ if [ -f $(ABASE)-forms-field_types-alpha.ali ]; then \
+ ln -f $(ABASE)-forms-field_types-alpha.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types-alpha.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-alphanumeric.o: \
+ $(srcdir)/$(ABASE)-forms-field_types-alphanumeric.ads \
+ $(srcdir)/$(ABASE)-forms-field_types-alphanumeric.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-alphanumeric.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-alphanumeric.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-alphanumeric.o
+ if [ -f $(ABASE)-forms-field_types-alphanumeric.ali ]; then \
+ ln -f $(ABASE)-forms-field_types-alphanumeric.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types-alphanumeric.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-intfield.o: \
+ $(srcdir)/$(ABASE)-forms-field_types-intfield.ads \
+ $(srcdir)/$(ABASE)-forms-field_types-intfield.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-intfield.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-intfield.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-intfield.o
+ if [ -f $(ABASE)-forms-field_types-intfield.ali ]; then \
+ ln -f $(ABASE)-forms-field_types-intfield.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types-intfield.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-numeric.o: \
+ $(srcdir)/$(ABASE)-forms-field_types-numeric.ads \
+ $(srcdir)/$(ABASE)-forms-field_types-numeric.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-numeric.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-numeric.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-numeric.o
+ if [ -f $(ABASE)-forms-field_types-numeric.ali ]; then \
+ ln -f $(ABASE)-forms-field_types-numeric.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types-numeric.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-regexp.o: \
+ $(srcdir)/$(ABASE)-forms-field_types-regexp.ads \
+ $(srcdir)/$(ABASE)-forms-field_types-regexp.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-regexp.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-regexp.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-regexp.o
+ if [ -f $(ABASE)-forms-field_types-regexp.ali ]; then \
+ ln -f $(ABASE)-forms-field_types-regexp.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types-regexp.ali ;\
+ fi
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration.o: \
+ $(srcdir)/$(ABASE)-forms-field_types-enumeration.ads \
+ $(srcdir)/$(ABASE)-forms-field_types-enumeration.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-enumeration.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration.o
+ if [ -f $(ABASE)-forms-field_types-enumeration.ali ]; then \
+ ln -f $(ABASE)-forms-field_types-enumeration.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types-enumeration.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-ipv4_address.o: \
+ $(srcdir)/$(ABASE)-forms-field_types-ipv4_address.ads \
+ $(srcdir)/$(ABASE)-forms-field_types-ipv4_address.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-ipv4_address.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-ipv4_address.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-ipv4_address.o
+ if [ -f $(ABASE)-forms-field_types-ipv4_address.ali ]; then \
+ ln -f $(ABASE)-forms-field_types-ipv4_address.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types-ipv4_address.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-user.o: \
+ $(srcdir)/$(ABASE)-forms-field_types-user.ads \
+ $(srcdir)/$(ABASE)-forms-field_types-user.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-user.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-user.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user.o
+ if [ -f $(ABASE)-forms-field_types-user.ali ]; then \
+ ln -f $(ABASE)-forms-field_types-user.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types-user.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-user-choice.o: \
+ $(srcdir)/$(ABASE)-forms-field_types-user-choice.ads \
+ $(srcdir)/$(ABASE)-forms-field_types-user-choice.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-user-choice.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-user-choice.ali: $(ADA_OBJDIR)/$(ABASE)-forms-field_types-user-choice.o
+ if [ -f $(ABASE)-forms-field_types-user-choice.ali ]; then \
+ ln -f $(ABASE)-forms-field_types-user-choice.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types-user-choice.ali ;\
+ fi
+
$(ADA_OBJDIR)/$(ABASE)-text_io.o: \
$(srcdir)/$(ABASE)-text_io.ads \
$(srcdir)/$(ABASE)-text_io.adb $(BASEDEPS)
ln -f $(ABASE)-text_io-aux.ali $@ ;\
rm -f $(ABASE)-text_io-aux.ali ;\
fi
+
+$(ADA_OBJDIR)/$(ABASE)-menus-menu_user_data.o: \
+ $(ABASE)-menus-menu_user_data.ads \
+ $(srcdir)/$(ABASE)-menus-menu_user_data.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-menus-menu_user_data.adb
+
+$(ADA_OBJDIR)/$(ABASE)-menus-menu_user_data.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-menus-menu_user_data.o
+ if [ -f $(ABASE)-menus-menu_user_data.ali ]; then \
+ ln -f $(ABASE)-menus-menu_user_data.ali $@ ;\
+ rm -f $(ABASE)-menus-menu_user_data.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-menus-item_user_data.o: \
+ $(ABASE)-menus-item_user_data.ads \
+ $(srcdir)/$(ABASE)-menus-item_user_data.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-menus-item_user_data.adb
+
+$(ADA_OBJDIR)/$(ABASE)-menus-item_user_data.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-menus-item_user_data.o
+ if [ -f $(ABASE)-menus-item_user_data.ali ]; then \
+ ln -f $(ABASE)-menus-item_user_data.ali $@ ;\
+ rm -f $(ABASE)-menus-item_user_data.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-form_user_data.o: \
+ $(ABASE)-forms-form_user_data.ads \
+ $(srcdir)/$(ABASE)-forms-form_user_data.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-form_user_data.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-form_user_data.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-forms-form_user_data.o
+ if [ -f $(ABASE)-forms-form_user_data.ali ]; then \
+ ln -f $(ABASE)-forms-form_user_data.ali $@ ;\
+ rm -f $(ABASE)-forms-form_user_data.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_user_data.o: \
+ $(ABASE)-forms-field_user_data.ads \
+ $(srcdir)/$(ABASE)-forms-field_user_data.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_user_data.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_user_data.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_user_data.o
+ if [ -f $(ABASE)-forms-field_user_data.ali ]; then \
+ ln -f $(ABASE)-forms-field_user_data.ali $@ ;\
+ rm -f $(ABASE)-forms-field_user_data.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration-ada.o: \
+ $(srcdir)/$(ABASE)-forms-field_types-enumeration-ada.ads \
+ $(srcdir)/$(ABASE)-forms-field_types-enumeration-ada.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms-field_types-enumeration-ada.adb
+
+$(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration-ada.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-forms-field_types-enumeration-ada.o
+ if [ -f $(ABASE)-forms-field_types-enumeration-ada.ali ]; then \
+ ln -f $(ABASE)-forms-field_types-enumeration-ada.ali $@ ;\
+ rm -f $(ABASE)-forms-field_types-enumeration-ada.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-panels-user_data.o: \
+ $(ABASE)-panels-user_data.ads \
+ $(srcdir)/$(ABASE)-panels-user_data.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-panels-user_data.adb
+
+$(ADA_OBJDIR)/$(ABASE)-panels-user_data.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-panels-user_data.o
+ if [ -f $(ABASE)-panels-user_data.ali ]; then \
+ ln -f $(ABASE)-panels-user_data.ali $@ ;\
+ rm -f $(ABASE)-panels-user_data.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-integer_io.o: \
+ $(srcdir)/$(ABASE)-text_io-integer_io.ads \
+ $(srcdir)/$(ABASE)-text_io-integer_io.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-integer_io.adb
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-integer_io.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-integer_io.o
+ if [ -f $(ABASE)-text_io-integer_io.ali ]; then \
+ ln -f $(ABASE)-text_io-integer_io.ali $@ ;\
+ rm -f $(ABASE)-text_io-integer_io.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-float_io.o: \
+ $(srcdir)/$(ABASE)-text_io-float_io.ads \
+ $(srcdir)/$(ABASE)-text_io-float_io.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-float_io.adb
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-float_io.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-float_io.o
+ if [ -f $(ABASE)-text_io-float_io.ali ]; then \
+ ln -f $(ABASE)-text_io-float_io.ali $@ ;\
+ rm -f $(ABASE)-text_io-float_io.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-fixed_io.o: \
+ $(srcdir)/$(ABASE)-text_io-fixed_io.ads \
+ $(srcdir)/$(ABASE)-text_io-fixed_io.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-fixed_io.adb
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-fixed_io.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-fixed_io.o
+ if [ -f $(ABASE)-text_io-fixed_io.ali ]; then \
+ ln -f $(ABASE)-text_io-fixed_io.ali $@ ;\
+ rm -f $(ABASE)-text_io-fixed_io.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-decimal_io.o: \
+ $(srcdir)/$(ABASE)-text_io-decimal_io.ads \
+ $(srcdir)/$(ABASE)-text_io-decimal_io.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-decimal_io.adb
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-decimal_io.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-decimal_io.o
+ if [ -f $(ABASE)-text_io-decimal_io.ali ]; then \
+ ln -f $(ABASE)-text_io-decimal_io.ali $@ ;\
+ rm -f $(ABASE)-text_io-decimal_io.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-enumeration_io.o: \
+ $(srcdir)/$(ABASE)-text_io-enumeration_io.ads \
+ $(srcdir)/$(ABASE)-text_io-enumeration_io.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-enumeration_io.adb
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-enumeration_io.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-enumeration_io.o
+ if [ -f $(ABASE)-text_io-enumeration_io.ali ]; then \
+ ln -f $(ABASE)-text_io-enumeration_io.ali $@ ;\
+ rm -f $(ABASE)-text_io-enumeration_io.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-modular_io.o: \
+ $(srcdir)/$(ABASE)-text_io-modular_io.ads \
+ $(srcdir)/$(ABASE)-text_io-modular_io.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-modular_io.adb
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-modular_io.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-modular_io.o
+ if [ -f $(ABASE)-text_io-modular_io.ali ]; then \
+ ln -f $(ABASE)-text_io-modular_io.ali $@ ;\
+ rm -f $(ABASE)-text_io-modular_io.ali ;\
+ fi
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-complex_io.o: \
+ $(srcdir)/$(ABASE)-text_io-complex_io.ads \
+ $(srcdir)/$(ABASE)-text_io-complex_io.adb $(BASEDEPS)
+ $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-complex_io.adb
+
+$(ADA_OBJDIR)/$(ABASE)-text_io-complex_io.ali: \
+ $(ADA_OBJDIR)/$(ABASE)-text_io-complex_io.o
+ if [ -f $(ABASE)-text_io-complex_io.ali ]; then \
+ ln -f $(ABASE)-text_io-complex_io.ali $@ ;\
+ rm -f $(ABASE)-text_io-complex_io.ali ;\
+ fi
-- --
-- B O D Y --
-- --
--- Version 00.92 --
+------------------------------------------------------------------------------
+-- 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 ncurses Ada95 binding is copyrighted 1996 by --
--- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
-- --
--- Permission is hereby granted to reproduce and distribute this --
--- binding by any means and for any fee, whether alone or as part --
--- of a larger distribution, in source or in binary form, PROVIDED --
--- this notice is included with any such distribution, and is not --
--- removed from any of its header files. Mention of ncurses and the --
--- author of this binding in any applications linked with it is --
--- highly appreciated. --
+-- 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. --
-- --
--- This binding comes AS IS with no warranty, implied or expressed. --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
-- Version Control:
--- $Revision: 1.3 $
+-- $Revision: 1.6 $
+-- Binding Version 00.93
------------------------------------------------------------------------------
package body Terminal_Interface.Curses.Aux is
--
end Fill_String;
+ function Fill_String (Cp : chars_ptr) return String
+ is
+ Len : Natural;
+ begin
+ if Cp /= Null_Ptr then
+ Len := Natural (Strlen (Cp));
+ if Len = 0 then
+ return "";
+ else
+ declare
+ S : String (1 .. Len);
+ begin
+ Fill_String (Cp, S);
+ return S;
+ end;
+ end if;
+ else
+ return "";
+ end if;
+ end Fill_String;
+
procedure Eti_Exception (Code : Eti_Error)
is
begin
-- --
-- S P E C --
-- --
--- Version 00.92 --
+------------------------------------------------------------------------------
+-- 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 ncurses Ada95 binding is copyrighted 1996 by --
--- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
-- --
--- Permission is hereby granted to reproduce and distribute this --
--- binding by any means and for any fee, whether alone or as part --
--- of a larger distribution, in source or in binary form, PROVIDED --
--- this notice is included with any such distribution, and is not --
--- removed from any of its header files. Mention of ncurses and the --
--- author of this binding in any applications linked with it is --
--- highly appreciated. --
+-- 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. --
-- --
--- This binding comes AS IS with no warranty, implied or expressed. --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
-- Version Control:
--- $Revision: 1.4 $
+-- $Revision: 1.8 $
+-- Binding Version 00.93
------------------------------------------------------------------------------
with System;
with Interfaces.C;
with Unchecked_Conversion;
package Terminal_Interface.Curses.Aux is
+ pragma Preelaborate (Aux);
use type Interfaces.C.Int;
-- 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;
+++ /dev/null
-------------------------------------------------------------------------------
--- --
--- GNAT ncurses Binding --
--- --
--- Terminal_Interface.Curses.Forms.Choice_Field_Types --
--- --
--- B O D Y --
--- --
--- Version 00.92 --
--- --
--- The ncurses Ada95 binding is copyrighted 1996 by --
--- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
--- --
--- Permission is hereby granted to reproduce and distribute this --
--- binding by any means and for any fee, whether alone or as part --
--- of a larger distribution, in source or in binary form, PROVIDED --
--- this notice is included with any such distribution, and is not --
--- removed from any of its header files. Mention of ncurses and the --
--- author of this binding in any applications linked with it is --
--- highly appreciated. --
--- --
--- This binding comes AS IS with no warranty, implied or expressed. --
-------------------------------------------------------------------------------
--- Version Control:
--- $Revision: 1.5 $
-------------------------------------------------------------------------------
-with Interfaces.C;
-with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
-with Terminal_Interface.Curses.Forms.Field_Types;
-
--- |
--- |=====================================================================
--- | man page form_fieldtype.3x
--- |=====================================================================
--- |
-package body Terminal_Interface.Curses.Forms.Choice_Field_Types is
-
- use type Interfaces.C.int;
-
- package Ft is new Terminal_Interface.Curses.Forms.Field_Types
- (User, User_Access, Field_Check, Character_Check);
-
- type N_Check is access
- function (Fld : Field; Info : User_Access) return Boolean;
- pragma Convention (C, N_Check);
-
- type P_Check is access
- function (Fld : Field; Info : User_Access) return Boolean;
- pragma Convention (C, P_Check);
-
- function Nc (Fld : Field; Info : User_Access) return Boolean;
- pragma Convention (C, Nc);
-
- function Pc (Fld : Field; Info : User_Access) return Boolean;
- pragma Convention (C, Pc);
-
- function Nc (Fld : Field; Info : User_Access) return Boolean
- is
- begin
- return Next_Choice (Fld, Info);
- end Nc;
-
- function Pc (Fld : Field; Info : User_Access) return Boolean
- is
- begin
- return Prev_Choice (Fld, Info);
- end Pc;
- -- |
- -- |
- -- |
- function Set_Choice (Ft : C_Field_Type;
- Nc : N_Check;
- Pc : P_Check) return C_Int;
- pragma Import (C, Set_Choice, "set_fieldtype_choice");
-
- procedure Define_Choices
- is
- R : Eti_Error;
- begin
- R := Set_Choice (Search_Type (User'Tag), Nc'Access, Pc'Access);
- if (R /= E_OK) then
- Eti_Exception (R);
- end if;
- end Define_Choices;
-
-begin
- Define_Choices;
-end Terminal_Interface.Curses.Forms.Choice_Field_Types;
+++ /dev/null
-------------------------------------------------------------------------------
--- --
--- GNAT ncurses Binding --
--- --
--- Terminal_Interface.Curses.Forms.Choice_Field_Types --
--- --
--- S P E C --
--- --
--- Version 00.92 --
--- --
--- The ncurses Ada95 binding is copyrighted 1996 by --
--- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
--- --
--- Permission is hereby granted to reproduce and distribute this --
--- binding by any means and for any fee, whether alone or as part --
--- of a larger distribution, in source or in binary form, PROVIDED --
--- this notice is included with any such distribution, and is not --
--- removed from any of its header files. Mention of ncurses and the --
--- author of this binding in any applications linked with it is --
--- highly appreciated. --
--- --
--- This binding comes AS IS with no warranty, implied or expressed. --
-------------------------------------------------------------------------------
--- Version Control:
--- $Revision: 1.6 $
-------------------------------------------------------------------------------
--- You must instantiate this package for any user defined field type
--- to make it visible to the runtime.
---
-generic
- type User is new Ada_Defined_Field_Type with private;
- type User_Access is access User;
- with function Field_Check (Fld : Field;
- Info : User_Access) return Boolean;
- with function Character_Check (Ch : Character;
- Info : User_Access) return Boolean;
- with function Next_Choice (Fld : Field;
- Info : User_Access) return Boolean;
- with function Prev_Choice (Fld : Field;
- Info : User_Access) return Boolean;
-package Terminal_Interface.Curses.Forms.Choice_Field_Types is
---
--- Nothing public.
--- But we need the body.
- pragma Elaborate_Body;
-end Terminal_Interface.Curses.Forms.Choice_Field_Types;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.Alpha --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.3 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Interfaces.C;
+with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
+
+package body Terminal_Interface.Curses.Forms.Field_Types.Alpha is
+
+ use type Interfaces.C.Int;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Alpha_Field)
+ is
+ C_Alpha_Field_Type : C_Field_Type;
+ pragma Import (C, C_Alpha_Field_Type, "TYPE_ALPHA");
+
+ function Set_Fld_Type (F : Field := Fld;
+ Cft : C_Field_Type := C_Alpha_Field_Type;
+ Arg1 : C_Int) return C_Int;
+ pragma Import (C, Set_Fld_Type, "set_field_type");
+
+ Res : Eti_Error;
+ begin
+ Res := Set_Fld_Type (Arg1 => C_Int (Typ.Minimum_Field_Width));
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ Wrap_Builtin (Fld, Typ);
+ end Set_Field_Type;
+
+end Terminal_Interface.Curses.Forms.Field_Types.Alpha;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.Alpha --
+-- --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.5 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+package Terminal_Interface.Curses.Forms.Field_Types.Alpha is
+ pragma Preelaborate (Alpha);
+
+ type Alpha_Field is new Field_Type
+ with record
+ Minimum_Field_Width : Natural := 0;
+ end record;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Alpha_Field);
+ pragma Inline (Set_Field_Type);
+
+end Terminal_Interface.Curses.Forms.Field_Types.Alpha;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.3 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Interfaces.C;
+with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
+
+package body Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is
+
+ use type Interfaces.C.Int;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in AlphaNumeric_Field)
+ is
+ C_AlphaNumeric_Field_Type : C_Field_Type;
+ pragma Import (C, C_AlphaNumeric_Field_Type, "TYPE_ALNUM");
+
+ function Set_Fld_Type (F : Field := Fld;
+ Cft : C_Field_Type := C_AlphaNumeric_Field_Type;
+ Arg1 : C_Int) return C_Int;
+ pragma Import (C, Set_Fld_Type, "set_field_type");
+
+ Res : Eti_Error;
+ begin
+ Res := Set_Fld_Type (Arg1 => C_Int (Typ.Minimum_Field_Width));
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ Wrap_Builtin (Fld, Typ);
+ end Set_Field_Type;
+
+end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric --
+-- --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.5 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+package Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is
+ pragma Preelaborate (AlphaNumeric);
+
+ type AlphaNumeric_Field is new Field_Type
+ with record
+ Minimum_Field_Width : Natural := 0;
+ end record;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in AlphaNumeric_Field);
+ pragma Inline (Set_Field_Type);
+
+end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.3 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Ada.Characters.Handling; use Ada.Characters.Handling;
+
+package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is
+
+ function Create (Set : Type_Set := Mixed_Case;
+ Case_Sensitive : Boolean := False;
+ Must_Be_Unique : Boolean := False)
+ return Enumeration_Field
+ is
+ I : Enumeration_Info (T'Pos (T'Last) - T'Pos (T'First) + 1);
+ J : Positive := 1;
+ begin
+ I.Case_Sensitive := Case_Sensitive;
+ I.Match_Must_Be_Unique := Must_Be_Unique;
+
+ for E in T'Range loop
+ I.Names (J) := new String'(T'Image (T (E)));
+ -- The Image attribute defaults to upper case, so we have to handle
+ -- only the other ones...
+ if Set /= Upper_Case then
+ I.Names (J).all := To_Lower (I.Names (J).all);
+ if Set = Mixed_Case then
+ I.Names (J)(I.Names (J).all'First) :=
+ To_Upper (I.Names (J)(I.Names (J).all'First));
+ end if;
+ end if;
+ J := J + 1;
+ end loop;
+
+ return Create (I, True);
+ end Create;
+
+ function Value (Fld : Field;
+ Buf : Buffer_Number := Buffer_Number'First) return T
+ is
+ begin
+ return T'Value (Get_Buffer (Fld, Buf));
+ end Value;
+
+end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada --
+-- --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.4 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+generic
+ type T is (<>);
+
+package Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is
+ pragma Preelaborate (Enumeration.Ada);
+
+ function Create (Set : Type_Set := Mixed_Case;
+ Case_Sensitive : Boolean := False;
+ Must_Be_Unique : Boolean := False)
+ return Enumeration_Field;
+
+ function Value (Fld : Field;
+ Buf : Buffer_Number := Buffer_Number'First) return T;
+ -- Translate the content of the fields buffer - indicated by the
+ -- buffer number - into an enumeration value. If the buffer is empty
+ -- or the content is invalid, a Constraint_Error is raises.
+
+end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.3 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Ada.Unchecked_Deallocation;
+with Interfaces.C; use Interfaces.C;
+with Interfaces.C.Strings; use Interfaces.C.Strings;
+with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
+
+package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration is
+
+ function Create (Info : Enumeration_Info;
+ Auto_Release_Names : Boolean := False)
+ return Enumeration_Field
+ is
+ procedure Release_String is
+ new Ada.Unchecked_Deallocation (String,
+ String_Access);
+ E : Enumeration_Field;
+ L : constant size_t := 1 + size_t (Info.C);
+ S : String_Access;
+ begin
+ E.Case_Sensitive := Info.Case_Sensitive;
+ E.Match_Must_Be_Unique := Info.Match_Must_Be_Unique;
+ E.Arr := new chars_ptr_array (size_t (1) .. L);
+ for I in 1 .. Positive (L - 1) loop
+ if Info.Names (I) = null then
+ raise Form_Exception;
+ end if;
+ E.Arr (size_t (I)) := New_String (Info.Names (I).all);
+ if Auto_Release_Names then
+ S := Info.Names (I);
+ Release_String (S);
+ end if;
+ end loop;
+ E.Arr (L) := Null_Ptr;
+ return E;
+ end Create;
+
+ procedure Release (Enum : in out Enumeration_Field)
+ is
+ I : size_t := 0;
+ P : chars_ptr;
+ begin
+ loop
+ P := Enum.Arr (I);
+ exit when P = Null_Ptr;
+ Free (P);
+ Enum.Arr (I) := Null_Ptr;
+ I := I + 1;
+ end loop;
+ Enum.Arr := null;
+ end Release;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Enumeration_Field)
+ is
+ C_Enum_Type : C_Field_Type;
+ pragma Import (C, C_Enum_Type, "TYPE_ENUM");
+
+ function Set_Fld_Type (F : Field := Fld;
+ Cft : C_Field_Type := C_Enum_Type;
+ Arg1 : chars_ptr_array;
+ Arg2 : C_Int;
+ Arg3 : C_Int) return C_Int;
+ pragma Import (C, Set_Fld_Type, "set_field_type");
+
+ Res : Eti_Error;
+ begin
+ if Typ.Arr = null then
+ raise Form_Exception;
+ end if;
+ Res := Set_Fld_Type (Arg1 => Typ.Arr.all,
+ Arg2 => C_Int (Boolean'Pos (Typ.Case_Sensitive)),
+ Arg3 => C_Int (Boolean'Pos
+ (Typ.Match_Must_Be_Unique)));
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ Wrap_Builtin (Fld, Typ, C_Choice_Router);
+ end Set_Field_Type;
+
+end Terminal_Interface.Curses.Forms.Field_Types.Enumeration;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration --
+-- --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.5 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Interfaces.C.Strings;
+
+package Terminal_Interface.Curses.Forms.Field_Types.Enumeration is
+ pragma Preelaborate (Enumeration);
+
+ type String_Access is access String;
+
+ -- Type_Set is used by the child package Ada
+ type Type_Set is (Lower_Case, Upper_Case, Mixed_Case);
+
+ type Enum_Array is array (Positive range <>)
+ of String_Access;
+
+ type Enumeration_Info (C : Positive) is
+ record
+ Names : Enum_Array (1 .. C);
+ Case_Sensitive : Boolean := False;
+ Match_Must_Be_Unique : Boolean := False;
+ end record;
+
+ type Enumeration_Field is new Field_Type with private;
+
+ function Create (Info : Enumeration_Info;
+ Auto_Release_Names : Boolean := False)
+ return Enumeration_Field;
+ -- Make an fieldtype from the info. Enumerations are special, because
+ -- they normally don't copy the enum values into a private store, so
+ -- we have to care for the lifetime of the info we provide.
+ -- The Auto_Release_Names flag may be used to automatically releases
+ -- the strings in the Names array of the Enumeration_Info.
+
+ function Make_Enumeration_Type (Info : Enumeration_Info;
+ Auto_Release_Names : Boolean := False)
+ return Enumeration_Field renames Create;
+
+ procedure Release (Enum : in out Enumeration_Field);
+ -- But we may want to release the field to release the memory allocated
+ -- by it internally. After that the Enumeration field is no longer usable.
+
+ -- The next type defintions are all ncurses extensions. They are typically
+ -- not available in other curses implementations.
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Enumeration_Field);
+ pragma Inline (Set_Field_Type);
+
+private
+ type CPA_Access is access Interfaces.C.Strings.chars_ptr_array;
+
+ type Enumeration_Field is new Field_Type with
+ record
+ Case_Sensitive : Boolean := False;
+ Match_Must_Be_Unique : Boolean := False;
+ Arr : CPA_Access := null;
+ end record;
+
+end Terminal_Interface.Curses.Forms.Field_Types.Enumeration;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.IntField --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.3 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Interfaces.C;
+with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
+
+package body Terminal_Interface.Curses.Forms.Field_Types.IntField is
+
+ use type Interfaces.C.Int;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Integer_Field)
+ is
+ C_Integer_Field_Type : C_Field_Type;
+ pragma Import (C, C_Integer_Field_Type, "TYPE_INTEGER");
+
+ function Set_Fld_Type (F : Field := Fld;
+ Cft : C_Field_Type := C_Integer_Field_Type;
+ Arg1 : C_Int;
+ Arg2 : C_Long_Int;
+ Arg3 : C_Long_Int) return C_Int;
+ pragma Import (C, Set_Fld_Type, "set_field_type");
+
+ Res : Eti_Error;
+ begin
+ Res := Set_Fld_Type (Arg1 => C_Int (Typ.Precision),
+ Arg2 => C_Long_Int (Typ.Lower_Limit),
+ Arg3 => C_Long_Int (Typ.Upper_Limit));
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ Wrap_Builtin (Fld, Typ);
+ end Set_Field_Type;
+
+end Terminal_Interface.Curses.Forms.Field_Types.IntField;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.IntField --
+-- --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.5 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+package Terminal_Interface.Curses.Forms.Field_Types.IntField is
+ pragma Preelaborate (IntField);
+
+ type Integer_Field is new Field_Type with
+ record
+ Precision : Natural;
+ Lower_Limit : Integer;
+ Upper_Limit : Integer;
+ end record;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Integer_Field);
+ pragma Inline (Set_Field_Type);
+
+end Terminal_Interface.Curses.Forms.Field_Types.IntField;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.3 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Interfaces.C;
+with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
+
+package body Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address is
+
+ use type Interfaces.C.Int;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Internet_V4_Address_Field)
+ is
+ C_IPV4_Field_Type : C_Field_Type;
+ pragma Import (C, C_IPV4_Field_Type, "TYPE_IPV4");
+
+ function Set_Fld_Type (F : Field := Fld;
+ Cft : C_Field_Type := C_IPV4_Field_Type)
+ return C_Int;
+ pragma Import (C, Set_Fld_Type, "set_field_type");
+
+ Res : Eti_Error;
+ begin
+ Res := Set_Fld_Type;
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ Wrap_Builtin (Fld, Typ);
+ end Set_Field_Type;
+
+end Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address --
+-- --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.5 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+package Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address is
+ pragma Preelaborate (IPV4_Address);
+
+ type Internet_V4_Address_Field is new Field_Type with null record;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Internet_V4_Address_Field);
+ pragma Inline (Set_Field_Type);
+
+end Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.Numeric --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.3 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Interfaces.C;
+with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
+
+package body Terminal_Interface.Curses.Forms.Field_Types.Numeric is
+
+ use type Interfaces.C.Int;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Numeric_Field)
+ is
+ type Double is new Interfaces.C.double;
+
+ C_Numeric_Field_Type : C_Field_Type;
+ pragma Import (C, C_Numeric_Field_Type, "TYPE_NUMERIC");
+
+ function Set_Fld_Type (F : Field := Fld;
+ Cft : C_Field_Type := C_Numeric_Field_Type;
+ Arg1 : C_Int;
+ Arg2 : Double;
+ Arg3 : Double) return C_Int;
+ pragma Import (C, Set_Fld_Type, "set_field_type");
+
+ Res : Eti_Error;
+ begin
+ Res := Set_Fld_Type (Arg1 => C_Int (Typ.Precision),
+ Arg2 => Double (Typ.Lower_Limit),
+ Arg3 => Double (Typ.Upper_Limit));
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ Wrap_Builtin (Fld, Typ);
+ end Set_Field_Type;
+
+end Terminal_Interface.Curses.Forms.Field_Types.Numeric;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.Numeric --
+-- --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.5 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+package Terminal_Interface.Curses.Forms.Field_Types.Numeric is
+ pragma Preelaborate (Numeric);
+
+ type Numeric_Field is new Field_Type with
+ record
+ Precision : Natural;
+ Lower_Limit : Float;
+ Upper_Limit : Float;
+ end record;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Numeric_Field);
+ pragma Inline (Set_Field_Type);
+
+end Terminal_Interface.Curses.Forms.Field_Types.Numeric;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.RegExp --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.3 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Interfaces.C; use Interfaces.C;
+with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
+
+package body Terminal_Interface.Curses.Forms.Field_Types.RegExp is
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Regular_Expression_Field)
+ is
+ type Char_Ptr is access all Interfaces.C.Char;
+
+ C_Regexp_Field_Type : C_Field_Type;
+ pragma Import (C, C_Regexp_Field_Type, "TYPE_REGEXP");
+
+ function Set_Ftyp (F : Field := Fld;
+ Cft : C_Field_Type := C_Regexp_Field_Type;
+ Arg1 : Char_Ptr) return C_Int;
+ pragma Import (C, Set_Ftyp, "set_field_type");
+
+ Txt : char_array (0 .. Typ.Regular_Expression.all'Length);
+ Len : size_t;
+ Res : Eti_Error;
+ begin
+ To_C (Typ.Regular_Expression.all, Txt, Len);
+ Res := Set_Ftyp (Arg1 => Txt (Txt'First)'Access);
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ Wrap_Builtin (Fld, Typ);
+ end Set_Field_Type;
+
+end Terminal_Interface.Curses.Forms.Field_Types.RegExp;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.RegExp --
+-- --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.5 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+package Terminal_Interface.Curses.Forms.Field_Types.RegExp is
+ pragma Preelaborate (RegExp);
+
+ type String_Access is access String;
+
+ type Regular_Expression_Field is new Field_Type with
+ record
+ Regular_Expression : String_Access;
+ end record;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in Regular_Expression_Field);
+ pragma Inline (Set_Field_Type);
+
+end Terminal_Interface.Curses.Forms.Field_Types.RegExp;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.User.Choice --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.4 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Ada.Unchecked_Conversion;
+with Interfaces.C;
+
+package body Terminal_Interface.Curses.Forms.Field_Types.User.Choice is
+
+ use type Interfaces.C.Int;
+
+ function To_Argument_Access is new Ada.Unchecked_Conversion
+ (System.Address, Argument_Access);
+
+ function Generic_Next (Fld : Field;
+ Usr : System.Address) return C_Int
+ is
+ Result : Boolean;
+ Udf : User_Defined_Field_Type_With_Choice_Access :=
+ User_Defined_Field_Type_With_Choice_Access
+ (To_Argument_Access (Usr).Typ);
+ begin
+ Result := Next (Fld, Udf.all);
+ return C_Int (Boolean'Pos (Result));
+ end Generic_Next;
+
+ function Generic_Prev (Fld : Field;
+ Usr : System.Address) return C_Int
+ is
+ Result : Boolean;
+ Udf : User_Defined_Field_Type_With_Choice_Access :=
+ User_Defined_Field_Type_With_Choice_Access
+ (To_Argument_Access (Usr).Typ);
+ begin
+ Result := Previous (Fld, Udf.all);
+ return C_Int (Boolean'Pos (Result));
+ end Generic_Prev;
+
+ -- -----------------------------------------------------------------------
+ --
+ function C_Generic_Choice return C_Field_Type
+ is
+ Res : Eti_Error;
+ T : C_Field_Type;
+ begin
+ if M_Generic_Choice = Null_Field_Type then
+ T := New_Fieldtype (Generic_Field_Check'Access,
+ Generic_Char_Check'Access);
+ if T = Null_Field_Type then
+ raise Form_Exception;
+ else
+ Res := Set_Fieldtype_Arg (T,
+ Make_Arg'Access,
+ Copy_Arg'Access,
+ Free_Arg'Access);
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+
+ Res := Set_Fieldtype_Choice (T,
+ Generic_Next'Access,
+ Generic_Prev'Access);
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ end if;
+ M_Generic_Choice := T;
+ end if;
+ pragma Assert (M_Generic_Choice /= Null_Field_Type);
+ return M_Generic_Choice;
+ end C_Generic_Choice;
+
+end Terminal_Interface.Curses.Forms.Field_Types.User.Choice;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.User.Choice --
+-- --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.4 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Ada.Unchecked_Deallocation;
+with Terminal_Interface.Curses.Aux;
+
+package Terminal_Interface.Curses.Forms.Field_Types.User.Choice is
+ pragma Preelaborate (Choice);
+
+ type User_Defined_Field_Type_With_Choice is abstract new
+ User_Defined_Field_Type with null record;
+ -- This is the root of the mechanism we use to create field types in
+ -- Ada95 that allow the prev/next mechanism. You should your own type
+ -- derive from this one and implement the Field_Check, Character_Check
+ -- Next and Previous functions for your own type.
+
+ type User_Defined_Field_Type_With_Choice_Access is access all
+ User_Defined_Field_Type_With_Choice'Class;
+
+ function Next
+ (Fld : Field;
+ Typ : User_Defined_Field_Type_With_Choice) return Boolean
+ is abstract;
+ -- If True is returned, the function successfully generated a next
+ -- value into the fields buffer.
+
+ function Previous
+ (Fld : Field;
+ Typ : User_Defined_Field_Type_With_Choice) return Boolean
+ is abstract;
+ -- If True is returned, the function successfully generated a previous
+ -- value into the fields buffer.
+
+ -- +----------------------------------------------------------------------
+ -- | Private Part.
+ -- |
+private
+ use type Interfaces.C.Int;
+
+ function C_Generic_Choice return C_Field_Type;
+
+ function Generic_Next (Fld : Field;
+ Usr : System.Address) return C_Int;
+ pragma Convention (C, Generic_Next);
+ -- This is the generic next Choice_Function for the low-level fieldtype
+ -- representing all the User_Defined_Field_Type derivates. It routes
+ -- the call to the Next implementation for the type.
+
+ function Generic_Prev (Fld : Field;
+ Usr : System.Address) return C_Int;
+ pragma Convention (C, Generic_Prev);
+ -- This is the generic prev Choice_Function for the low-level fieldtype
+ -- representing all the User_Defined_Field_Type derivates. It routes
+ -- the call to the Previous implementation for the type.
+
+end Terminal_Interface.Curses.Forms.Field_Types.User.Choice;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.User --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.4 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Ada.Unchecked_Conversion;
+with Interfaces.C;
+
+package body Terminal_Interface.Curses.Forms.Field_Types.User is
+
+ use type Interfaces.C.Int;
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in User_Defined_Field_Type)
+ is
+ function Allocate_Arg (T : User_Defined_Field_Type'Class)
+ return Argument_Access;
+
+ function Set_Fld_Type (F : Field := Fld;
+ Cft : C_Field_Type := C_Generic_Type;
+ Arg1 : Argument_Access)
+ return C_Int;
+ pragma Import (C, Set_Fld_Type, "set_field_type");
+
+ Res : Eti_Error;
+
+ function Allocate_Arg (T : User_Defined_Field_Type'Class)
+ return Argument_Access
+ is
+ Ptr : Field_Type_Access := new User_Defined_Field_Type'Class'(T);
+ begin
+ return new Argument'(Usr => System.Null_Address,
+ Typ => Ptr,
+ Cft => Null_Field_Type);
+ end Allocate_Arg;
+
+ begin
+ Res := Set_Fld_Type (Arg1 => Allocate_Arg (Typ));
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ end Set_Field_Type;
+
+ function To_Argument_Access is new Ada.Unchecked_Conversion
+ (System.Address, Argument_Access);
+
+ function Generic_Field_Check (Fld : Field;
+ Usr : System.Address) return C_Int
+ is
+ Result : Boolean;
+ Udf : User_Defined_Field_Type_Access :=
+ User_Defined_Field_Type_Access (To_Argument_Access (Usr).Typ);
+ begin
+ Result := Field_Check (Fld, Udf.all);
+ return C_Int (Boolean'Pos (Result));
+ end Generic_Field_Check;
+
+ function Generic_Char_Check (Ch : C_Int;
+ Usr : System.Address) return C_Int
+ is
+ Result : Boolean;
+ Udf : User_Defined_Field_Type_Access :=
+ User_Defined_Field_Type_Access (To_Argument_Access (Usr).Typ);
+ begin
+ Result := Character_Check (Character'Val (Ch), Udf.all);
+ return C_Int (Boolean'Pos (Result));
+ end Generic_Char_Check;
+
+ -- -----------------------------------------------------------------------
+ --
+ function C_Generic_Type return C_Field_Type
+ is
+ Res : Eti_Error;
+ T : C_Field_Type;
+ begin
+ if M_Generic_Type = Null_Field_Type then
+ T := New_Fieldtype (Generic_Field_Check'Access,
+ Generic_Char_Check'Access);
+ if T = Null_Field_Type then
+ raise Form_Exception;
+ else
+ Res := Set_Fieldtype_Arg (T,
+ Make_Arg'Access,
+ Copy_Arg'Access,
+ Free_Arg'Access);
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ end if;
+ M_Generic_Type := T;
+ end if;
+ pragma Assert (M_Generic_Type /= Null_Field_Type);
+ return M_Generic_Type;
+ end C_Generic_Type;
+
+end Terminal_Interface.Curses.Forms.Field_Types.User;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding --
+-- --
+-- Terminal_Interface.Curses.Forms.Field_Types.User --
+-- --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
+-- Version Control:
+-- $Revision: 1.4 $
+-- Binding Version 00.93
+------------------------------------------------------------------------------
+with Ada.Unchecked_Deallocation;
+with Terminal_Interface.Curses.Aux;
+
+package Terminal_Interface.Curses.Forms.Field_Types.User is
+ pragma Preelaborate (User);
+
+ type User_Defined_Field_Type is abstract new Field_Type with null record;
+ -- This is the root of the mechanism we use to create field types in
+ -- Ada95. You should your own type derive from this one and implement
+ -- the Field_Check and Character_Check functions for your own type.
+
+ type User_Defined_Field_Type_Access is access all
+ User_Defined_Field_Type'Class;
+
+ function Field_Check
+ (Fld : Field;
+ Typ : User_Defined_Field_Type) return Boolean
+ is abstract;
+ -- If True is returned, the field is considered valid, otherwise it is
+ -- invalid.
+
+ function Character_Check
+ (Ch : Character;
+ Typ : User_Defined_Field_Type) return Boolean
+ is abstract;
+ -- If True is returned, the character is considered as valid for the
+ -- field, otherwise as invalid.
+
+ procedure Set_Field_Type (Fld : in Field;
+ Typ : in User_Defined_Field_Type);
+ -- This should work for all types derived from User_Defined_Field_Type.
+ -- No need to reimplement it for your derived type.
+
+ -- +----------------------------------------------------------------------
+ -- | Private Part.
+ -- | Used by the Choice child package.
+private
+ use type Interfaces.C.Int;
+
+ function C_Generic_Type return C_Field_Type;
+
+ function Generic_Field_Check (Fld : Field;
+ Usr : System.Address) return C_Int;
+ pragma Convention (C, Generic_Field_Check);
+ -- This is the generic Field_Check_Function for the low-level fieldtype
+ -- representing all the User_Defined_Field_Type derivates. It routes
+ -- the call to the Field_Check implementation for the type.
+
+ function Generic_Char_Check (Ch : C_Int;
+ Usr : System.Address) return C_Int;
+ pragma Convention (C, Generic_Char_Check);
+ -- This is the generic Char_Check_Function for the low-level fieldtype
+ -- representing all the User_Defined_Field_Type derivates. It routes
+ -- the call to the Character_Check implementation for the type.
+
+end Terminal_Interface.Curses.Forms.Field_Types.User;
-- --
-- B O D Y --
-- --
--- Version 00.92 --
+------------------------------------------------------------------------------
+-- 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 ncurses Ada95 binding is copyrighted 1996 by --
--- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
-- --
--- Permission is hereby granted to reproduce and distribute this --
--- binding by any means and for any fee, whether alone or as part --
--- of a larger distribution, in source or in binary form, PROVIDED --
--- this notice is included with any such distribution, and is not --
--- removed from any of its header files. Mention of ncurses and the --
--- author of this binding in any applications linked with it is --
--- highly appreciated. --
+-- 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. --
-- --
--- This binding comes AS IS with no warranty, implied or expressed. --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
-- Version Control:
--- $Revision: 1.4 $
+-- $Revision: 1.8 $
+-- Binding Version 00.93
------------------------------------------------------------------------------
with Interfaces.C;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
-with Unchecked_Deallocation;
-
+with Ada.Unchecked_Deallocation;
+with Ada.Unchecked_Conversion;
+with Terminal_Interface.Curses.Forms.Field_Types.User;
+with Terminal_Interface.Curses.Forms.Field_Types.User.Choice;
-- |
-- |=====================================================================
-- | man page form_fieldtype.3x
package body Terminal_Interface.Curses.Forms.Field_Types is
use type Interfaces.C.int;
+ use type System.Address;
- type F_Check is access
- function (Fld : Field; Info : User_Access) return C_Int;
- pragma Convention (C, F_Check);
-
- type C_Check is access
- function (Ch : Character; Info : User_Access) return C_Int;
- pragma Convention (C, C_Check);
+ function To_Argument_Access is new Ada.Unchecked_Conversion
+ (System.Address, Argument_Access);
- procedure Free is new
- Unchecked_Deallocation (User, User_Access);
+ function Get_Fieldtype (F : Field) return C_Field_Type;
+ pragma Import (C, Get_Fieldtype, "field_type");
- -- Forward decls.
- procedure Register_Field_Type;
- procedure Unregister_Field_Type;
-
- procedure Initialize (Obj : in out Tracker)
+ function Get_Arg (F : Field) return System.Address;
+ pragma Import (C, Get_Arg, "field_arg");
+ -- |
+ -- |=====================================================================
+ -- | man page form_field_validation.3x
+ -- |=====================================================================
+ -- |
+ -- |
+ -- |
+ function Get_Type (Fld : in Field) return Field_Type_Access
is
+ Low_Level : constant C_Field_Type := Get_Fieldtype (Fld);
+ Arg : Argument_Access;
begin
- Register_Field_Type;
- end Initialize;
+ if Low_Level = Null_Field_Type then
+ return null;
+ else
+ if Low_Level = M_Builtin_Router or else
+ Low_Level = M_Generic_Type or else
+ Low_Level = M_Choice_Router or else
+ Low_Level = M_Generic_Choice then
+ Arg := To_Argument_Access (Get_Arg (Fld));
+ if Arg = null then
+ raise Form_Exception;
+ else
+ return Arg.Typ;
+ end if;
+ else
+ raise Form_Exception;
+ end if;
+ end if;
+ end Get_Type;
- procedure Finalize (Obj : in out Tracker)
+ function Make_Arg (Args : System.Address) return System.Address
is
+ function Getarg (Arg : System.Address := Args)
+ return System.Address;
+ pragma Import (C, Getarg, "_nc_ada_getvarg");
begin
- Unregister_Field_Type;
- end Finalize;
-
- function Fc (Fld : Field; Info : User_Access) return C_Int;
- pragma Convention (C, Fc);
-
- function Cc (Ch : Character; Info : User_Access) return C_Int;
- pragma Convention (C, Cc);
+ return Getarg;
+ end Make_Arg;
- function Make_Arg (U : User_Access) return User_Access;
- pragma Convention (C, Make_Arg);
+ function Copy_Arg (Usr : System.Address) return System.Address
+ is
+ begin
+ return Usr;
+ end Copy_Arg;
- function Copy_Arg (U : User_Access) return User_Access;
- pragma Convention (C, Copy_Arg);
+ procedure Free_Arg (Usr : in System.Address)
+ is
+ procedure Free_Type is new Ada.Unchecked_Deallocation
+ (Field_Type'Class, Field_Type_Access);
+ procedure Freeargs is new Ada.Unchecked_Deallocation
+ (Argument, Argument_Access);
- procedure Free_Arg (U : User_Access);
- pragma Convention (C, Free_Arg);
+ To_Be_Free : Argument_Access := To_Argument_Access (Usr);
+ Low_Level : C_Field_Type;
+ begin
+ if To_Be_Free /= null then
+ if To_Be_Free.Usr /= System.Null_Address then
+ Low_Level := To_Be_Free.Cft;
+ if Low_Level.Freearg /= null then
+ Low_Level.Freearg (To_Be_Free.Usr);
+ end if;
+ end if;
+ if To_Be_Free.Typ /= null then
+ Free_Type (To_Be_Free.Typ);
+ end if;
+ Freeargs (To_Be_Free);
+ end if;
+ end Free_Arg;
- function New_Fieldtype (Fc : F_Check;
- Cc : C_Check) return C_Field_Type;
- pragma Import (C, New_Fieldtype, "new_fieldtype");
- function Fc (Fld : Field; Info : User_Access) return C_Int
+ procedure Wrap_Builtin (Fld : Field;
+ Typ : Field_Type'Class;
+ Cft : C_Field_Type := C_Builtin_Router)
is
+ Usr_Arg : System.Address := Get_Arg (Fld);
+ Low_Level : constant C_Field_Type := Get_Fieldtype (Fld);
+ Arg : Argument_Access;
+ Res : Eti_Error;
+ function Set_Fld_Type (F : Field := Fld;
+ Cf : C_Field_Type := Cft;
+ Arg1 : Argument_Access) return C_Int;
+ pragma Import (C, Set_Fld_Type, "set_field_type");
+
begin
- return C_Int (Boolean'Pos (Field_Check (Fld, Info)));
- end Fc;
+ pragma Assert (Low_Level /= Null_Field_Type);
+ if Cft /= C_Builtin_Router and then Cft /= C_Choice_Router then
+ raise Form_Exception;
+ else
+ Arg := new Argument'(Usr => System.Null_Address,
+ Typ => new Field_Type'Class'(Typ),
+ Cft => Get_Fieldtype (Fld));
+ if Usr_Arg /= System.Null_Address then
+ if Low_Level.Copyarg /= null then
+ Arg.Usr := Low_Level.Copyarg (Usr_Arg);
+ else
+ Arg.Usr := Usr_Arg;
+ end if;
+ end if;
- function Cc (Ch : Character; Info : User_Access) return C_Int
+ Res := Set_Fld_Type (Arg1 => Arg);
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ end if;
+ end Wrap_Builtin;
+
+ function Field_Check_Router (Fld : Field;
+ Usr : System.Address) return C_Int
is
+ Arg : constant Argument_Access := To_Argument_Access (Usr);
begin
- return C_Int (Boolean'Pos (Character_Check (Ch, Info)));
- end Cc;
+ pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type
+ and then Arg.Typ /= null);
+ if Arg.Cft.Fcheck /= null then
+ return Arg.Cft.Fcheck (Fld, Arg.Usr);
+ else
+ return 1;
+ end if;
+ end Field_Check_Router;
- function Make_Arg (U : User_Access) return User_Access
+ function Char_Check_Router (Ch : C_Int;
+ Usr : System.Address) return C_Int
is
- function Fixme (U : User_Access) return User_Access;
- pragma Import (C, Fixme, "_nc_ada_getvarg");
- V : constant User_Access := Fixme (U);
- I : constant User_Access := new User'(V.all);
+ Arg : constant Argument_Access := To_Argument_Access (Usr);
begin
- return I;
- end Make_Arg;
+ pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type
+ and then Arg.Typ /= null);
+ if Arg.Cft.Ccheck /= null then
+ return Arg.Cft.Ccheck (Ch, Arg.Usr);
+ else
+ return 1;
+ end if;
+ end Char_Check_Router;
- function Copy_Arg (U : User_Access) return User_Access
+ function Next_Router (Fld : Field;
+ Usr : System.Address) return C_Int
is
- I : constant User_Access := new User'(U.all);
+ Arg : constant Argument_Access := To_Argument_Access (Usr);
begin
- return I;
- end Copy_Arg;
+ pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type
+ and then Arg.Typ /= null);
+ if Arg.Cft.Next /= null then
+ return Arg.Cft.Next (Fld, Arg.Usr);
+ else
+ return 1;
+ end if;
+ end Next_Router;
- procedure Free_Arg (U : User_Access)
+ function Prev_Router (Fld : Field;
+ Usr : System.Address) return C_Int
is
+ Arg : constant Argument_Access := To_Argument_Access (Usr);
begin
- null;
- end Free_Arg;
-
- type M_Arg is access function (U : User_Access) return User_Access;
- pragma Convention (C, M_Arg);
-
- type C_Arg is access function (U : User_Access) return User_Access;
- pragma Convention (C, C_Arg);
-
- type F_Arg is access procedure (U : User_Access);
- pragma Convention (C, F_Arg);
-
- function Set_Fieldtype_Arg (Typ : C_Field_Type;
- Ma : M_Arg;
- Ca : C_Arg;
- Fa : F_Arg) return C_Int;
- pragma Import (C, Set_Fieldtype_Arg, "set_fieldtype_arg");
- -- |
- -- |
- -- |
+ pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type
+ and then Arg.Typ /= null);
+ if Arg.Cft.Prev /= null then
+ return Arg.Cft.Prev (Fld, Arg.Usr);
+ else
+ return 1;
+ end if;
+ end Prev_Router;
- procedure Register_Field_Type
+ -- -----------------------------------------------------------------------
+ --
+ function C_Builtin_Router return C_Field_Type
is
Res : Eti_Error;
- Cft : C_Field_Type;
- P : User_Access := new User;
- -- we need an instance to call
- -- the Register_Type procedure
+ T : C_Field_Type;
begin
- Cft := New_Fieldtype (Fc'Access,
- Cc'Access);
- if Cft = Null_Field_Type then
- raise Form_Exception;
- end if;
- Res := Set_Fieldtype_Arg (Cft,
- Make_Arg'Access,
- Copy_Arg'Access,
- Free_Arg'Access);
- if Res /= E_Ok then
- Eti_Exception (Res);
+ if M_Builtin_Router = Null_Field_Type then
+ T := New_Fieldtype (Field_Check_Router'Access,
+ Char_Check_Router'Access);
+ if T = Null_Field_Type then
+ raise Form_Exception;
+ else
+ Res := Set_Fieldtype_Arg (T,
+ Make_Arg'Access,
+ Copy_Arg'Access,
+ Free_Arg'Access);
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ end if;
+ M_Builtin_Router := T;
end if;
+ pragma Assert (M_Builtin_Router /= Null_Field_Type);
+ return M_Builtin_Router;
+ end C_Builtin_Router;
- Register_Type (P.all, Cft);
- Free (P);
- end Register_Field_Type;
- -- |
- -- |
- -- |
- procedure Unregister_Field_Type
+ -- -----------------------------------------------------------------------
+ --
+ function C_Choice_Router return C_Field_Type
is
- P : User_Access := new User;
- -- we need an instance to call
- -- the Unregister_Type procedure
+ Res : Eti_Error;
+ T : C_Field_Type;
begin
- Unregister_Type (P.all);
- Free (P);
- end Unregister_Field_Type;
-
- Hook : Tracker;
-end Terminal_Interface.Curses.Forms.Field_Types;
-
-
-
+ if M_Choice_Router = Null_Field_Type then
+ T := New_Fieldtype (Field_Check_Router'Access,
+ Char_Check_Router'Access);
+ if T = Null_Field_Type then
+ raise Form_Exception;
+ else
+ Res := Set_Fieldtype_Arg (T,
+ Make_Arg'Access,
+ Copy_Arg'Access,
+ Free_Arg'Access);
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ Res := Set_Fieldtype_Choice (T,
+ Next_Router'Access,
+ Prev_Router'Access);
+ if Res /= E_Ok then
+ Eti_Exception (Res);
+ end if;
+ end if;
+ M_Choice_Router := T;
+ end if;
+ pragma Assert (M_Choice_Router /= Null_Field_Type);
+ return M_Choice_Router;
+ end C_Choice_Router;
+end Terminal_Interface.Curses.Forms.Field_Types;
+++ /dev/null
-------------------------------------------------------------------------------
--- --
--- GNAT ncurses Binding --
--- --
--- Terminal_Interface.Curses.Forms.Field_Types --
--- --
--- S P E C --
--- --
--- Version 00.92 --
--- --
--- The ncurses Ada95 binding is copyrighted 1996 by --
--- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
--- --
--- Permission is hereby granted to reproduce and distribute this --
--- binding by any means and for any fee, whether alone or as part --
--- of a larger distribution, in source or in binary form, PROVIDED --
--- this notice is included with any such distribution, and is not --
--- removed from any of its header files. Mention of ncurses and the --
--- author of this binding in any applications linked with it is --
--- highly appreciated. --
--- --
--- This binding comes AS IS with no warranty, implied or expressed. --
-------------------------------------------------------------------------------
--- Version Control:
--- $Revision: 1.3 $
-------------------------------------------------------------------------------
-with Ada.Finalization; use Ada.Finalization;
-
--- You must instantiate this package for any user defined field type
--- to make it visible to the runtime.
---
-generic
- type User is new Ada_Defined_Field_Type with private;
- type User_Access is access User;
- with function Field_Check (Fld : Field;
- Info : User_Access) return Boolean;
- with function Character_Check (Ch : Character;
- Info : User_Access) return Boolean;
-package Terminal_Interface.Curses.Forms.Field_Types is
---
--- Nothing public. All happens magically.
---
-private
- type Tracker is new Limited_Controlled with null record;
-
- procedure Initialize (Obj : in out Tracker);
- procedure Finalize (Obj : in out Tracker);
-
-end Terminal_Interface.Curses.Forms.Field_Types;
-
-- --
-- B O D Y --
-- --
--- Version 00.92 --
+------------------------------------------------------------------------------
+-- 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 ncurses Ada95 binding is copyrighted 1996 by --
--- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
-- --
--- Permission is hereby granted to reproduce and distribute this --
--- binding by any means and for any fee, whether alone or as part --
--- of a larger distribution, in source or in binary form, PROVIDED --
--- this notice is included with any such distribution, and is not --
--- removed from any of its header files. Mention of ncurses and the --
--- author of this binding in any applications linked with it is --
--- highly appreciated. --
+-- 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. --
-- --
--- This binding comes AS IS with no warranty, implied or expressed. --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
-- Version Control:
--- $Revision: 1.3 $
+-- $Revision: 1.7 $
+-- Binding Version 00.93
------------------------------------------------------------------------------
-with Unchecked_Conversion;
-with Terminal_Interface.Curses.Aux;
-use Terminal_Interface.Curses.Aux;
+with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
-- |
-- |=====================================================================
-- |=====================================================================
-- |
package body Terminal_Interface.Curses.Forms.Field_User_Data is
-
- function To_Address is new Unchecked_Conversion (User_Access,
- System.Address);
- function To_Pointer is new Unchecked_Conversion (System.Address,
- User_Access);
-- |
-- |
-- |
+ use type Interfaces.C.Int;
+
procedure Set_User_Data (Fld : in Field;
Data : in User_Access)
is
- A : constant Field_User_Wrapper_Access := Field_Userptr (Fld);
- B : Field_User_Wrapper_Access;
- R : C_Int;
+ function Set_Field_Userptr (Fld : Field;
+ Usr : User_Access) return C_Int;
+ pragma Import (C, Set_Field_Userptr, "set_field_userptr");
+
+ Res : constant Eti_Error := Set_Field_Userptr (Fld, Data);
begin
- if A = null then
- raise Form_Exception;
- else
- if A.N > 1 then
- B := new Field_User_Wrapper'(T => A.T,
- N => 1,
- U => To_Address (Data));
- R := Set_Field_Userptr (Fld, B);
- A.N := A.N - 1;
- else
- A.U := To_Address (Data);
- end if;
+ if Res /= E_Ok then
+ Eti_Exception (Res);
end if;
end Set_User_Data;
-- |
-- |
-- |
+ function Get_User_Data (Fld : in Field) return User_Access
+ is
+ function Field_Userptr (Fld : Field) return User_Access;
+ pragma Import (C, Field_Userptr, "field_userptr");
+ begin
+ return Field_Userptr (Fld);
+ end Get_User_Data;
+
procedure Get_User_Data (Fld : in Field;
Data : out User_Access)
is
- A : constant Field_User_Wrapper_Access := Field_Userptr (Fld);
begin
- if A = null then
- raise Form_Exception;
- else
- Data := To_Pointer (A.U);
- end if;
+ Data := Get_User_Data (Fld);
end Get_User_Data;
-
+
end Terminal_Interface.Curses.Forms.Field_User_Data;
-- --
-- B O D Y --
-- --
--- Version 00.92 --
+------------------------------------------------------------------------------
+-- 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 ncurses Ada95 binding is copyrighted 1996 by --
--- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
-- --
--- Permission is hereby granted to reproduce and distribute this --
--- binding by any means and for any fee, whether alone or as part --
--- of a larger distribution, in source or in binary form, PROVIDED --
--- this notice is included with any such distribution, and is not --
--- removed from any of its header files. Mention of ncurses and the --
--- author of this binding in any applications linked with it is --
--- highly appreciated. --
+-- 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. --
-- --
--- This binding comes AS IS with no warranty, implied or expressed. --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
-- Version Control:
--- $Revision: 1.3 $
+-- $Revision: 1.7 $
+-- Binding Version 00.93
------------------------------------------------------------------------------
-with Unchecked_Conversion;
-- |
-- |=====================================================================
-- | man page form__userptr.3x
-- |=====================================================================
-- |
+with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
+
package body Terminal_Interface.Curses.Forms.Form_User_Data is
-
- function To_Address is new Unchecked_Conversion (User_Access,
- System.Address);
- function To_Pointer is new Unchecked_Conversion (System.Address,
- User_Access);
+
+ use type Interfaces.C.Int;
+
-- |
-- |
-- |
procedure Set_User_Data (Frm : in Form;
Data : in User_Access)
is
- A : constant Form_User_Wrapper_Access := Form_Userptr (Frm);
+ function Set_Form_Userptr (Frm : Form;
+ Data : User_Access) return C_Int;
+ pragma Import (C, Set_Form_Userptr, "set_form_userptr");
+
+ Res : constant Eti_Error := Set_Form_Userptr (Frm, Data);
begin
- if A = null then
- raise Form_Exception;
- else
- A.U := To_Address (Data);
+ if Res /= E_Ok then
+ Eti_Exception (Res);
end if;
end Set_User_Data;
-- |
-- |
-- |
+ function Get_User_Data (Frm : in Form) return User_Access
+ is
+ function Form_Userptr (Frm : Form) return User_Access;
+ pragma Import (C, Form_Userptr, "form_userptr");
+ begin
+ return Form_Userptr (Frm);
+ end Get_User_Data;
+
procedure Get_User_Data (Frm : in Form;
Data : out User_Access)
is
- A : constant Form_User_Wrapper_Access := Form_Userptr (Frm);
begin
- if A = null then
- raise Form_Exception;
- else
- Data := To_Pointer (A.U);
- end if;
+ Data := Get_User_Data (Frm);
end Get_User_Data;
-
+
end Terminal_Interface.Curses.Forms.Form_User_Data;
-- --
-- B O D Y --
-- --
--- Version 00.92 --
+------------------------------------------------------------------------------
+-- 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 ncurses Ada95 binding is copyrighted 1996 by --
--- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
-- --
--- Permission is hereby granted to reproduce and distribute this --
--- binding by any means and for any fee, whether alone or as part --
--- of a larger distribution, in source or in binary form, PROVIDED --
--- this notice is included with any such distribution, and is not --
--- removed from any of its header files. Mention of ncurses and the --
--- author of this binding in any applications linked with it is --
--- highly appreciated. --
+-- 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. --
-- --
--- This binding comes AS IS with no warranty, implied or expressed. --
+-- 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 <Juergen.Pfeifer@T-Online.de> 1996
-- Version Control:
--- $Revision: 1.9 $
+-- $Revision: 1.13 $
+-- Binding Version 00.93
------------------------------------------------------------------------------
-with Ada.Tags; use Ada.Tags;
with Ada.Unchecked_Deallocation;
with Unchecked_Conversion;
with Interfaces.C.Strings; use Interfaces.C.Strings;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
-with GNAT.Htable;
package body Terminal_Interface.Curses.Forms is
begin
Fill_String (Form_Request_Name (C_Int (Key)), Name);
end Request_Name;
-------------------------------------------------------------------------------
- procedure Free_Field_User_Wrapper is
- new Ada.Unchecked_Deallocation (Field_User_Wrapper,
- Field_User_Wrapper_Access);
-
- procedure Release_User_Wrapper (A : in out Field_User_Wrapper_Access);
- procedure Dup_User_Wrapper (A : in out Field_User_Wrapper_Access);
-
- procedure Release_User_Wrapper (A : in out Field_User_Wrapper_Access)
- is
- begin
- A.N := A.N - 1;
- if A.N = 0 then
- Free_Field_User_Wrapper (A);
- end if;
- end Release_User_Wrapper;
- pragma Inline (Release_User_Wrapper);
- procedure Dup_User_Wrapper (A : in out Field_User_Wrapper_Access)
+ function Request_Name (Key : Form_Request_Code) return String
is
+ function Form_Request_Name (Key : C_Int) return chars_ptr;
+ pragma Import (C, Form_Request_Name, "form_request_name");
begin
- A.N := A.N + 1;
- end Dup_User_Wrapper;
- pragma Inline (Dup_User_Wrapper);
+ return Fill_String (Form_Request_Name (C_Int (Key)));
+ end Request_Name;
------------------------------------------------------------------------------
- procedure Free_Form_User_Wrapper is
- new Ada.Unchecked_Deallocation (Form_User_Wrapper,
- Form_User_Wrapper_Access);
-- |
-- |
-- |
C_Int (Top), C_Int (Left),
C_Int (Off_Screen),
C_Int (More_Buffers));
-
- A : Field_User_Wrapper_Access;
- Res : Eti_Error;
begin
if Fld = Null_Field then
raise Form_Exception;
- else
- A := new Field_User_Wrapper'(U => System.Null_Address,
- T => null,
- N => 1);
- Res := Set_Field_Userptr (Fld, A);
- if Res /= E_Ok then
- Free_Field_User_Wrapper (A);
- Eti_Exception (Res);
- end if;
end if;
return Fld;
end Create;
is
function Free_Field (Fld : Field) return C_Int;
pragma Import (C, Free_Field, "free_field");
- procedure Free_Field_Type is
- new Ada.Unchecked_Deallocation (Field_Type'Class,
- Field_Type_Access);
- A : Field_User_Wrapper_Access := Field_Userptr (Fld);
Res : Eti_Error;
begin
- if A /= null then
- if A.T /= null then
- Free_Field_Type (A.T);
- end if;
- Release_User_Wrapper (A);
- end if;
Res := Free_Field (Fld);
if Res /= E_Ok then
Eti_Exception (Res);
Left : C_Int) return Field;
pragma Import (C, Dup_Field, "dup_field");
- A : Field_User_Wrapper_Access := Field_Userptr (Fld);
F : constant Field := Dup_Field (Fld,
C_Int (Top),
C_Int (Left));
begin
if F = Null_Field then
raise Form_Exception;
- else
- Dup_User_Wrapper (A);
end if;
return F;
end Duplicate;
Left : C_Int) return Field;
pragma Import (C, Lnk_Field, "link_field");
- A : Field_User_Wrapper_Access := Field_Userptr (Fld);
F : constant Field := Lnk_Field (Fld,
C_Int (Top),
C_Int (Left));
begin
if F = Null_Field then
raise Form_Exception;
- else
- Dup_User_Wrapper (A);
end if;
return F;
end Link;
begin
Fill_String (Field_Buffer (Fld, C_Int (Buffer)), Str);
end Get_Buffer;
+
+ function Get_Buffer
+ (Fld : in Field;
+ Buffer : in Buffer_Number := Buffer_Number'First) return String
+ is
+ function Field_Buffer (Fld : Field;
+ B : C_Int) return chars_ptr;
+ pragma Import (C, Field_Buffer, "field_buffer");
+ begin
+ return Fill_String (Field_Buffer (Fld, C_Int (Buffer)));
+ end Get_Buffer;
-- |
-- |
-- |
-- |
-- |
-- |
- procedure Free_Allocated_Fields is
- new Ada.Unchecked_Deallocation (Field_Array, Field_Array_Access);
- -- |
- -- |
- -- |
- -- This is a bit delicate if we want to manipulate an Ada created form
- -- from C routines or vice versa.
- -- In Ada created forms we use the low level user pointer to maintain
- -- binding internal additional informations about the form. This
- -- internal information contains a hook for the Ada provided user pointer.
- -- Unless you understand this implementation, the safest way in mixed
- -- language programs to deal with user pointers is, that only the language
- -- that created the form should also manipulate the user pointer for that
- -- form.
procedure Redefine (Frm : in Form;
- Flds : in Field_Array)
+ Flds : in Field_Array_Access)
is
function Set_Frm_Fields (Frm : Form;
- Items : Field_Array) return C_Int;
+ Items : System.Address) return C_Int;
pragma Import (C, Set_Frm_Fields, "set_form_fields");
- A : constant Form_User_Wrapper_Access := Form_Userptr (Frm);
- I : Field_Array_Access;
Res : Eti_Error;
begin
- if A = null or else A.I = null then raise Form_Exception;
+ pragma Assert (Flds (Flds'Last) = Null_Field);
+ if Flds (Flds'Last) /= Null_Field then
+ raise Form_Exception;
else
- I := new Field_Array (1 .. (Flds'Length + 1));
- I.all (1 .. Flds'Length) := Flds (Flds'First .. Flds'Last);
- I.all (Flds'Length + 1) := Null_Field;
- Res := Set_Frm_Fields (Frm, I.all);
+ Res := Set_Frm_Fields (Frm, Flds (Flds'First)'Address);
if Res /= E_Ok then
- Free_Allocated_Fields (I);
Eti_Exception (Res);
- else
- Free_Allocated_Fields (A.I);
- A.I := I;
end if;
end if;
end Redefine;
-- |
-- |
-- |
- function Fields (Frm : Form) return Field_Array_Access
+ function Fields (Frm : Form;
+ Index : Positive) return Field
is
- A : constant Form_User_Wrapper_Access := Form_Userptr (Frm);
+ function F_Fields (Frm : Form;
+ Idx : C_Int) return Field;
+ pragma Import (C, F_Fields, "_nc_get_field");
begin
- if A = null or else A.I = null then
+ if Frm = Null_Form or else Index not in 1 .. Field_Count (Frm) then
raise Form_Exception;
else
- return A.I;
+ return F_Fields (Frm, C_Int (Index) - 1);
end if;
end Fields;
-- |
-- |
-- |
-- |
- function Create (Fields : Field_Array) return Form
+ function Create (Fields : Field_Array_Access) return Form
is
- function NewForm (Fields : Field_Array) return Form;
+ function NewForm (Fields : System.Address) return Form;
pragma Import (C, NewForm, "new_form");
M : Form;
- I : Field_Array_Access;
- U : Form_User_Wrapper_Access;
- Res : Eti_Error;
begin
- I := new Field_Array (1 .. (Fields'Length + 1));
- I.all (1 .. Fields'Length) := Fields (Fields'First .. Fields'Last);
- I.all (Fields'Length + 1) := Null_Field;
- M := NewForm (I.all);
- if M = Null_Form then
- Free_Allocated_Fields (I);
+ pragma Assert (Fields (Fields'Last) = Null_Field);
+ if Fields (Fields'Last) /= Null_Field then
raise Form_Exception;
+ else
+ M := NewForm (Fields (Fields'First)'Address);
+ if M = Null_Form then
+ raise Form_Exception;
+ end if;
+ return M;
end if;
- U := new Form_User_Wrapper'(U => System.Null_Address, I => I);
- Res := Set_Form_Userptr (M, U);
- if Res /= E_Ok then
- Free_Allocated_Fields (I);
- Free_Form_User_Wrapper (U);
- Eti_Exception (Res);
- end if;
- return M;
end Create;
-- |
-- |
function Free (Frm : Form) return C_Int;
pragma Import (C, Free, "free_form");
- U : Form_User_Wrapper_Access := Form_Userptr (Frm);
Res : constant Eti_Error := Free (Frm);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
- if U = null or else U.I = null then
- raise Form_Exception;
- end if;
- Free_Allocated_Fields (U.I);
- Free_Form_User_Wrapper (U);
Frm := Null_Form;
end Delete;
-- |
end if;
end Is_New_Page;
-------------------------------------------------------------------------------
- -- We use a GNAT internal hash table mechanism to create an association
- -- between an Ada_Defined_Field_Type and it's low level C_Field_Type
- -- peer.
- -- It shouldn´t be too complicated to reimplent this hashing mechanism
- -- for other compilers.
- --
- type Tag_Type_Pair;
- type Tag_Pair_Access is access all Tag_Type_Pair;
- pragma Controlled (Tag_Pair_Access);
-
- Null_Tag_Pair : constant Tag_Pair_Access := Tag_Pair_Access'(null);
-
- type Tag_Type_Pair is
- record
- Ada_Tag : Tag;
- Cft : C_Field_Type;
- Next : Tag_Pair_Access;
- end record;
-
- type Htable_Headers is range 1 .. 31;
- procedure Free_Tag_Type_Pair is
- new Ada.Unchecked_Deallocation (Tag_Type_Pair, Tag_Pair_Access);
-
- procedure Set_Pair_Link (T : Tag_Pair_Access; Next : Tag_Pair_Access);
- function Get_Pair_Link (T : Tag_Pair_Access) return Tag_Pair_Access;
- function Get_Pair_Tag (T : Tag_Pair_Access) return Tag;
-
- function Hash (T : Tag) return Htable_Headers;
- function Equal (A, B : Tag) return Boolean;
-
- package External_Pair_Htable is new GNAT.Htable.Static_Htable
- (Header_Num => Htable_Headers,
- Element => Tag_Type_Pair,
- Elmt_Ptr => Tag_Pair_Access,
- Null_Ptr => Null_Tag_Pair,
- Set_Next => Set_Pair_Link,
- Next => Get_Pair_Link,
- Key => Tag,
- Get_Key => Get_Pair_Tag,
- Hash => Hash,
- Equal => Equal);
-
- procedure Set_Pair_Link (T : Tag_Pair_Access; Next : Tag_Pair_Access)
- is
- begin
- T.all.Next := Next;
- end Set_Pair_Link;
-
- function Get_Pair_Link (T : Tag_Pair_Access) return Tag_Pair_Access
- is
- begin
- return T.all.Next;
- end Get_Pair_Link;
-
- function Get_Pair_Tag (T : Tag_Pair_Access) return Tag
- is
- begin
- return T.all.Ada_Tag;
- end Get_Pair_Tag;
-
- function Equal (A, B : Tag) return Boolean
- is
- begin
- return A = B;
- end Equal;
-
- function Hash (T : Tag) return Htable_Headers
+ procedure Free (FA : in out Field_Array_Access;
+ Free_Fields : in Boolean := False)
is
- function H is new GNAT.Htable.Hash (Htable_Headers);
+ procedure Release is new Ada.Unchecked_Deallocation
+ (Field_Array, Field_Array_Access);
begin
- return H (External_Tag (T));
- end Hash;
-
- function Search_Type (T : Ada_Defined_Field_Type'Class)
- return C_Field_Type
- is
- P : Tag_Pair_Access := External_Pair_Htable.Get (T'Tag);
- begin
- if P /= null then
- return P.Cft;
- else
- return Null_Field_Type;
- end if;
- end Search_Type;
-
- -- Register an Ada_Defined_Field_Type given by its Tag
- -- with it's associated C_Field_Type.
- procedure Register_Type (T : in Ada_Defined_Field_Type'Class;
- Cft : in C_Field_Type)
- is
- C : C_Field_Type := Search_Type (T);
- P : Tag_Pair_Access;
- begin
- if C /= Null_Field_Type then
- raise Form_Exception;
- else
- P := new Tag_Type_Pair'(T'Tag, Cft, null);
- External_Pair_Htable.Set (P);
+ if FA /= null and then Free_Fields then
+ for I in FA'First .. (FA'Last - 1) loop
+ if (FA (I) /= Null_Field) then
+ Delete (FA (I));
+ end if;
+ end loop;
end if;
- end Register_Type;
-
- -- Unregister an Ada_Defined_Field_Type given by it's tag
- procedure Unregister_Type (T : in Ada_Defined_Field_Type'Class)
- is
- function Free_Fieldtype (Ft : C_Field_Type) return C_Int;
- pragma Import (C, Free_Fieldtype, "free_fieldtype");
-
- P : Tag_Pair_Access := External_Pair_Htable.Get (T'Tag);
- Ft : C_Field_Type;
- Res : C_Int;
- begin
- if P = null then
- raise Form_Exception;
- else
- Ft := P.Cft;
- External_Pair_Htable.Remove (T'Tag);
- Free_Tag_Type_Pair (P);
- Res := Free_Fieldtype (Ft);
- if Res /= E_Ok then
- Eti_Exception (Res);
- end if;
- end if;
-&n