Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Base version of ncurses-5.7 library

  • Loading branch information...
commit e6a01f5727d104ee88c228bc866a505de770c1b2 0 parents
Amit Daniel Kachhap authored
Showing with 24,749 additions and 0 deletions.
  1. +473 −0 ANNOUNCE
  2. +38 −0 AUTHORS
  3. +67 −0 Ada95/Makefile.in
  4. +33 −0 Ada95/README
  5. +55 −0 Ada95/TODO
  6. +474 −0 Ada95/gen/Makefile.in
  7. +35 −0 Ada95/gen/adacurses-config.in
  8. +1,523 −0 Ada95/gen/gen.c
  9. +40 −0 Ada95/gen/html.m4
  10. +37 −0 Ada95/gen/normal.m4
  11. +35 −0 Ada95/gen/table.m4
  12. +105 −0 Ada95/gen/terminal_interface-curses-aux.ads.m4
  13. +238 −0 Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4
  14. +70 −0 Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4
  15. +70 −0 Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4
  16. +699 −0 Ada95/gen/terminal_interface-curses-forms.ads.m4
  17. +75 −0 Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4
  18. +70 −0 Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4
  19. +604 −0 Ada95/gen/terminal_interface-curses-menus.ads.m4
  20. +182 −0 Ada95/gen/terminal_interface-curses-mouse.ads.m4
  21. +70 −0 Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4
  22. +147 −0 Ada95/gen/terminal_interface-curses-panels.ads.m4
  23. +78 −0 Ada95/gen/terminal_interface-curses-trace.ads.m4
  24. +2,502 −0 Ada95/gen/terminal_interface-curses.adb.m4
  25. +1,559 −0 Ada95/gen/terminal_interface-curses.ads.m4
  26. +154 −0 Ada95/samples/Makefile.in
  27. +35 −0 Ada95/samples/README
  28. +186 −0 Ada95/samples/explain.txt
  29. +47 −0 Ada95/samples/ncurses.adb
  30. +716 −0 Ada95/samples/ncurses2-acs_and_scroll.adb
  31. +41 −0 Ada95/samples/ncurses2-acs_and_scroll.ads
  32. +235 −0 Ada95/samples/ncurses2-acs_display.adb
  33. +41 −0 Ada95/samples/ncurses2-acs_display.ads
  34. +362 −0 Ada95/samples/ncurses2-attr_test.adb
  35. +42 −0 Ada95/samples/ncurses2-attr_test.ads
  36. +259 −0 Ada95/samples/ncurses2-color_edit.adb
  37. +41 −0 Ada95/samples/ncurses2-color_edit.ads
  38. +163 −0 Ada95/samples/ncurses2-color_test.adb
  39. +41 −0 Ada95/samples/ncurses2-color_test.ads
  40. +497 −0 Ada95/samples/ncurses2-demo_forms.adb
  41. +41 −0 Ada95/samples/ncurses2-demo_forms.ads
  42. +675 −0 Ada95/samples/ncurses2-demo_pad.adb
  43. +41 −0 Ada95/samples/ncurses2-demo_pad.ads
  44. +382 −0 Ada95/samples/ncurses2-demo_panels.adb
  45. +41 −0 Ada95/samples/ncurses2-demo_panels.ads
  46. +135 −0 Ada95/samples/ncurses2-flushinp_test.adb
  47. +43 −0 Ada95/samples/ncurses2-flushinp_test.ads
  48. +117 −0 Ada95/samples/ncurses2-genericputs.adb
  49. +72 −0 Ada95/samples/ncurses2-genericputs.ads
  50. +41 −0 Ada95/samples/ncurses2-getch.ads
  51. +254 −0 Ada95/samples/ncurses2-getch_test.adb
  52. +41 −0 Ada95/samples/ncurses2-getch_test.ads
  53. +163 −0 Ada95/samples/ncurses2-getopt.adb
  54. +60 −0 Ada95/samples/ncurses2-getopt.ads
  55. +448 −0 Ada95/samples/ncurses2-m.adb
  56. +43 −0 Ada95/samples/ncurses2-m.ads
  57. +168 −0 Ada95/samples/ncurses2-menu_test.adb
  58. +41 −0 Ada95/samples/ncurses2-menu_test.ads
  59. +157 −0 Ada95/samples/ncurses2-overlap_test.adb
  60. +41 −0 Ada95/samples/ncurses2-overlap_test.ads
  61. +174 −0 Ada95/samples/ncurses2-slk_test.adb
  62. +41 −0 Ada95/samples/ncurses2-slk_test.ads
  63. +185 −0 Ada95/samples/ncurses2-test_sgr_attributes.adb
  64. +41 −0 Ada95/samples/ncurses2-test_sgr_attributes.ads
  65. +480 −0 Ada95/samples/ncurses2-trace_set.adb
  66. +41 −0 Ada95/samples/ncurses2-trace_set.ads
  67. +190 −0 Ada95/samples/ncurses2-util.adb
  68. +76 −0 Ada95/samples/ncurses2-util.ads
  69. +44 −0 Ada95/samples/ncurses2.ads
  70. +179 −0 Ada95/samples/rain.adb
  71. +43 −0 Ada95/samples/rain.ads
  72. +122 −0 Ada95/samples/sample-curses_demo-attributes.adb
  73. +45 −0 Ada95/samples/sample-curses_demo-attributes.ads
  74. +220 −0 Ada95/samples/sample-curses_demo-mouse.adb
  75. +45 −0 Ada95/samples/sample-curses_demo-mouse.ads
  76. +143 −0 Ada95/samples/sample-curses_demo.adb
  77. +45 −0 Ada95/samples/sample-curses_demo.ads
  78. +408 −0 Ada95/samples/sample-explanation.adb
  79. +59 −0 Ada95/samples/sample-explanation.ads
  80. +263 −0 Ada95/samples/sample-form_demo-aux.adb
  81. +92 −0 Ada95/samples/sample-form_demo-aux.ads
  82. +98 −0 Ada95/samples/sample-form_demo-handler.adb
  83. +64 −0 Ada95/samples/sample-form_demo-handler.ads
  84. +130 −0 Ada95/samples/sample-form_demo.adb
  85. +45 −0 Ada95/samples/sample-form_demo.ads
  86. +214 −0 Ada95/samples/sample-function_key_setting.adb
  87. +82 −0 Ada95/samples/sample-function_key_setting.ads
  88. +180 −0 Ada95/samples/sample-header_handler.adb
  89. +53 −0 Ada95/samples/sample-header_handler.ads
  90. +68 −0 Ada95/samples/sample-helpers.adb
  91. +54 −0 Ada95/samples/sample-helpers.ads
  92. +194 −0 Ada95/samples/sample-keyboard_handler.adb
  93. +55 −0 Ada95/samples/sample-keyboard_handler.ads
  94. +67 −0 Ada95/samples/sample-manifest.ads
  95. +204 −0 Ada95/samples/sample-menu_demo-aux.adb
  96. +71 −0 Ada95/samples/sample-menu_demo-aux.ads
  97. +108 −0 Ada95/samples/sample-menu_demo-handler.adb
  98. +64 −0 Ada95/samples/sample-menu_demo-handler.ads
  99. +396 −0 Ada95/samples/sample-menu_demo.adb
  100. +45 −0 Ada95/samples/sample-menu_demo.ads
  101. +68 −0 Ada95/samples/sample-my_field_type.adb
  102. +61 −0 Ada95/samples/sample-my_field_type.ads
  103. +181 −0 Ada95/samples/sample-text_io_demo.adb
  104. +45 −0 Ada95/samples/sample-text_io_demo.ads
  105. +220 −0 Ada95/samples/sample.adb
  106. +43 −0 Ada95/samples/sample.ads
  107. +57 −0 Ada95/samples/status.adb
  108. +60 −0 Ada95/samples/status.ads
  109. +46 −0 Ada95/samples/tour.adb
  110. +41 −0 Ada95/samples/tour.ads
  111. +388 −0 Ada95/src/Makefile.in
  112. +116 −0 Ada95/src/terminal_interface-curses-aux.adb
  113. +66 −0 Ada95/src/terminal_interface-curses-forms-field_types-alpha.adb
  114. +53 −0 Ada95/src/terminal_interface-curses-forms-field_types-alpha.ads
  115. +66 −0 Ada95/src/terminal_interface-curses-forms-field_types-alphanumeric.adb
  116. +54 −0 Ada95/src/terminal_interface-curses-forms-field_types-alphanumeric.ads
  117. +81 −0 Ada95/src/terminal_interface-curses-forms-field_types-enumeration-ada.adb
  118. +59 −0 Ada95/src/terminal_interface-curses-forms-field_types-enumeration-ada.ads
  119. +119 −0 Ada95/src/terminal_interface-curses-forms-field_types-enumeration.adb
  120. +98 −0 Ada95/src/terminal_interface-curses-forms-field_types-enumeration.ads
  121. +70 −0 Ada95/src/terminal_interface-curses-forms-field_types-intfield.adb
  122. +55 −0 Ada95/src/terminal_interface-curses-forms-field_types-intfield.ads
  123. +66 −0 Ada95/src/terminal_interface-curses-forms-field_types-ipv4_address.adb
  124. +51 −0 Ada95/src/terminal_interface-curses-forms-field_types-ipv4_address.ads
  125. +73 −0 Ada95/src/terminal_interface-curses-forms-field_types-numeric.adb
  126. +55 −0 Ada95/src/terminal_interface-curses-forms-field_types-numeric.ads
  127. +71 −0 Ada95/src/terminal_interface-curses-forms-field_types-regexp.adb
  128. +55 −0 Ada95/src/terminal_interface-curses-forms-field_types-regexp.ads
  129. +110 −0 Ada95/src/terminal_interface-curses-forms-field_types-user-choice.adb
  130. +94 −0 Ada95/src/terminal_interface-curses-forms-field_types-user-choice.ads
  131. +133 −0 Ada95/src/terminal_interface-curses-forms-field_types-user.adb
  132. +95 −0 Ada95/src/terminal_interface-curses-forms-field_types-user.ads
  133. +296 −0 Ada95/src/terminal_interface-curses-forms-field_types.adb
  134. +85 −0 Ada95/src/terminal_interface-curses-forms-field_user_data.adb
  135. +86 −0 Ada95/src/terminal_interface-curses-forms-form_user_data.adb
  136. +1,161 −0 Ada95/src/terminal_interface-curses-forms.adb
