Ada95 Binding for ncurses

The ncurses Ada95 binding is © 1996 by Jürgen Pfeifer.

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.

General Remarks


Hierarchy of packages

Implementation Details

Behind the abstraction

All the new types like Window, Panel, Menu, Form etc. are just opaque representations of the pointers to the corresponding low level (n)curses structures like WINDOW *, PANEL *, MENU * or FORM *. So you can safely pass them to C routines that expect a pointer to one of those structures.

Item and Field Arrays

In C you have to pass the item and field arrays to define menus or forms terminated by a null item or null field. This is not necessary in this binding. The binding routines will construct from an Ada95 style array of Item or Field objects internally the properly terminated array of C structure pointers. See the examples for more details.

Extended ripoffline() usage

The official documentation of (n)curses says, that the line parameter determines only whether or not exactly one line is stolen from the top or bottom of the screen. So essentially only the sign of the parameter is evaluated. ncurses has internally implemented it in a way, that uses the line parameter also to control the amount of lines to steal. This mechanism is used in the Rip_Off_Lines routine of the binding.

User Pointer mechanism


How user defined field types work


Enumeration fields handling

The (n)curses documentation says, that the String arrays to be passed to an TYPE_ENUM fieldtype must not be automatic variables. This is not true in this binding, because it is internally arranged to safely copy these values.

Using other Ada compilers

This should basically not be a problem, but you have to replace a code sequence in package
Terminal_Interface.Curses.Forms that uses a hashing package supplied with the GNAT runtime, which is not part of the Standard Ada runtimes. This should not be too hard. I intend to remove this dependency in the future.

Port to other curses implementations

Basically it should not be too hard to make all this run on a regular SVr4 implementation of curses. The problems are probably these:
I'm quite sure I forgot something.