Sorry, we could not display the entire diff because too many files (1,028) changed.
473 ANNOUNCE
@@ -0,0 +1,473 @@
+ Announcing ncurses 5.7
+
+ The ncurses (new curses) library is a free software emulation of
+ curses in System V Release 4.0, and more. It uses terminfo format,
+ supports pads and color and multiple highlights and forms characters
+ and function-key mapping, and has all the other SYSV-curses
+ enhancements over BSD curses.
+
+ In mid-June 1995, the maintainer of 4.4BSD curses declared that he
+ considered 4.4BSD curses obsolete, and encouraged the keepers of Unix
+ releases such as BSD/OS, FreeBSD and NetBSD to switch over to ncurses.
+
+ The ncurses code was developed under GNU/Linux. It has been in use for
+ some time with OpenBSD as the system curses library, and on FreeBSD
+ and NetBSD as an external package. It should port easily to any
+ ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp!
+
+ The distribution includes the library and support utilities, including
+ a terminfo compiler tic(1), a decompiler infocmp(1), clear(1),
+ 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 the GNU
+ distribution site [1]ftp://ftp.gnu.org/gnu/ncurses/ .
+ It is also available at [2]ftp://invisible-island.net/ncurses/ .
+
+ Release Notes
+
+ This release is designed to be upward compatible from ncurses 5.0
+ through 5.6; very few applications will require recompilation,
+ depending on the platform. These are the highlights from the
+ change-log since ncurses 5.6 release.
+
+ Interface changes:
+ * generate linkable stubs for some macros:
+ getattrs
+
+ New features and improvements:
+ * library
+ + new flavor of the ncurses library provides rudimentary
+ support for POSIX threads. Several functions are reentrant,
+ but most require either a window-level or screen-level mutex.
+ (This is API-compatible, but not ABI-compatible with the
+ normal library).
+ + add NCURSES_OPAQUE symbol to curses.h, will use to make
+ structs opaque in selected configurations.
+ + add NCURSES_EXT_FUNCS and NCURSES_EXT_COLORS symbols to
+ curses.h to make it simpler to tell if the extended functions
+ and/or colors are declared.
+ + add wresize() to C++ binding
+ + eliminate fixed-buffer vsprintf() calls in C++ binding.
+ + add several functions to C++ binding which wrap C functions
+ that pass a WINDOW* parameter.
+ + adapt mouse-handling code from menu library in form-library
+ + improve tracing for form library, showing created forms,
+ fields, etc.
+ + make $NCURSES_NO_PADDING feature work for termcap interface .
+ + add check to trace-file open, if the given name is a
+ directory, add ".log" to the name and try again.
+ + several new manpages: curs_legacy.3x, curs_memleaks.3x,
+ curs_opaque.3x and curs_threads.3x
+ * programs:
+ + modified three test-programs to demonstrate the threading
+ support in this version: ditto, rain, worm.
+ + several new test-programs: demo_panels, dots_mvcur,
+ inch_wide, inchs, key_name, key_names, savescreen,
+ savescreen.sh test_arrays, test_get_wstr, test_getstr,
+ test_instr, test_inwstr and test_opaque.
+ + add adacurses-config to the Ada95 install.
+ + modify tic -f option to format spaces as \s to prevent them
+ from being lost when that is read back in unformatted
+ strings.
+ + The tack program is now distributed separately from ncurses.
+ * terminal database
+ + added entries:
+ o Eterm-256color, Eterm-88color and rxvt-88color
+ o aterm
+ o konsole-256color
+ o mrxvt
+ o screen.mlterm
+ o screen.rxvt
+ o teraterm4.59 is now the primary primary teraterm entry,
+ renamed original to teraterm2.3
+ o 9term terminal
+ o Newbury Data entries
+ + updated/improved entries:
+ o gnome to version 2.22.3
+ o h19, z100
+ o konsole to version 1.6.6
+ o mlterm, mlterm+pcfkeys
+ o xterm, and building-blocks for function-keys to [3]xterm
+ patch #230.
+
+ Major bug fixes:
+ * add logic to tic for cancelling strings in user-defined
+ capabilities (this is needed for current konsole terminfo entry).
+ * modify mk-1st.awk so the generated makefile rules for linking or
+ installing shared libraries do not first remove the library, in
+ case it is in use, e.g., libncurses.so by /bin/sh.
+ * correct check for notimeout() in wgetch().
+ * fix a sign-extension bug in infocmp's repair_acsc() function.
+ * change winnstr() to stop at the end of the line.
+ * make Ada95 demo_panels() example work.
+ * fix for adding a non-spacing character at the beginning of a line.
+ * fill in extended-color pair to make colors work for
+ wide-characters using extended-colors.
+ * improve refresh of window on top of multi-column characters,
+ taking into account split characters on left/right window
+ boundaries.
+ * modify win_wchnstr() to ensure that only a base cell is returned
+ for each multi-column character.
+ * improve waddch() and winsch() handling of EILSEQ from mbrtowc() by
+ using unctrl() to display illegal bytes rather than trying to
+ append further bytes to make up a valid sequence.
+ * restore curs_set() state after endwin()/refresh()
+ * modify keyname() to use "^X" form only if meta() has been called,
+ or if keyname() is called without initializing curses, e.g., via
+ initscr() or newterm().
+ * modify unctrl() to check codes in 128-255 range versus isprint().
+ If they are not printable, and locale was set, use a "M-" or "~"
+ sequence.
+ * improve resizeterm() by moving ripped-off lines, and repainting
+ the soft-keys.
+ * modify form library to accept control characters such as newline
+ in set_field_buffer(), which is compatible with Solaris.
+ * use NCURSES_MOUSE_MASK() in definition of BUTTON_RELEASE(), etc.,
+ to make those work properly with the --enable-ext-mouse
+ configuration
+ * correct some functions in Ada95 binding which were using return
+ value from C where none was returned.
+ * reviewed/fixed issues reported by Coverity and Klocwork tools.
+
+ Portability:
+ * configure script:
+ + new options:
+
+ --disable-big-strings
+ control whether static string tables are generated
+ as single large strings (to improve startup
+ performance), or as array of individual strings.
+
+ --disable-relink
+ control whether shared libraries are relinked
+ (during install) when rpath is enabled.
+
+ --disable-tic-depends
+ make explicit whether tic library depends on
+ ncurses/ncursesw library.
+
+ --enable-mixed-case
+ override the configure script's check if the
+ filesystem supports mixed-case filenames. This
+ allows one to control how the terminal database
+ maps to the filesystem. For filesystems that do not
+ support mixed-case, the library uses generate
+ 2-character (hexadecimal) codes for the lower-level
+ of the filesystem terminfo database
+
+ --enable-reentrant
+ builds a different flavor of the ncurses library
+ (ncursest) which improves reentrant use of the
+ library by reducing global and static variables
+ (see the "--with-pthread" option for the threaded
+ support).
+
+ --enable-weak-symbols
+ use weak-symbols for linking to the POSIX thread
+ library, and use the same soname for the ncurses
+ shared library as the normal library (caveat: the
+ ABI is for the threaded library, which makes global
+ data accessed via functions).
+
+ --with-pthread
+ build with the POSIX thread library (tested with
+ AIX, Linux, FreeBSD, OpenBSD, HPUX, IRIX64,
+ Solaris, Tru64).
+
+ --with-ticlib
+ build/install the tic-support functions in a
+ separate library
+
+ + improved options:
+
+ --enable-ext-colors
+ requires the wide-character configuration.
+
+ --with-chtype
+ ignore option value "unsigned" is always added to
+ the type in curses.h; do the same for
+ --with-mmask-t.
+
+ --with-dmalloc
+ build-fix for redefinition of strndup.
+
+ --with-hashed-db
+ accepts a parameter which is the install-prefix of
+ a given Berkeley Database.
+
+ --with-hashed-db
+ the $LIBS environment variable overrides the search
+ for the db library.
+
+ --without-hashed-db
+ assumed when "--disable-database" is used.
+
+ * other configure/build issues:
+ + build-fixes for LynxOS
+ + modify shared-library rules to allow FreeBSD 3.x to use
+ rpath.
+ + build-fix for FreeBSD "contemporary" TTY interface.
+ + build-fixes for AIX with libtool.
+ + build-fixes for Darwin and libtool.
+ + modify BeOS-specific ifdef's to build on Haiku.
+ + corrected gcc options for building shared libraries on
+ Solaris and IRIX64.
+ + change shared-library configuration for OpenBSD, make rpath
+ work.
+ + build-fixes for using libutf8, e.g., on OpenBSD 3.7
+ + add "-e" option in ncurses/Makefile.in when generating
+ source-files to force earlier exit if the build environment
+ fails unexpectedly.
+ + add support for shared libraries for QNX.
+ + change delimiter in MKlib_gen.sh from '%' to '@', to avoid
+ substitution by IBM xlc to '#' as part of its extensions to
+ digraphs.
+ * library:
+ + rewrite wrapper for wcrtomb(), making it work on Solaris.
+ This is used in the form library to determine the length of
+ the buffer needed by field_buffer.
+ + add/use configure script macro CF_SIG_ATOMIC_T, use the
+ corresponding type for data manipulated by signal handlers.
+ + set locale in misc/ncurses-config.in since it uses a range
+ + disable GPM mouse support when $TERM does not happen to
+ contain "linux", since Gpm_Open() no longer limits its
+ assertion to terminals that it might handle, e.g., within
+ "screen" in xterm.
+ + reset mouse file-descriptor when unloading GPM library.
+ * test programs:
+ + update test programs to build/work with various UNIX curses
+ for comparisons.
+
+ Features of Ncurses
+
+ 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 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.
+ * The utilities have options to allow you to filter terminfo entries
+ for use with less capable curses/terminfo versions such as the
+ HP/UX and AIX ports.
+
+ The ncurses package also has many useful extensions over SVr4:
+ * The API is 8-bit clean and base-level conformant with the X/OPEN
+ curses specification, XSI curses (that is, it implements all BASE
+ level features, and most EXTENDED features). It includes many
+ function calls not supported under SVr4 curses (but portability of
+ all calls is documented so you can use the SVr4 subset only).
+ * Unlike SVr3 curses, ncurses can write to the rightmost-bottommost
+ corner of the screen if your terminal has an insert-character
+ capability.
+ * Ada95 and C++ bindings.
+ * Support for mouse event reporting with X Window xterm and FreeBSD
+ and OS/2 console windows.
+ * 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 256-color terminals, such as modern xterm, when
+ configured using the --enable-ext-colors option.
+ * Support for 16-color terminals, such as aixterm and modern xterm.
+ * Better cursor-movement optimization. The package now features a
+ cursor-local-movement computation more efficient than either BSD's
+ or System V's.
+ * Super hardware scrolling support. The screen-update code
+ incorporates a novel, simple, and cheap algorithm that enables it
+ to make optimal use of hardware scrolling, line-insertion, and
+ line-deletion for screen-line movements. This algorithm is more
+ powerful than the 4.4BSD curses quickch() routine.
+ * Real support for terminals with the magic-cookie glitch. The
+ screen-update code will refrain from drawing a highlight if the
+ magic- cookie unattributed spaces required just before the
+ beginning and after the end would step on a non-space character.
+ It will automatically shift highlight boundaries when doing so
+ would make it possible to draw the highlight without changing the
+ visual appearance of the screen.
+ * It is possible to generate the library with a list of pre-loaded
+ fallback entries linked to it so that it can serve those terminal
+ types even when no terminfo tree or termcap file is accessible
+ (this may be useful for support of screen-oriented programs that
+ must run in single-user mode).
+ * The tic(1)/captoinfo utility provided with ncurses has the ability
+ to translate many termcaps from the XENIX, IBM and AT&T extension
+ sets.
+ * A BSD-like tset(1) utility is provided.
+ * The ncurses library and utilities will automatically read terminfo
+ entries from $HOME/.terminfo if it exists, and compile to that
+ directory if it exists and the user has no write access to the
+ system directory. This feature makes it easier for users to have
+ personal terminfo entries without giving up access to the system
+ terminfo directory.
+ * You may specify a path of directories to search for compiled
+ descriptions with the environment variable TERMINFO_DIRS (this
+ generalizes the feature provided by TERMINFO under stock System
+ V.)
+ * In terminfo source files, use capabilities may refer not just to
+ other entries in the same source file (as in System V) but also to
+ compiled entries in either the system terminfo directory or the
+ user's $HOME/.terminfo directory.
+ * A script (capconvert) is provided to help BSD users transition
+ from termcap to terminfo. It gathers the information in a TERMCAP
+ environment variable and/or a ~/.termcap local entries file and
+ converts it to an equivalent local terminfo tree under
+ $HOME/.terminfo.
+ * Automatic fallback to the /etc/termcap file can be compiled in
+ when it is not possible to build a terminfo tree. This feature is
+ neither fast nor cheap, you don't want to use it unless you have
+ to, but it's there.
+ * The table-of-entries utility toe makes it easy for users to see
+ exactly what terminal types are available on the system.
+ * The library meets the XSI requirement that every macro entry point
+ have a corresponding function which may be linked (and will be
+ prototype-checked) if the macro definition is disabled with
+ #undef.
+ * An HTML "Introduction to Programming with NCURSES" document
+ provides a narrative introduction to the curses programming
+ interface.
+
+ State of the Package
+
+ Numerous bugs present in earlier versions have been fixed; the library
+ is far more reliable than it used to be. Bounds checking in many
+ `dangerous' entry points has been improved. The code is now type-safe
+ according to gcc -Wall. The library has been checked for malloc leaks
+ and arena corruption by the Purify memory-allocation tester.
+
+ The ncurses code has been tested with a wide variety of applications
+ including (versions starting with those noted):
+
+ cdk
+ Curses Development Kit
+ [4]http://invisible-island.net/cdk/
+ [5]http://www.vexus.ca/products/CDK/
+
+ ded
+ directory-editor
+ [6]http://invisible-island.net/ded/
+
+ dialog
+ the underlying application used in Slackware's setup, and the
+ basis for similar applications on GNU/Linux.
+ [7]http://invisible-island.net/dialog/
+
+ lynx
+ the character-screen WWW browser
+ [8]http://lynx.isc.org/release/
+
+ Midnight Commander
+ file manager
+ [9]http://www.ibiblio.org/mc/
+
+ mutt
+ mail utility
+ [10]http://www.mutt.org/
+
+ ncftp
+ file-transfer utility
+ [11]http://www.ncftp.com/
+
+ nvi
+ New vi versions 1.50 are able to use ncurses versions 1.9.7 and
+ later.
+ [12]http://www.bostic.com/vi/
+
+ pinfo
+ Lynx-like info browser.
+ [13]https://alioth.debian.org/projects/pinfo/
+
+ tin
+ newsreader, supporting color, MIME [14]http://www.tin.org/
+
+ as well as some that use ncurses for the terminfo support alone:
+
+ minicom
+ terminal emulator
+ [15]http://alioth.debian.org/projects/minicom/
+
+ vile
+ vi-like-emacs
+ [16]http://invisible-island.net/vile/
+
+ The ncurses distribution includes a selection of test programs
+ (including a few games).
+
+Who's Who and What's What
+
+ Zeyd Ben-Halim started it from a previous package pcurses, written by
+ Pavel Curtis. Eric S. Raymond continued development. Jürgen Pfeifer
+ wrote most of the form and menu libraries. Ongoing work is being done
+ by [17]Thomas Dickey. Thomas Dickey acts as the maintainer for the
+ Free Software Foundation, which holds the copyright on ncurses.
+ Contact the current maintainers at [18]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 [19]ftp://invisible-island.net/ncurses/ .
+
+Future Plans
+
+ * 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.
+
+Other Related Resources
+
+ The distribution provides a newer version of the terminfo-format
+ terminal description file once maintained by [20]Eric Raymond . Unlike
+ the older version, the termcap and terminfo data are provided in the
+ same file, and provides several user-definable extensions beyond the
+ X/Open specification.
+
+ You can find lots of information on terminal-related topics not
+ covered in the terminfo file at [21]Richard Shuford's archive .
+
+References
+
+ 1. ftp://ftp.gnu.org/gnu/ncurses/
+ 2. ftp://invisible-island.net/ncurses/
+ 3. http://invisible-island.net/xterm/xterm.log.html#xterm_230
+ 4. http://invisible-island.net/cdk/
+ 5. http://www.vexus.ca/products/CDK/
+ 6. http://invisible-island.net/ded/
+ 7. http://invisible-island.net/dialog/
+ 8. http://lynx.isc.org/release/
+ 9. http://www.ibiblio.org/mc/
+ 10. http://www.mutt.org/
+ 11. http://www.ncftp.com/
+ 12. http://www.bostic.com/vi/
+ 13. https://alioth.debian.org/projects/pinfo/
+ 14. http://www.tin.org/
+ 15. http://alioth.debian.org/projects/minicom/
+ 16. http://invisible-island.net/vile/
+ 17. mailto:dickey@invisible-island.net
+ 18. mailto:bug-ncurses@gnu.org
+ 19. ftp://invisible-island.net/ncurses/
+ 20. http://www.catb.org/~esr/terminfo/
+ 21. http://www.cs.utk.edu/~shuford/terminal_index.html
38 AUTHORS
@@ -0,0 +1,38 @@
+-------------------------------------------------------------------------------
+-- Copyright (c) 2006 Free Software Foundation, Inc. --
+-- --
+-- Permission is hereby granted, free of charge, to any person obtaining a --
+-- copy of this software and associated documentation files (the --
+-- "Software"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell copies --
+-- of the Software, and to permit persons to whom the Software is furnished --
+-- to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN --
+-- NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE --
+-- USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+-------------------------------------------------------------------------------
+-- $Id: AUTHORS,v 1.2 2006/10/28 21:44:52 tom Exp $
+-------------------------------------------------------------------------------
+These are the principal authors/contributors of ncurses since 1.9.9e,
+in decreasing order of their contribution:
+
+TD Thomas E. Dickey
+JPF Juergen Pfeifer
+ESR Eric S Raymond
+AVL Alexander V Lukyanov
+PB Philippe Blain
+SV Sven Verdoolaege
67 Ada95/Makefile.in
@@ -0,0 +1,67 @@
+##############################################################################
+# Copyright (c) 1998 Free Software Foundation, Inc. #
+# #
+# Permission is hereby granted, free of charge, to any person obtaining a #
+# copy of this software and associated documentation files (the "Software"), #
+# to deal in the Software without restriction, including without limitation #
+# the rights to use, copy, modify, merge, publish, distribute, distribute #
+# with modifications, sublicense, and/or sell copies of the Software, and to #
+# permit persons to whom the Software is furnished to do so, subject to the #
+# following conditions: #
+# #
+# The above copyright notice and this permission notice shall be included in #
+# all copies or substantial portions of the Software. #
+# #
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
+# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
+# DEALINGS IN THE SOFTWARE. #
+# #
+# Except as contained in this notice, the name(s) of the above copyright #
+# holders shall not be used in advertising or otherwise to promote the sale, #
+# use or other dealings in this Software without prior written #
+# authorization. #
+##############################################################################
+#
+# Author: Juergen Pfeifer, 1996
+#
+# Version Control
+# $Revision: 1.15 $
+#
+SHELL = /bin/sh
+THIS = Makefile
+
+SUBDIRS = @ADA_SUBDIRS@
+
+CF_MFLAGS = @cf_cv_makeflags@
+@SET_MAKE@
+
+all \
+libs \
+sources \
+install \
+install.libs \
+uninstall \
+uninstall.libs ::
+ for d in $(SUBDIRS); do \
+ (cd $$d ; $(MAKE) $(CF_MFLAGS) $@) ;\
+ done
+
+clean \
+mostlyclean ::
+ for d in $(SUBDIRS); do \
+ (cd $$d ; $(MAKE) $(CF_MFLAGS) $@) ;\
+ done
+
+distclean \
+realclean ::
+ for d in $(SUBDIRS); do \
+ (cd $$d ; $(MAKE) $(CF_MFLAGS) $@) ;\
+ done
+ rm -f Makefile
+
+install.data :
+ @
33 Ada95/README
@@ -0,0 +1,33 @@
+-------------------------------------------------------------------------------
+-- Copyright (c) 1998 Free Software Foundation, Inc. --
+-- --
+-- Permission is hereby granted, free of charge, to any person obtaining a --
+-- copy of this software and associated documentation files (the --
+-- "Software"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell copies --
+-- of the Software, and to permit persons to whom the Software is furnished --
+-- to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN --
+-- NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE --
+-- USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+-------------------------------------------------------------------------------
+
+-- Author: Juergen Pfeifer, 1996
+
+The documentation is provided in HTML format in the ./html
+subdirectory. The main document is named index.html
+
55 Ada95/TODO
@@ -0,0 +1,55 @@
+-------------------------------------------------------------------------------
+-- Copyright (c) 1998-1999,2006 Free Software Foundation, Inc. --
+-- --
+-- Permission is hereby granted, free of charge, to any person obtaining a --
+-- copy of this software and associated documentation files (the --
+-- "Software"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell copies --
+-- of the Software, and to permit persons to whom the Software is furnished --
+-- to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN --
+-- NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE --
+-- USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+-------------------------------------------------------------------------------
+-- $Id: TODO,v 1.5 2006/04/22 22:23:21 tom Exp $
+-------------------------------------------------------------------------------
+
+-- Intensive testing
+ Perhaps the delivery of the Beta will help a bit.
+
+-- Documentation
+ Like most WEB pages: under continuous construction
+
+-- Style cleanup
+
+-- Alternate functions for procedures with out params
+ Comfort purpose
+
+-- Sample program
+ Under continuous construction (and it's not a WEB page!!!)
+
+-- Make the binding objects a shared library
+ They are rather large, so it would make sense, otherwise Ada95
+ would look too large, although the generated code is as compact
+ as C or C++. I'll wait a bit until the GNAT people provide some
+ better support to construct shared libraries.
+
+-- Think about more inlining
+
+-- Check for memory leaks.
+ Oh I would like it so much if the GNAT guys would put an optional
+ GC into their system.
474 Ada95/gen/Makefile.in
@@ -0,0 +1,474 @@
+##############################################################################
+# Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. #
+# #
+# Permission is hereby granted, free of charge, to any person obtaining a #
+# copy of this software and associated documentation files (the "Software"), #
+# to deal in the Software without restriction, including without limitation #
+# the rights to use, copy, modify, merge, publish, distribute, distribute #
+# with modifications, sublicense, and/or sell copies of the Software, and to #
+# permit persons to whom the Software is furnished to do so, subject to the #
+# following conditions: #
+# #
+# The above copyright notice and this permission notice shall be included in #
+# all copies or substantial portions of the Software. #
+# #
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
+# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
+# DEALINGS IN THE SOFTWARE. #
+# #
+# Except as contained in this notice, the name(s) of the above copyright #
+# holders shall not be used in advertising or otherwise to promote the sale, #
+# use or other dealings in this Software without prior written #
+# authorization. #
+##############################################################################
+#
+# Author: Juergen Pfeifer, 1996
+#
+# $Id: Makefile.in,v 1.61 2008/10/04 22:58:31 tom Exp $
+#
+.SUFFIXES:
+
+SHELL = /bin/sh
+THIS = Makefile
+
+x = @PROG_EXT@
+
+top_srcdir = @top_srcdir@
+DESTDIR = @DESTDIR@
+srcdir = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+
+ADA_INCLUDE = $(DESTDIR)@ADA_INCLUDE@
+ADA_OBJECTS = $(DESTDIR)@ADA_OBJECTS@
+
+INSTALL = @INSTALL@
+INSTALL_PROG = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+AWK = @AWK@
+LN_S = @LN_S@
+
+CC = @CC@
+HOST_CC = @BUILD_CC@
+CFLAGS = @CFLAGS@
+
+CPPFLAGS = @ACPPFLAGS@ \
+ -DHAVE_CONFIG_H -I$(srcdir)
+
+CCFLAGS = $(CPPFLAGS) $(CFLAGS)
+CFLAGS_NORMAL = $(CCFLAGS)
+CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE
+CFLAGS_PROFILE = $(CCFLAGS) -pg
+CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@
+
+CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@)
+
+REL_VERSION = @cf_cv_rel_version@
+ABI_VERSION = @cf_cv_abi_version@
+LOCAL_LIBDIR = @top_builddir@/lib
+
+LINK = $(HOST_CC)
+LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) @TINFO_ARGS2@
+
+RANLIB = @RANLIB@
+
+M4 = m4
+M4FLAGS = -DNCURSES_EXT_FUNCS=@NCURSES_EXT_FUNCS@
+
+ADACURSES_CONFIG = adacurses-config
+
+WRAPPER = sh $(top_srcdir)/misc/shlib
+GENERATE = ./gen$x '@DFT_ARG_SUFFIX@'
+DEL_ADAMODE = sed -e '/^\-\-\ \ \-\*\-\ ada\ \-\*\-.*/d'
+
+GNATHTML = `type -p gnathtml || type -p gnathtml.pl`
+GNATHP = www.gnat.com
+
+################################################################################
+ALIB = @cf_ada_package@
+ABASE = $(ALIB)-curses
+
+ADA_SRCDIR = ../src
+
+GEN_FILES0 = Base_Defs
+
+GEN_FILES1 = ACS_Map \
+ AC_Rep \
+ Base_Defs \
+ Character_Attribute_Set_Rep \
+ Color_Defs \
+ Key_Definitions \
+ Linker_Options \
+ Old_Keys \
+ Public_Variables \
+ Trace_Defs \
+ Version_Info \
+ Window_Offsets
+
+GEN_FILES2 = Menu_Opt_Rep \
+ Menu_Base_Defs \
+ Menu_Linker_Options \
+ Item_Rep
+
+GEN_FILES3 = Form_Opt_Rep \
+ Form_Base_Defs \
+ Form_Linker_Options \
+ Field_Rep
+
+GEN_FILES4 = Mouse_Base_Defs \
+ Mouse_Event_Rep \
+ Mouse_Events \
+ Panel_Linker_Options
+
+GEN_FILES5 = Chtype_Def \
+ Eti_Defs
+
+GEN_TARGETS = $(ADA_SRCDIR)/$(ABASE).ads \
+ $(ADA_SRCDIR)/$(ABASE).adb \
+ $(ADA_SRCDIR)/$(ABASE)-aux.ads \
+ $(ADA_SRCDIR)/$(ABASE)-trace.ads \
+ $(ADA_SRCDIR)/$(ABASE)-menus.ads \
+ $(ADA_SRCDIR)/$(ABASE)-forms.ads \
+ $(ADA_SRCDIR)/$(ABASE)-mouse.ads \
+ $(ADA_SRCDIR)/$(ABASE)-panels.ads \
+ $(ADA_SRCDIR)/$(ABASE)-menus-menu_user_data.ads \
+ $(ADA_SRCDIR)/$(ABASE)-menus-item_user_data.ads \
+ $(ADA_SRCDIR)/$(ABASE)-forms-form_user_data.ads \
+ $(ADA_SRCDIR)/$(ABASE)-forms-field_types.ads \
+ $(ADA_SRCDIR)/$(ABASE)-forms-field_user_data.ads \
+ $(ADA_SRCDIR)/$(ABASE)-panels-user_data.ads
+
+GEN_SRC = $(srcdir)/$(ABASE).ads.m4 \
+ $(srcdir)/$(ABASE).adb.m4 \
+ $(srcdir)/$(ABASE)-aux.ads.m4 \
+ $(srcdir)/$(ABASE)-trace.ads.m4 \
+ $(srcdir)/$(ABASE)-menus.ads.m4 \
+ $(srcdir)/$(ABASE)-forms.ads.m4 \
+ $(srcdir)/$(ABASE)-mouse.ads.m4 \
+ $(srcdir)/$(ABASE)-panels.ads.m4 \
+ $(srcdir)/$(ABASE)-menus-menu_user_data.ads.m4 \
+ $(srcdir)/$(ABASE)-menus-item_user_data.ads.m4 \
+ $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 \
+ $(srcdir)/$(ABASE)-forms-field_types.ads.m4 \
+ $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 \
+ $(srcdir)/$(ABASE)-panels-user_data.ads.m4
+
+
+all \
+libs : $(GEN_TARGETS)
+ @echo made $@
+
+sources:
+
+$(ADA_INCLUDE) \
+$(ADA_OBJECTS) :
+ sh $(top_srcdir)/mkdirs.sh $@
+
+install \
+install.libs :: $(ADA_INCLUDE)
+ @echo installing package $(ALIB) in $(ADA_INCLUDE)
+ @$(top_srcdir)/tar-copy.sh '$(ALIB)*.ad?' $(ADA_SRCDIR) $(ADA_INCLUDE)
+ @$(top_srcdir)/tar-copy.sh '$(ALIB)[-.]*.ad?' $(ADA_SRCDIR) $(ADA_INCLUDE)
+ @test $(srcdir) != ./ && $(top_srcdir)/tar-copy.sh '$(ALIB)*.ad?' $(srcdir)/../src $(ADA_INCLUDE)
+ @test $(srcdir) != ./ && $(top_srcdir)/tar-copy.sh '$(ALIB)[-.]*.ad?' $(srcdir)/../src $(ADA_INCLUDE)
+
+install \
+install.libs :: $(ADA_OBJECTS)
+ @echo installing package $(ALIB) in $(ADA_OBJECTS)
+ @-chmod a-wx $(ADA_SRCDIR)/*.ali
+ @$(top_srcdir)/tar-copy.sh '$(ALIB)*.ali' $(ADA_SRCDIR) $(ADA_OBJECTS)
+ @$(top_srcdir)/tar-copy.sh '$(ALIB)[-.]*.ali' $(ADA_SRCDIR) $(ADA_OBJECTS)
+ @-chmod u+x $(ADA_SRCDIR)/*.ali
+
+install \
+install.libs :: $(DESTDIR)$(bindir) adacurses-config
+ $(INSTALL_PROG) adacurses-config $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG)
+
+uninstall \
+uninstall.libs ::
+ @echo removing package $(ALIB) from $(ADA_INCLUDE)
+ -@cd $(ADA_INCLUDE) && rm -f $(ALIB)[-.]*
+
+uninstall \
+uninstall.libs ::
+ @echo removing package $(ALIB) from $(ADA_OBJECTS)
+ -@cd $(ADA_OBJECTS) && rm -f $(ALIB)[-.]*
+
+uninstall \
+uninstall.libs ::
+ -rm -f $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG)
+
+gen$x: gen.o
+ @ECHO_LINK@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@
+
+gen.o: $(srcdir)/gen.c
+ $(HOST_CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/gen.c
+################################################################################
+Character_Attribute_Set_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) B A" >$@
+
+Base_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) B B" >$@
+
+Color_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) B C" >$@
+
+Window_Offsets: gen$x
+ $(WRAPPER) "$(GENERATE) B D" >$@
+
+Key_Definitions: gen$x
+ $(WRAPPER) "$(GENERATE) B K" >$@
+
+Linker_Options: gen$x
+ $(WRAPPER) "$(GENERATE) B L" >$@
+
+ACS_Map: gen$x
+ $(WRAPPER) "$(GENERATE) B M" >$@
+
+Old_Keys: gen$x
+ $(WRAPPER) "$(GENERATE) B O" >$@
+
+Public_Variables: gen$x
+ $(WRAPPER) "$(GENERATE) B P" >$@
+
+AC_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) B R" >$@
+
+Version_Info: gen$x
+ $(WRAPPER) "$(GENERATE) B V" >$@
+
+Trace_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) B T" >$@
+################################################################################
+Menu_Opt_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) M R" >$@
+
+Menu_Base_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) M B" >$@
+
+Menu_Linker_Options: gen$x
+ $(WRAPPER) "$(GENERATE) M L" >$@
+
+Item_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) M I" >$@
+################################################################################
+Form_Opt_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) F R" >$@
+
+Form_Base_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) F B" >$@
+
+Form_Linker_Options: gen$x
+ $(WRAPPER) "$(GENERATE) F L" >$@
+
+Field_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) F I" >$@
+################################################################################
+Mouse_Base_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) P B" >$@
+
+Mouse_Event_Rep: gen$x
+ $(WRAPPER) "$(GENERATE) P M" >$@
+
+Mouse_Events: gen$x
+ $(WRAPPER) "$(GENERATE) B E" >$@
+
+Panel_Linker_Options: gen$x
+ $(WRAPPER) "$(GENERATE) P L" >$@
+
+Chtype_Def: gen$x
+ $(WRAPPER) "$(GENERATE) E C" >$@
+
+Eti_Defs: gen$x
+ $(WRAPPER) "$(GENERATE) E E" >$@
+################################################################################
+$(ADA_SRCDIR)/$(ABASE).ads: $(srcdir)/$(ABASE).ads.m4 \
+ $(GEN_FILES1) $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE).ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE).adb: $(srcdir)/$(ABASE).adb.m4 \
+ $(GEN_FILES1) $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE).adb.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-aux.ads: $(srcdir)/$(ABASE)-aux.ads.m4 \
+ $(GEN_FILES5) $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-aux.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-trace.ads: $(srcdir)/$(ABASE)-trace.ads.m4 \
+ $(GEN_FILES5) $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-trace.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-menus.ads: $(srcdir)/$(ABASE)-menus.ads.m4 \
+ $(GEN_FILES2) $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-menus.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-forms.ads: $(srcdir)/$(ABASE)-forms.ads.m4 \
+ $(GEN_FILES3) $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-forms.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-mouse.ads: $(srcdir)/$(ABASE)-mouse.ads.m4 \
+ $(GEN_FILES4) $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-mouse.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-panels.ads: $(srcdir)/$(ABASE)-panels.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-panels.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-menus-menu_user_data.ads: \
+ $(srcdir)/$(ABASE)-menus-menu_user_data.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-menus-menu_user_data.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-menus-item_user_data.ads: \
+ $(srcdir)/$(ABASE)-menus-item_user_data.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-menus-item_user_data.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-forms-form_user_data.ads: \
+ $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-forms-field_types.ads: \
+ $(srcdir)/$(ABASE)-forms-field_types.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-forms-field_types.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-forms-field_user_data.ads: \
+ $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+$(ADA_SRCDIR)/$(ABASE)-panels-user_data.ads: \
+ $(srcdir)/$(ABASE)-panels-user_data.ads.m4 \
+ $(srcdir)/normal.m4
+ $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \
+ $(srcdir)/$(ABASE)-panels-user_data.ads.m4 |\
+ $(DEL_ADAMODE) >$@
+
+install.progs ::
+
+tags:
+ ctags *.[ch]
+
+@MAKE_UPPER_TAGS@TAGS:
+@MAKE_UPPER_TAGS@ etags *.[ch]
+
+mostlyclean ::
+ -rm -f a.out core gen$x *.o
+ -rm -f $(GEN_FILES1)
+ -rm -f $(GEN_FILES2)
+ -rm -f $(GEN_FILES3)
+ -rm -f $(GEN_FILES4)
+ -rm -f $(GEN_FILES5)
+
+clean :: mostlyclean
+ -rm -f $(GEN_TARGETS) instab.tmp *.ad[bs] *.html *.ali *.tmp
+
+distclean :: clean
+ -rm -f adacurses-config
+ -rm -f Makefile
+
+realclean :: distclean
+
+HTML_DIR = ../../doc/html/ada
+
+instab.tmp : table.m4 $(GEN_SRC)
+ @rm -f $@
+ @for f in $(GEN_SRC) ; do \
+ $(M4) $(M4FLAGS) -DM4MACRO=table.m4 $$f | $(DEL_ADAMODE) >> $@ ;\
+ done;
+
+$(HTML_DIR)/table.html : instab.tmp
+ @-touch $@
+ @-chmod +w $@
+ @echo '<!DOCTYPE HTML' > $@
+ @echo 'PUBLIC "-//IETF//DTD HTML 3.0//EN">' >> $@
+ @echo '<HTML>' >> $@
+ @echo '<HEAD>' >> $@
+ @echo '<TITLE>Correspondence between ncurses C and Ada functions</TITLE>' >>$@
+ @echo '</HEAD>' >> $@
+ @echo '<BODY>' >> $@
+ @echo '<H1>Correspondence between ncurses C and Ada functions</H1>' >>$@
+ @echo '<H2>Sorted by C function name</H2>' >>$@
+ @echo '<TABLE ALIGN=CENTER BORDER>' >>$@
+ @echo '<TR ALIGN=LEFT>' >>$@
+ @echo '<TH>C name</TH><TH>Ada name</TH><TH>man page</TH></TR>' >>$@
+ @sort < instab.tmp >> $@
+ @echo '</TABLE></BODY></HTML>' >>$@
+ @rm -f instab.tmp
+
+adahtml:
+ @find $(HTML_DIR) -type f -exec rm -f {} \;
+ @mkdir -p $(HTML_DIR)
+ cp -p ../src/*.ad[sb] . && chmod +w *.ad[sb]
+ ln -sf ../src/*.ali .
+ @echo "Filtering generated files"
+ @for f in $(GEN_SRC); do \
+ h=`basename $$f` ;\
+ g=`basename $$f .ads.m4` ;\
+ if test "$$g" != "$$h" ; then \
+ $(M4) $(M4FLAGS) -DM4MACRO=html.m4 $$f | $(DEL_ADAMODE) > $$g.ads ;\
+ echo "... $$g.ads" ;\
+ fi \
+ done
+ @-rm -f $(HTML_DIR)/$(ALIB)*.htm*
+ $(GNATHTML) -d -f $(ALIB)*.ads
+ for f in html/$(ALIB)*.htm*; do \
+ a=`basename $$f` ; \
+ sed -e 's/You may also.*body.*//' <$$f |\
+ sed -e 's%GNAT%<A HREF="http://$(GNATHP)">GNAT</A>%g' |\
+ sed -e 's%&lt;A HREF%<A HREF%g' |\
+ sed -e 's%"&gt;%">%g' |\
+ sed -e 's/3X/3x/g' |\
+ sed -e 's/$$\([ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxz0123456789_]*:.*\)\$$/@\1@/' |\
+ sed -e 's%&lt;/A&gt;%</A>%g' > $$a.tmp ;\
+ mv $$a.tmp $$f ;\
+ done
+ @rm -f *.ad[sb] *.ali *.tmp
+ @for f in funcs.htm main.htm ; do \
+ sed -e "\%<A HREF=funcs/ .htm>\[ \]</A>%d" < html/$$f > $$f ;\
+ mv $$f html/$$f ;\
+ done
+ @rm -f "html/funcs/ .htm"
+ @cp -pdrf html/* $(HTML_DIR)/
+ @rm -rf html
+
+html : adahtml $(HTML_DIR)/table.html
+ @echo made $@
+
+###############################################################################
+# The remainder of this file is automatically generated during configuration
+###############################################################################
35 Ada95/gen/adacurses-config.in
@@ -0,0 +1,35 @@
+#! /bin/sh
+# $Id: adacurses-config.in,v 1.2 2007/04/07 21:06:50 tom Exp $
+#
+# This script will return the option to add to `gnatmake' for using
+# AdaCurses.
+#
+
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+
+VERSION="@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@"
+
+CFLAGS="-I$libdir/adacurses -L$libdir/adacurses"
+LIBS="-L$prefix/lib -lAdaCurses"
+
+case "x$1" in
+ x--version)
+ echo AdaCurses $VERSION
+ ;;
+ x--cflags)
+ echo $CFLAGS
+ ;;
+ x--libs)
+ echo $LIBS
+ ;;
+ x)
+ # if no parameter is given, give what gnatmake needs
+ echo $CFLAGS -largs $LIBS
+ ;;
+ *)
+ echo 'Usage: adacurses-config [--version | --cflags | --libs]' >&2
+ exit 1
+ ;;
+esac
1,523 Ada95/gen/gen.c
@@ -0,0 +1,1523 @@
+/****************************************************************************
+ * Copyright (c) 1998,2007,2008 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Juergen Pfeifer, 1996 *
+ ****************************************************************************/
+
+/*
+ Version Control
+ $Id: gen.c,v 1.49 2008/10/04 21:59:37 tom Exp $
+ --------------------------------------------------------------------------*/
+/*
+ This program generates various record structures and constants from the
+ ncurses header file for the Ada95 packages. Essentially it produces
+ Ada95 source on stdout, which is then merged using m4 into a template
+ to produce the real source.
+ */
+
+#include <ncurses_cfg.h>
+
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include <menu.h>
+#include <form.h>
+
+#define RES_NAME "Reserved"
+
+static const char *model = "";
+static int little_endian = 0;
+
+typedef struct
+ {
+ const char *name;
+ unsigned long attr;
+ }
+name_attribute_pair;
+
+static int
+find_pos(char *s, unsigned len, int *low, int *high)
+{
+ unsigned int i, j;
+ int l = 0;
+
+ *high = -1;
+ *low = 8 * len;
+
+ for (i = 0; i < len; i++, s++)
+ {
+ if (*s)
+ {
+ for (j = 0; j < 8 * sizeof(char); j++)
+
+ {
+ if (((little_endian && ((*s) & 0x01)) ||
+ (!little_endian && ((*s) & 0x80))))
+ {
+ if (l > *high)
+ *high = l;
+ if (l < *low)
+ *low = l;
+ }
+ l++;
+ if (little_endian)
+ *s >>= 1;
+ else
+ *s <<= 1;
+ }
+ }
+ else
+ l += 8;
+ }
+ return (*high >= 0 && (*low <= *high)) ? *low : -1;
+}
+
+/*
+ * This helper routine generates a representation clause for a
+ * record type defined in the binding.
+ * We are only dealing with record types which are of 32 or 16
+ * bit size, i.e. they fit into an (u)int or a (u)short.
+ */
+static void
+ gen_reps
+ (const name_attribute_pair * nap, /* array of name_attribute_pair records */
+ const char *name, /* name of the represented record type */
+ int len, /* size of the record in bytes */
+ int bias)
+{
+ int i, n, l, cnt = 0, low, high;
+ int width = strlen(RES_NAME) + 3;
+ unsigned long a;
+ unsigned long mask = 0;
+
+ assert(nap != NULL);
+
+ for (i = 0; nap[i].name != (char *)0; i++)
+ {
+ cnt++;
+ l = strlen(nap[i].name);
+ if (l > width)
+ width = l;
+ }
+ assert(width > 0);
+
+ printf(" type %s is\n", name);
+ printf(" record\n");
+ for (i = 0; nap[i].name != (char *)0; i++)
+ {
+ printf(" %-*s : Boolean;\n", width, nap[i].name);
+ }
+ printf(" end record;\n");
+ printf(" pragma Convention (C, %s);\n\n", name);
+
+ printf(" for %s use\n", name);
+ printf(" record\n");
+
+ for (i = 0; nap[i].name != (char *)0; i++)
+ {
+ a = nap[i].attr;
+ mask |= a;
+ l = find_pos((char *)&a, sizeof(a), &low, &high);
+ if (l >= 0)
+ printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name,
+ low - bias, high - bias);
+ }
+ i = 1;
+ n = cnt;
+ printf(" end record;\n");
+ printf(" for %s'Size use %d;\n", name, 8 * len);
+ printf(" -- Please note: this rep. clause is generated and may be\n");
+ printf(" -- different on your system.");
+}
+
+static void
+chtype_rep(const char *name, attr_t mask)
+{
+ attr_t x = -1;
+ attr_t t = x & mask;
+ int low, high;
+ int l = find_pos((char *)&t, sizeof(t), &low, &high);
+
+ if (l >= 0)
+ printf(" %-5s at 0 range %2d .. %2d;\n", name, low, high);
+}
+
+static void
+gen_chtype_rep(const char *name)
+{
+ printf(" for %s use\n record\n", name);
+ chtype_rep("Ch", A_CHARTEXT);
+ chtype_rep("Color", A_COLOR);
+ chtype_rep("Attr", (A_ATTRIBUTES & ~A_COLOR));
+ printf(" end record;\n for %s'Size use %ld;\n",
+ name, (long)(8 * sizeof(chtype)));
+
+ printf(" -- Please note: this rep. clause is generated and may be\n");
+ printf(" -- different on your system.\n");
+}
+
+static void
+mrep_rep(const char *name, void *rec)
+{
+ int low, high;
+ int l = find_pos((char *)rec, sizeof(MEVENT), &low, &high);
+
+ if (l >= 0)
+ printf(" %-7s at 0 range %3d .. %3d;\n", name, low, high);
+}
+
+static void
+gen_mrep_rep(const char *name)
+{
+ MEVENT x;
+
+ printf(" for %s use\n record\n", name);
+
+ memset(&x, 0, sizeof(x));
+ x.id = -1;
+ mrep_rep("Id", &x);
+
+ memset(&x, 0, sizeof(x));
+ x.x = -1;
+ mrep_rep("X", &x);
+
+ memset(&x, 0, sizeof(x));
+ x.y = -1;
+ mrep_rep("Y", &x);
+
+ memset(&x, 0, sizeof(x));
+ x.z = -1;
+ mrep_rep("Z", &x);
+
+ memset(&x, 0, sizeof(x));
+ x.bstate = -1;
+ mrep_rep("Bstate", &x);
+
+ printf(" end record;\n");
+ printf(" -- Please note: this rep. clause is generated and may be\n");
+ printf(" -- different on your system.\n");
+}
+
+static void
+gen_attr_set(const char *name)
+{
+ /* All of the A_xxx symbols are defined in ncurses, but not all are nonzero
+ * if "configure --enable-widec" is specified.
+ */
+ static const name_attribute_pair nap[] =
+ {
+#if A_STANDOUT
+ {"Stand_Out", A_STANDOUT},
+#endif
+#if A_UNDERLINE
+ {"Under_Line", A_UNDERLINE},
+#endif
+#if A_REVERSE
+ {"Reverse_Video", A_REVERSE},
+#endif
+#if A_BLINK
+ {"Blink", A_BLINK},
+#endif
+#if A_DIM
+ {"Dim_Character", A_DIM},
+#endif
+#if A_BOLD
+ {"Bold_Character", A_BOLD},
+#endif
+#if A_ALTCHARSET
+ {"Alternate_Character_Set", A_ALTCHARSET},
+#endif
+#if A_INVIS
+ {"Invisible_Character", A_INVIS},
+#endif
+#if A_PROTECT
+ {"Protected_Character", A_PROTECT},
+#endif
+#if A_HORIZONTAL
+ {"Horizontal", A_HORIZONTAL},
+#endif
+#if A_LEFT
+ {"Left", A_LEFT},
+#endif
+#if A_LOW
+ {"Low", A_LOW},
+#endif
+#if A_RIGHT
+ {"Right", A_RIGHT},
+#endif
+#if A_TOP
+ {"Top", A_TOP},
+#endif
+#if A_VERTICAL
+ {"Vertical", A_VERTICAL},
+#endif
+ {(char *)0, 0}
+ };
+ chtype attr = A_ATTRIBUTES & ~A_COLOR;
+ int start = -1;
+ int len = 0;
+ int i, set;
+ for (i = 0; i < (int)(8 * sizeof(chtype)); i++)
+
+ {
+ set = attr & 1;
+ if (set)
+ {
+ if (start < 0)
+ start = i;
+ if (start >= 0)
+ {
+ len++;
+ }
+ }
+ attr = attr >> 1;
+ }
+ gen_reps(nap, name, (len + 7) / 8, little_endian ? start : 0);
+}
+
+static void
+gen_trace(const char *name)
+{
+ static const name_attribute_pair nap[] =
+ {
+ {"Times", TRACE_TIMES},
+ {"Tputs", TRACE_TPUTS},
+ {"Update", TRACE_UPDATE},
+ {"Cursor_Move", TRACE_MOVE},
+ {"Character_Output", TRACE_CHARPUT},
+ {"Calls", TRACE_CALLS},
+ {"Virtual_Puts", TRACE_VIRTPUT},
+ {"Input_Events", TRACE_IEVENT},
+ {"TTY_State", TRACE_BITS},
+ {"Internal_Calls", TRACE_ICALLS},
+ {"Character_Calls", TRACE_CCALLS},
+ {"Termcap_TermInfo", TRACE_DATABASE},
+ {(char *)0, 0}
+ };
+ gen_reps(nap, name, sizeof(int), 0);
+}
+
+static void
+gen_menu_opt_rep(const char *name)
+{
+ static const name_attribute_pair nap[] =
+ {
+#ifdef O_ONEVALUE
+ {"One_Valued", O_ONEVALUE},
+#endif
+#ifdef O_SHOWDESC
+ {"Show_Descriptions", O_SHOWDESC},
+#endif
+#ifdef O_ROWMAJOR
+ {"Row_Major_Order", O_ROWMAJOR},
+#endif
+#ifdef O_IGNORECASE
+ {"Ignore_Case", O_IGNORECASE},
+#endif
+#ifdef O_SHOWMATCH
+ {"Show_Matches", O_SHOWMATCH},
+#endif
+#ifdef O_NONCYCLIC
+ {"Non_Cyclic", O_NONCYCLIC},
+#endif
+ {(char *)0, 0}
+ };
+ gen_reps(nap, name, sizeof(int), 0);
+}
+
+static void
+gen_item_opt_rep(const char *name)
+{
+ static const name_attribute_pair nap[] =
+ {
+#ifdef O_SELECTABLE
+ {"Selectable", O_SELECTABLE},
+#endif
+ {(char *)0, 0}
+ };
+ gen_reps(nap, name, sizeof(int), 0);
+}
+
+static void
+gen_form_opt_rep(const char *name)
+{
+ static const name_attribute_pair nap[] =
+ {
+#ifdef O_NL_OVERLOAD
+ {"NL_Overload", O_NL_OVERLOAD},
+#endif
+#ifdef O_BS_OVERLOAD
+ {"BS_Overload", O_BS_OVERLOAD},
+#endif
+ {(char *)0, 0}
+ };
+ gen_reps(nap, name, sizeof(int), 0);
+}
+
+/*
+ * Generate the representation clause for the Field_Option_Set record
+ */
+static void
+gen_field_opt_rep(const char *name)
+{
+ static const name_attribute_pair nap[] =
+ {
+#ifdef O_VISIBLE
+ {"Visible", O_VISIBLE},
+#endif
+#ifdef O_ACTIVE
+ {"Active", O_ACTIVE},
+#endif
+#ifdef O_PUBLIC
+ {"Public", O_PUBLIC},
+#endif
+#ifdef O_EDIT
+ {"Edit", O_EDIT},
+#endif
+#ifdef O_WRAP
+ {"Wrap", O_WRAP},
+#endif
+#ifdef O_BLANK
+ {"Blank", O_BLANK},
+#endif
+#ifdef O_AUTOSKIP
+ {"Auto_Skip", O_AUTOSKIP},
+#endif
+#ifdef O_NULLOK
+ {"Null_Ok", O_NULLOK},
+#endif
+#ifdef O_PASSOK
+ {"Pass_Ok", O_PASSOK},
+#endif
+#ifdef O_STATIC
+ {"Static", O_STATIC},
+#endif
+ {(char *)0, 0}
+ };
+ gen_reps(nap, name, sizeof(int), 0);
+}
+
+/*
+ * Generate a single key code constant definition.
+ */
+static void
+keydef(const char *name, const char *old_name, int value, int mode)
+{
+ if (mode == 0) /* Generate the new name */
+ printf(" %-30s : constant Special_Key_Code := 8#%3o#;\n", name, value);
+ else
+ { /* generate the old name, but only if it doesn't conflict with the old
+ * name (Ada95 isn't case sensitive!)
+ */
+ const char *s = old_name;
+ const char *t = name;
+
+ while (*s && *t && (toupper(*s++) == toupper(*t++)));
+ if (*s || *t)
+ printf(" %-16s : Special_Key_Code renames %s;\n", old_name, name);
+ }
+}
+
+/*
+ * Generate constants for the key codes. When called with mode==0, a
+ * complete list with nice constant names in proper casing style will
+ * be generated. Otherwise a list of old (i.e. C-style) names will be
+ * generated, given that the name wasn't already defined in the "nice"
+ * list.
+ */
+static void
+gen_keydefs(int mode)
+{
+ char buf[16];
+ char obuf[16];
+ int i;
+
+#ifdef KEY_CODE_YES
+ keydef("Key_Code_Yes", "KEY_CODE_YES", KEY_CODE_YES, mode);
+#endif
+#ifdef KEY_MIN
+ keydef("Key_Min", "KEY_MIN", KEY_MIN, mode);
+#endif
+#ifdef KEY_BREAK
+ keydef("Key_Break", "KEY_BREAK", KEY_BREAK, mode);
+#endif
+#ifdef KEY_DOWN
+ keydef("Key_Cursor_Down", "KEY_DOWN", KEY_DOWN, mode);
+#endif
+#ifdef KEY_UP
+ keydef("Key_Cursor_Up", "KEY_UP", KEY_UP, mode);
+#endif
+#ifdef KEY_LEFT
+ keydef("Key_Cursor_Left", "KEY_LEFT", KEY_LEFT, mode);
+#endif
+#ifdef KEY_RIGHT
+ keydef("Key_Cursor_Right", "KEY_RIGHT", KEY_RIGHT, mode);
+#endif
+#ifdef KEY_HOME
+ keydef("Key_Home", "KEY_HOME", KEY_HOME, mode);
+#endif
+#ifdef KEY_BACKSPACE
+ keydef("Key_Backspace", "KEY_BACKSPACE", KEY_BACKSPACE, mode);
+#endif
+#ifdef KEY_F0
+ keydef("Key_F0", "KEY_F0", KEY_F0, mode);
+#endif
+#ifdef KEY_F
+ for (i = 1; i <= 24; i++)
+ {
+ sprintf(buf, "Key_F%d", i);
+ sprintf(obuf, "KEY_F%d", i);
+ keydef(buf, obuf, KEY_F(i), mode);
+ }
+#endif
+#ifdef KEY_DL
+ keydef("Key_Delete_Line", "KEY_DL", KEY_DL, mode);
+#endif
+#ifdef KEY_IL
+ keydef("Key_Insert_Line", "KEY_IL", KEY_IL, mode);
+#endif
+#ifdef KEY_DC
+ keydef("Key_Delete_Char", "KEY_DC", KEY_DC, mode);
+#endif
+#ifdef KEY_IC
+ keydef("Key_Insert_Char", "KEY_IC", KEY_IC, mode);
+#endif
+#ifdef KEY_EIC
+ keydef("Key_Exit_Insert_Mode", "KEY_EIC", KEY_EIC, mode);
+#endif
+#ifdef KEY_CLEAR
+ keydef("Key_Clear_Screen", "KEY_CLEAR", KEY_CLEAR, mode);
+#endif
+#ifdef KEY_EOS
+ keydef("Key_Clear_End_Of_Screen", "KEY_EOS", KEY_EOS, mode);
+#endif
+#ifdef KEY_EOL
+ keydef("Key_Clear_End_Of_Line", "KEY_EOL", KEY_EOL, mode);
+#endif
+#ifdef KEY_SF
+ keydef("Key_Scroll_1_Forward", "KEY_SF", KEY_SF, mode);
+#endif
+#ifdef KEY_SR
+ keydef("Key_Scroll_1_Backward", "KEY_SR", KEY_SR, mode);
+#endif
+#ifdef KEY_NPAGE
+ keydef("Key_Next_Page", "KEY_NPAGE", KEY_NPAGE, mode);
+#endif
+#ifdef KEY_PPAGE
+ keydef("Key_Previous_Page", "KEY_PPAGE", KEY_PPAGE, mode);
+#endif
+#ifdef KEY_STAB
+ keydef("Key_Set_Tab", "KEY_STAB", KEY_STAB, mode);
+#endif
+#ifdef KEY_CTAB
+ keydef("Key_Clear_Tab", "KEY_CTAB", KEY_CTAB, mode);
+#endif
+#ifdef KEY_CATAB
+ keydef("Key_Clear_All_Tabs", "KEY_CATAB", KEY_CATAB, mode);
+#endif
+#ifdef KEY_ENTER
+ keydef("Key_Enter_Or_Send", "KEY_ENTER", KEY_ENTER, mode);
+#endif
+#ifdef KEY_SRESET
+ keydef("Key_Soft_Reset", "KEY_SRESET", KEY_SRESET, mode);
+#endif
+#ifdef KEY_RESET
+ keydef("Key_Reset", "KEY_RESET", KEY_RESET, mode);
+#endif
+#ifdef KEY_PRINT
+ keydef("Key_Print", "KEY_PRINT", KEY_PRINT, mode);
+#endif
+#ifdef KEY_LL
+ keydef("Key_Bottom", "KEY_LL", KEY_LL, mode);
+#endif
+#ifdef KEY_A1
+ keydef("Key_Upper_Left_Of_Keypad", "KEY_A1", KEY_A1, mode);
+#endif
+#ifdef KEY_A3
+ keydef("Key_Upper_Right_Of_Keypad", "KEY_A3", KEY_A3, mode);
+#endif
+#ifdef KEY_B2
+ keydef("Key_Center_Of_Keypad", "KEY_B2", KEY_B2, mode);
+#endif
+#ifdef KEY_C1
+ keydef("Key_Lower_Left_Of_Keypad", "KEY_C1", KEY_C1, mode);
+#endif
+#ifdef KEY_C3
+ keydef("Key_Lower_Right_Of_Keypad", "KEY_C3", KEY_C3, mode);
+#endif
+#ifdef KEY_BTAB
+ keydef("Key_Back_Tab", "KEY_BTAB", KEY_BTAB, mode);
+#endif
+#ifdef KEY_BEG
+ keydef("Key_Beginning", "KEY_BEG", KEY_BEG, mode);
+#endif
+#ifdef KEY_CANCEL
+ keydef("Key_Cancel", "KEY_CANCEL", KEY_CANCEL, mode);
+#endif
+#ifdef KEY_CLOSE
+ keydef("Key_Close", "KEY_CLOSE", KEY_CLOSE, mode);
+#endif
+#ifdef KEY_COMMAND
+ keydef("Key_Command", "KEY_COMMAND", KEY_COMMAND, mode);
+#endif
+#ifdef KEY_COPY
+ keydef("Key_Copy", "KEY_COPY", KEY_COPY, mode);
+#endif
+#ifdef KEY_CREATE
+ keydef("Key_Create", "KEY_CREATE", KEY_CREATE, mode);
+#endif
+#ifdef KEY_END
+ keydef("Key_End", "KEY_END", KEY_END, mode);
+#endif
+#ifdef KEY_EXIT
+ keydef("Key_Exit", "KEY_EXIT", KEY_EXIT, mode);
+#endif
+#ifdef KEY_FIND
+ keydef("Key_Find", "KEY_FIND", KEY_FIND, mode);
+#endif
+#ifdef KEY_HELP
+ keydef("Key_Help", "KEY_HELP", KEY_HELP, mode);
+#endif
+#ifdef KEY_MARK
+ keydef("Key_Mark", "KEY_MARK", KEY_MARK, mode);
+#endif
+#ifdef KEY_MESSAGE
+ keydef("Key_Message", "KEY_MESSAGE", KEY_MESSAGE, mode);
+#endif
+#ifdef KEY_MOVE
+ keydef("Key_Move", "KEY_MOVE", KEY_MOVE, mode);
+#endif
+#ifdef KEY_NEXT
+ keydef("Key_Next", "KEY_NEXT", KEY_NEXT, mode);
+#endif
+#ifdef KEY_OPEN
+ keydef("Key_Open", "KEY_OPEN", KEY_OPEN, mode);
+#endif
+#ifdef KEY_OPTIONS
+ keydef("Key_Options", "KEY_OPTIONS", KEY_OPTIONS, mode);
+#endif
+#ifdef KEY_PREVIOUS
+ keydef("Key_Previous", "KEY_PREVIOUS", KEY_PREVIOUS, mode);
+#endif
+#ifdef KEY_REDO
+ keydef("Key_Redo", "KEY_REDO", KEY_REDO, mode);
+#endif
+#ifdef KEY_REFERENCE
+ keydef("Key_Reference", "KEY_REFERENCE", KEY_REFERENCE, mode);
+#endif
+#ifdef KEY_REFRESH
+ keydef("Key_Refresh", "KEY_REFRESH", KEY_REFRESH, mode);
+#endif
+#ifdef KEY_REPLACE
+ keydef("Key_Replace", "KEY_REPLACE", KEY_REPLACE, mode);
+#endif
+#ifdef KEY_RESTART
+ keydef("Key_Restart", "KEY_RESTART", KEY_RESTART, mode);
+#endif
+#ifdef KEY_RESUME
+ keydef("Key_Resume", "KEY_RESUME", KEY_RESUME, mode);
+#endif
+#ifdef KEY_SAVE
+ keydef("Key_Save", "KEY_SAVE", KEY_SAVE, mode);
+#endif
+#ifdef KEY_SBEG
+ keydef("Key_Shift_Begin", "KEY_SBEG", KEY_SBEG, mode);
+#endif
+#ifdef KEY_SCANCEL
+ keydef("Key_Shift_Cancel", "KEY_SCANCEL", KEY_SCANCEL, mode);
+#endif
+#ifdef KEY_SCOMMAND
+ keydef("Key_Shift_Command", "KEY_SCOMMAND", KEY_SCOMMAND, mode);
+#endif
+#ifdef KEY_SCOPY
+ keydef("Key_Shift_Copy", "KEY_SCOPY", KEY_SCOPY, mode);
+#endif
+#ifdef KEY_SCREATE
+ keydef("Key_Shift_Create", "KEY_SCREATE", KEY_SCREATE, mode);
+#endif
+#ifdef KEY_SDC
+ keydef("Key_Shift_Delete_Char", "KEY_SDC", KEY_SDC, mode);
+#endif
+#ifdef KEY_SDL
+ keydef("Key_Shift_Delete_Line", "KEY_SDL", KEY_SDL, mode);
+#endif
+#ifdef KEY_SELECT
+ keydef("Key_Select", "KEY_SELECT", KEY_SELECT, mode);
+#endif
+#ifdef KEY_SEND
+ keydef("Key_Shift_End", "KEY_SEND", KEY_SEND, mode);
+#endif
+#ifdef KEY_SEOL
+ keydef("Key_Shift_Clear_End_Of_Line", "KEY_SEOL", KEY_SEOL, mode);
+#endif
+#ifdef KEY_SEXIT
+ keydef("Key_Shift_Exit", "KEY_SEXIT", KEY_SEXIT, mode);
+#endif
+#ifdef KEY_SFIND
+ keydef("Key_Shift_Find", "KEY_SFIND", KEY_SFIND, mode);
+#endif
+#ifdef KEY_SHELP
+ keydef("Key_Shift_Help", "KEY_SHELP", KEY_SHELP, mode);
+#endif
+#ifdef KEY_SHOME
+ keydef("Key_Shift_Home", "KEY_SHOME", KEY_SHOME, mode);
+#endif
+#ifdef KEY_SIC
+ keydef("Key_Shift_Insert_Char", "KEY_SIC", KEY_SIC, mode);
+#endif
+#ifdef KEY_SLEFT
+ keydef("Key_Shift_Cursor_Left", "KEY_SLEFT", KEY_SLEFT, mode);
+#endif
+#ifdef KEY_SMESSAGE
+ keydef("Key_Shift_Message", "KEY_SMESSAGE", KEY_SMESSAGE, mode);
+#endif
+#ifdef KEY_SMOVE
+ keydef("Key_Shift_Move", "KEY_SMOVE", KEY_SMOVE, mode);
+#endif
+#ifdef KEY_SNEXT
+ keydef("Key_Shift_Next_Page", "KEY_SNEXT", KEY_SNEXT, mode);
+#endif
+#ifdef KEY_SOPTIONS
+ keydef("Key_Shift_Options", "KEY_SOPTIONS", KEY_SOPTIONS, mode);
+#endif
+#ifdef KEY_SPREVIOUS
+ keydef("Key_Shift_Previous_Page", "KEY_SPREVIOUS", KEY_SPREVIOUS, mode);
+#endif
+#ifdef KEY_SPRINT
+ keydef("Key_Shift_Print", "KEY_SPRINT", KEY_SPRINT, mode);
+#endif
+#ifdef KEY_SREDO
+ keydef("Key_Shift_Redo", "KEY_SREDO", KEY_SREDO, mode);
+#endif
+#ifdef KEY_SREPLACE
+ keydef("Key_Shift_Replace", "KEY_SREPLACE", KEY_SREPLACE, mode);
+#endif
+#ifdef KEY_SRIGHT
+ keydef("Key_Shift_Cursor_Right", "KEY_SRIGHT", KEY_SRIGHT, mode);
+#endif
+#ifdef KEY_SRSUME
+ keydef("Key_Shift_Resume", "KEY_SRSUME", KEY_SRSUME, mode);
+#endif
+#ifdef KEY_SSAVE
+ keydef("Key_Shift_Save", "KEY_SSAVE", KEY_SSAVE, mode);
+#endif
+#ifdef KEY_SSUSPEND
+ keydef("Key_Shift_Suspend", "KEY_SSUSPEND", KEY_SSUSPEND, mode);
+#endif
+#ifdef KEY_SUNDO
+ keydef("Key_Shift_Undo", "KEY_SUNDO", KEY_SUNDO, mode);
+#endif
+#ifdef KEY_SUSPEND
+ keydef("Key_Suspend", "KEY_SUSPEND", KEY_SUSPEND, mode);
+#endif
+#ifdef KEY_UNDO
+ keydef("Key_Undo", "KEY_UNDO", KEY_UNDO, mode);
+#endif
+#ifdef KEY_MOUSE
+ keydef("Key_Mouse", "KEY_MOUSE", KEY_MOUSE, mode);
+#endif
+#ifdef KEY_RESIZE
+ keydef("Key_Resize", "KEY_RESIZE", KEY_RESIZE, mode);
+#endif
+}
+
+/*
+ * Generate a constant with the given name. The second parameter
+ * is a reference to the ACS character in the acs_map[] array and
+ * will be translated into an index.
+ */
+static void
+acs_def(const char *name, chtype *a)
+{
+ int c = a - &acs_map[0];
+
+ printf(" %-24s : constant Character := ", name);
+ if (isprint(c) && (c != '`'))
+ printf("'%c';\n", c);
+ else
+ printf("Character'Val (%d);\n", c);
+}
+
+/*
+ * Generate the constants for the ACS characters
+ */
+static void
+gen_acs(void)
+{
+ printf(" type C_ACS_Map is array (Character'Val (0) .. Character'Val (127))\n");
+ printf(" of Attributed_Character;\n");
+#if USE_REENTRANT || BROKEN_LINKER
+ printf(" type C_ACS_Ptr is access C_ACS_Map;\n");
+ printf(" function ACS_Map return C_ACS_Ptr;\n");
+ printf(" pragma Import (C, ACS_Map, \"_nc_acs_map\");\n");
+#else
+ printf(" ACS_Map : C_ACS_Map;\n");
+ printf(" pragma Import (C, ACS_Map, \"acs_map\");\n");
+#endif
+ printf(" --\n");
+ printf(" --\n");
+ printf(" -- Constants for several characters from the Alternate Character Set\n");
+ printf(" -- You must use these constants as indices into the ACS_Map array\n");
+ printf(" -- to get the corresponding attributed character at runtime.\n");
+ printf(" --\n");
+
+#ifdef ACS_ULCORNER
+ acs_def("ACS_Upper_Left_Corner", &ACS_ULCORNER);
+#endif
+#ifdef ACS_LLCORNER
+ acs_def("ACS_Lower_Left_Corner", &ACS_LLCORNER);
+#endif
+#ifdef ACS_URCORNER
+ acs_def("ACS_Upper_Right_Corner", &ACS_URCORNER);
+#endif
+#ifdef ACS_LRCORNER
+ acs_def("ACS_Lower_Right_Corner", &ACS_LRCORNER);
+#endif
+#ifdef ACS_LTEE
+ acs_def("ACS_Left_Tee", &ACS_LTEE);
+#endif
+#ifdef ACS_RTEE
+ acs_def("ACS_Right_Tee", &ACS_RTEE);
+#endif
+#ifdef ACS_BTEE
+ acs_def("ACS_Bottom_Tee", &ACS_BTEE);
+#endif
+#ifdef ACS_TTEE
+ acs_def("ACS_Top_Tee", &ACS_TTEE);
+#endif
+#ifdef ACS_HLINE
+ acs_def("ACS_Horizontal_Line", &ACS_HLINE);
+#endif
+#ifdef ACS_VLINE
+ acs_def("ACS_Vertical_Line", &ACS_VLINE);
+#endif
+#ifdef ACS_PLUS
+ acs_def("ACS_Plus_Symbol", &ACS_PLUS);
+#endif
+#ifdef ACS_S1
+ acs_def("ACS_Scan_Line_1", &ACS_S1);
+#endif
+#ifdef ACS_S9
+ acs_def("ACS_Scan_Line_9", &ACS_S9);
+#endif
+#ifdef ACS_DIAMOND
+ acs_def("ACS_Diamond", &ACS_DIAMOND);
+#endif
+#ifdef ACS_CKBOARD
+ acs_def("ACS_Checker_Board", &ACS_CKBOARD);
+#endif
+#ifdef ACS_DEGREE
+ acs_def("ACS_Degree", &ACS_DEGREE);
+#endif
+#ifdef ACS_PLMINUS
+ acs_def("ACS_Plus_Minus", &ACS_PLMINUS);
+#endif
+#ifdef ACS_BULLET
+ acs_def("ACS_Bullet", &ACS_BULLET);
+#endif
+#ifdef ACS_LARROW
+ acs_def("ACS_Left_Arrow", &ACS_LARROW);
+#endif
+#ifdef ACS_RARROW
+ acs_def("ACS_Right_Arrow", &ACS_RARROW);
+#endif
+#ifdef ACS_DARROW
+ acs_def("ACS_Down_Arrow", &ACS_DARROW);
+#endif
+#ifdef ACS_UARROW
+ acs_def("ACS_Up_Arrow", &ACS_UARROW);
+#endif
+#ifdef ACS_BOARD
+ acs_def("ACS_Board_Of_Squares", &ACS_BOARD);
+#endif
+#ifdef ACS_LANTERN
+ acs_def("ACS_Lantern", &ACS_LANTERN);
+#endif
+#ifdef ACS_BLOCK
+ acs_def("ACS_Solid_Block", &ACS_BLOCK);
+#endif
+#ifdef ACS_S3
+ acs_def("ACS_Scan_Line_3", &ACS_S3);
+#endif
+#ifdef ACS_S7
+ acs_def("ACS_Scan_Line_7", &ACS_S7);
+#endif
+#ifdef ACS_LEQUAL
+ acs_def("ACS_Less_Or_Equal", &ACS_LEQUAL);
+#endif
+#ifdef ACS_GEQUAL
+ acs_def("ACS_Greater_Or_Equal", &ACS_GEQUAL);
+#endif
+#ifdef ACS_PI
+ acs_def("ACS_PI", &ACS_PI);
+#endif
+#ifdef ACS_NEQUAL
+ acs_def("ACS_Not_Equal", &ACS_NEQUAL);
+#endif
+#ifdef ACS_STERLING
+ acs_def("ACS_Sterling", &ACS_STERLING);
+#endif
+}
+
+#define GEN_EVENT(name,value) \
+ printf(" %-25s : constant Event_Mask := 8#%011lo#;\n", \
+ #name, value)
+
+#define GEN_MEVENT(name) \
+ printf(" %-25s : constant Event_Mask := 8#%011lo#;\n", \
+ #name, name)
+
+static void
+gen_mouse_events(void)
+{
+ mmask_t all1 = 0;
+ mmask_t all2 = 0;
+ mmask_t all3 = 0;
+ mmask_t all4 = 0;
+
+#ifdef BUTTON1_RELEASED
+ GEN_MEVENT(BUTTON1_RELEASED);
+ all1 |= BUTTON1_RELEASED;
+#endif
+#ifdef BUTTON1_PRESSED
+ GEN_MEVENT(BUTTON1_PRESSED);
+ all1 |= BUTTON1_PRESSED;
+#endif
+#ifdef BUTTON1_CLICKED
+ GEN_MEVENT(BUTTON1_CLICKED);
+ all1 |= BUTTON1_CLICKED;
+#endif
+#ifdef BUTTON1_DOUBLE_CLICKED
+ GEN_MEVENT(BUTTON1_DOUBLE_CLICKED);
+ all1 |= BUTTON1_DOUBLE_CLICKED;
+#endif
+#ifdef BUTTON1_TRIPLE_CLICKED
+ GEN_MEVENT(BUTTON1_TRIPLE_CLICKED);
+ all1 |= BUTTON1_TRIPLE_CLICKED;
+#endif
+#ifdef BUTTON1_RESERVED_EVENT
+ GEN_MEVENT(BUTTON1_RESERVED_EVENT);
+ all1 |= BUTTON1_RESERVED_EVENT;
+#endif
+#ifdef BUTTON2_RELEASED
+ GEN_MEVENT(BUTTON2_RELEASED);
+ all2 |= BUTTON2_RELEASED;
+#endif
+#ifdef BUTTON2_PRESSED
+ GEN_MEVENT(BUTTON2_PRESSED);
+ all2 |= BUTTON2_PRESSED;
+#endif
+#ifdef BUTTON2_CLICKED
+ GEN_MEVENT(BUTTON2_CLICKED);
+ all2 |= BUTTON2_CLICKED;
+#endif
+#ifdef BUTTON2_DOUBLE_CLICKED
+ GEN_MEVENT(BUTTON2_DOUBLE_CLICKED);
+ all2 |= BUTTON2_DOUBLE_CLICKED;
+#endif
+#ifdef BUTTON2_TRIPLE_CLICKED
+ GEN_MEVENT(BUTTON2_TRIPLE_CLICKED);
+ all2 |= BUTTON2_TRIPLE_CLICKED;
+#endif
+#ifdef BUTTON2_RESERVED_EVENT
+ GEN_MEVENT(BUTTON2_RESERVED_EVENT);
+ all2 |= BUTTON2_RESERVED_EVENT;
+#endif
+#ifdef BUTTON3_RELEASED
+ GEN_MEVENT(BUTTON3_RELEASED);
+ all3 |= BUTTON3_RELEASED;
+#endif
+#ifdef BUTTON3_PRESSED
+ GEN_MEVENT(BUTTON3_PRESSED);
+ all3 |= BUTTON3_PRESSED;
+#endif
+#ifdef BUTTON3_CLICKED
+ GEN_MEVENT(BUTTON3_CLICKED);
+ all3 |= BUTTON3_CLICKED;
+#endif
+#ifdef BUTTON3_DOUBLE_CLICKED
+ GEN_MEVENT(BUTTON3_DOUBLE_CLICKED);
+ all3 |= BUTTON3_DOUBLE_CLICKED;
+#endif
+#ifdef BUTTON3_TRIPLE_CLICKED
+ GEN_MEVENT(BUTTON3_TRIPLE_CLICKED);
+ all3 |= BUTTON3_TRIPLE_CLICKED;
+#endif
+#ifdef BUTTON3_RESERVED_EVENT
+ GEN_MEVENT(BUTTON3_RESERVED_EVENT);
+ all3 |= BUTTON3_RESERVED_EVENT;
+#endif
+#ifdef BUTTON4_RELEASED
+ GEN_MEVENT(BUTTON4_RELEASED);
+ all4 |= BUTTON4_RELEASED;
+#endif
+#ifdef BUTTON4_PRESSED
+ GEN_MEVENT(BUTTON4_PRESSED);
+ all4 |= BUTTON4_PRESSED;
+#endif
+#ifdef BUTTON4_CLICKED
+ GEN_MEVENT(BUTTON4_CLICKED);
+ all4 |= BUTTON4_CLICKED;
+#endif
+#ifdef BUTTON4_DOUBLE_CLICKED
+ GEN_MEVENT(BUTTON4_DOUBLE_CLICKED);
+ all4 |= BUTTON4_DOUBLE_CLICKED;
+#endif
+#ifdef BUTTON4_TRIPLE_CLICKED
+ GEN_MEVENT(BUTTON4_TRIPLE_CLICKED);
+ all4 |= BUTTON4_TRIPLE_CLICKED;
+#endif
+#ifdef BUTTON4_RESERVED_EVENT
+ GEN_MEVENT(BUTTON4_RESERVED_EVENT);
+ all4 |= BUTTON4_RESERVED_EVENT;
+#endif
+#ifdef BUTTON_CTRL
+ GEN_MEVENT(BUTTON_CTRL);
+#endif
+#ifdef BUTTON_SHIFT
+ GEN_MEVENT(BUTTON_SHIFT);
+#endif
+#ifdef BUTTON_ALT
+ GEN_MEVENT(BUTTON_ALT);
+#endif
+#ifdef REPORT_MOUSE_POSITION
+ GEN_MEVENT(REPORT_MOUSE_POSITION);
+#endif
+#ifdef ALL_MOUSE_EVENTS
+ GEN_MEVENT(ALL_MOUSE_EVENTS);
+#endif
+
+ GEN_EVENT(BUTTON1_EVENTS, all1);
+ GEN_EVENT(BUTTON2_EVENTS, all2);
+ GEN_EVENT(BUTTON3_EVENTS, all3);
+ GEN_EVENT(BUTTON4_EVENTS, all4);
+}
+
+static void
+wrap_one_var(const char *c_var,
+ const char *c_type,
+ const char *ada_func,
+ const char *ada_type)
+{
+#if USE_REENTRANT
+ /* must wrap variables */
+ printf("\n");
+ printf(" function %s return %s\n", ada_func, ada_type);
+ printf(" is\n");
+ printf(" function Result return %s;\n", c_type);
+ printf(" pragma Import (C, Result, \"_nc_%s\");\n", c_var);
+ printf(" begin\n");
+ if (strcmp(c_type, ada_type))
+ printf(" return %s (Result);\n", ada_type);
+ else
+ printf(" return Result;\n");
+ printf(" end %s;\n", ada_func);
+#else
+ /* global variables are really global */
+ printf("\n");
+ printf(" function %s return %s\n", ada_func, ada_type);
+ printf(" is\n");
+ printf(" Result : %s;\n", c_type);
+ printf(" pragma Import (C, Result, \"%s\");\n", c_var);
+ printf(" begin\n");
+ if (strcmp(c_type, ada_type))
+ printf(" return %s (Result);\n", ada_type);
+ else
+ printf(" return Result;\n");
+ printf(" end %s;\n", ada_func);
+#endif
+}
+
+#define GEN_PUBLIC_VAR(c_var, c_type, ada_func, ada_type) \
+ wrap_one_var(#c_var, #c_type, #ada_func, #ada_type)
+
+static void
+gen_public_vars(void)
+{
+ GEN_PUBLIC_VAR(stdscr, Window, Standard_Window, Window);
+ GEN_PUBLIC_VAR(curscr, Window, Current_Window, Window);
+ GEN_PUBLIC_VAR(LINES, C_Int, Lines, Line_Count);
+ GEN_PUBLIC_VAR(COLS, C_Int, Columns, Column_Count);
+ GEN_PUBLIC_VAR(TABSIZE, C_Int, Tab_Size, Natural);
+ GEN_PUBLIC_VAR(COLORS, C_Int, Number_Of_Colors, Natural);
+ GEN_PUBLIC_VAR(COLOR_PAIRS, C_Int, Number_Of_Color_Pairs, Natural);
+}
+
+/*
+ * Output some comment lines indicating that the file is generated.
+ * The name parameter is the name of the facility to be used in
+ * the comment.
+ */
+static void
+prologue(const char *name)
+{
+ printf("-- %s binding.\n", name);
+ printf("-- This module is generated. Please don't change it manually!\n");
+ printf("-- Run the generator instead.\n-- |");
+
+ printf("define(`M4_BIT_ORDER',`%s_Order_First')",
+ little_endian ? "Low" : "High");
+}
+
+/*
+ * Write the prologue for the curses facility and make sure that
+ * KEY_MIN and KEY_MAX are defined for the rest of this source.
+ */
+static void
+basedefs(void)
+{
+ prologue("curses");
+#ifndef KEY_MAX
+# define KEY_MAX 0777
+#endif
+ printf("define(`M4_KEY_MAX',`8#%o#')", KEY_MAX);
+#ifndef KEY_MIN
+# define KEY_MIN 0401
+#endif
+ if (KEY_MIN == 256)
+ {
+ fprintf(stderr, "Unexpected value for KEY_MIN: %d\n", KEY_MIN);
+ exit(1);
+ }
+ printf("define(`M4_SPECIAL_FIRST',`8#%o#')", KEY_MIN - 1);
+}
+
+/*
+ * Write out the comment lines for the menu facility
+ */
+static void
+menu_basedefs(void)
+{
+ prologue("menu");
+}
+
+/*
+ * Write out the comment lines for the form facility
+ */
+static void
+form_basedefs(void)
+{
+ prologue("form");
+}
+
+/*
+ * Write out the comment lines for the mouse facility
+ */
+static void
+mouse_basedefs(void)
+{
+ prologue("mouse");
+}
+
+/*
+ * Write the definition of a single color
+ */
+static void
+color_def(const char *name, int value)
+{
+ printf(" %-16s : constant Color_Number := %d;\n", name, value);
+}
+
+/*
+ * Generate all color definitions
+ */
+static void
+gen_color(void)
+{
+#if HAVE_USE_DEFAULT_COLORS
+ color_def("Default_Color", -1);
+#endif
+#ifdef COLOR_BLACK
+ color_def("Black", COLOR_BLACK);
+#endif
+#ifdef COLOR_RED
+ color_def("Red", COLOR_RED);
+#endif
+#ifdef COLOR_GREEN
+ color_def("Green", COLOR_GREEN);
+#endif
+#ifdef COLOR_YELLOW
+ color_def("Yellow", COLOR_YELLOW);
+#endif
+#ifdef COLOR_BLUE
+ color_def("Blue", COLOR_BLUE);
+#endif
+#ifdef COLOR_MAGENTA
+ color_def("Magenta", COLOR_MAGENTA);
+#endif
+#ifdef COLOR_CYAN
+ color_def("Cyan", COLOR_CYAN);
+#endif
+#ifdef COLOR_WHITE
+ color_def("White", COLOR_WHITE);
+#endif
+}
+
+/*
+ * Generate the linker options for the base facility
+ */
+static void
+gen_linkopts(void)
+{
+ printf(" pragma Linker_Options (\"-lncurses%s\");\n", model);
+}
+
+/*
+ * Generate the linker options for the menu facility
+ */
+static void
+gen_menu_linkopts(void)
+{
+ printf(" pragma Linker_Options (\"-lmenu%s\");\n", model);
+}
+
+/*
+ * Generate the linker options for the form facility
+ */
+static void
+gen_form_linkopts(void)
+{
+ printf(" pragma Linker_Options (\"-lform%s\");\n", model);
+}
+
+/*
+ * Generate the linker options for the panel facility
+ */
+static void
+gen_panel_linkopts(void)
+{
+ printf(" pragma Linker_Options (\"-lpanel%s\");\n", model);
+}
+
+static void
+gen_version_info(void)
+{
+ static const char *v1 =
+ " NC_Major_Version : constant := %d; -- Major version of the library\n";
+ static const char *v2 =
+ " NC_Minor_Version : constant := %d; -- Minor version of the library\n";
+ static const char *v3 =
+ " NC_Version : constant String := %c%d.%d%c; -- Version of library\n";
+
+ printf(v1, NCURSES_VERSION_MAJOR);
+ printf(v2, NCURSES_VERSION_MINOR);
+ printf(v3, '"', NCURSES_VERSION_MAJOR, NCURSES_VERSION_MINOR, '"');
+}
+
+static int
+eti_gen(char *buf, int code, const char *name, int *etimin, int *etimax)
+{
+ sprintf(buf, " E_%-16s : constant Eti_Error := %d;\n", name, code);
+ if (code < *etimin)
+ *etimin = code;
+ if (code > *etimax)
+ *etimax = code;
+ return strlen(buf);
+}
+
+static void
+gen_offsets(void)
+{
+ const char *s_bool = "";
+
+ if (sizeof(bool) == sizeof(char))
+ {
+ s_bool = "char";
+ }
+ else if (sizeof(bool) == sizeof(short))
+ {
+ s_bool = "short";
+ }
+ else if (sizeof(bool) == sizeof(int))
+ {
+ s_bool = "int";
+ }
+ printf(" Sizeof%-*s : constant Natural := %2ld; -- %s\n",
+ 12, "_bool", (long)sizeof(bool), "bool");
+
+ /* In ncurses _maxy and _maxx needs an offset for the "public"
+ * value
+ */
+ printf(" Offset%-*s : constant Natural := %2d; -- %s\n",
+ 12, "_XY", 1, "int");
+ printf("\n");
+ printf(" type Curses_Bool is mod 2 ** Interfaces.C.%s'Size;\n", s_bool);
+}
+
+/*
+ * main() expects two arguments on the commandline, both single characters.
+ * The first character denotes the facility for which we generate output.
+ * Possible values are
+ * B - Base
+ * M - Menus
+ * F - Forms
+ * P - Pointer Device (Mouse)
+ * E - ETI base definitions
+ *
+ * The second character then denotes the specific output that should be
+ * generated for the selected facility.
+ */
+int
+main(int argc, char *argv[])
+{
+ int x = 0x12345678;
+ char *s = (char *)&x;
+
+ if (*s == 0x78)
+ little_endian = 1;
+
+ if (argc != 4)
+ exit(1);
+ model = *++argv;
+
+ switch (argv[1][0])
+ {
+ /* --------------------------------------------------------------- */
+ case 'B': /* The Base facility */
+ switch (argv[2][0])
+ {
+ case 'A': /* chtype translation into Ada95 record type */
+ gen_attr_set("Character_Attribute_Set");
+ break;
+ case 'B': /* write some initial comment lines */
+ basedefs();
+ break;
+ case 'C': /* generate color constants */
+ gen_color();
+ break;