This file is intended to help people interested in working
on fixing ncurses, enhancing it, or porting it to other
platforms.

PORTABILITY:

To add support for a new operating system, you must add a line for that
system to the `matrix' file.

The field values are listed below.  Down the left side are the operating
systems supported. If an option is not needed then it should have an entry of
NONE.  Note the use of ':' to terminate each field.

NUMBER:		Number by which you select the OS via Configure

OS: 		label of the operating system (used as config file suffix)

OSNAME:		name of the operating system

ISPOSIX:	-DNONPOSIX if <unistd.h> is missing

POSIX:		-DSTRICTPOSIX if _POSIX_SOURCE turns off non-POSIX features.
		-DSVR4_ACTION if like svr4 you need _POSIX_SOURCE to have
		sigaction(2).

TERMINAL:	-DNOTERMIOS if you don't have <termios.h> but have <sgtty.h>

HEADERS:	-DBRAINDEAD if system headers don't declare external variables

TABS:		-DBSDTABS if you don't have TABS3 but have OXTABS

SRCDIR:		the directory where the terminfo database lives

CC:		ANSI C compiler

FLAGS:		standard compiler flags

EXTRA:		extra flags needed by individual systems
	Sun:	-DSUNIOCTL <sys/ioctl.h> conflicts with <termios.h>
	HP-UX:	-D_HPUX_SOURCE so that we get POSIX and XOPEN features.
	SVR4:	-DBROKEN_TIOCGETWINSZ guess what?
	AIX:	-DSYS_SELECT if you need <sys/select.h>
	misc:   -DNOSTRERROR for those system without strerror()

BASE:		The directory under which headers and libraries will
		be installed.

INSTALL:	The name of an install program similar to BSD's (ie. 
		understands -m, -g, -o, etc.).  GNU install works.

The awk script in script.src reads matrix and generates all the Config.*
files. 

There are several problems with strict POSIX systems so extra flags
or #define's maybe needed.

THINGS TO DO:

1. Extended COSE conformance

There is an XPG4 standard recently released which describes a superset
of the SVr4 API.  The library is BASE conformant with this standard.
We would like to make ncurses fully conformant at the EXTENDED level
supporting internationalization.

2. DOS port

Only 16 of the 55 files in the library depend on the terminfo format.
It should be possible to further kernelize the package, then rewrite 
a small number of core files to produce a functionally-compatible
port that would do updates to a memory-mapped screen area.  The first
result of this would be a DOS port.

3. X port

It would be nice if ncurses could recognize when it was running under X and
maintain its own window.  With this feature, all ncurses programs would
automatically become X programs.

4. Unused capabilities

The currently unused capabilities fall naturally into several groups:

A. Status-line capabilities:

	Booleans: has_status_line, status_line_esc_ok.
	Numerics: width_status_line.
	Strings: dis_status_line, from_status_line, to_status_line.

System V Release 1 curses made no use of these at all.  SVr4's use, if
any, is unknown.  From the AT&T termcap file it looks like curses, in general,
shouldn't use them; terminal variants with status lines have their line count
decremented by 1, suggesting that curses is supposed to leave the status line
alone.

B. Printer capabilities:

	Boolean: col_addr_glitch, cr_cancels_micro_mode, has_print_wheel,
		row_addr_glitch, semi_auto_right_margin, cpi_changes_res,
		lpi_changes_res.
	Numeric: buffer_capacity, dot_horz_spacing, dot_vert_spacing,
		max_micro_address, max_micro_jump, micro_col_size,
		micro_line_size, number_of_pins, output_res_char,
		output_res_line, output_res_horz_inch, print_rate,
		wide_char_size, bit_image_entwining, bit_image_type.
	String: down_half_line, form_feed, up_half_line, set_left_margin,
		set_right_margin, clear_margins, change_char_pitch
		... set_page_length (all the SVr4 printer caps),

Curses doesn't use these.

C. Printer-control capabilities:

	Boolean: prtr_silent.
	Strings: print_screen, prtr_on, prtr_off, prtr_non.

Curses doesn't use these.

D. Dialer strings:

	Strings: hangup, dial_phone, quick_dial, tone, pulse, flash_hook,
		fixed_pause, wait_tone.

Curses doesn't use these.

E. Window and virtual-terminal capabilities:

	Numerics: maximum_windows, virtual_terminal.
	Strings: req_for_input, create_window, goto_window, set_window.

These seem to be fossils from some AT&T experiments on character-based
window systems that never escaped the lab.  The virtual_terminal cap had
something to do with building terminal emulations into tty line disciplines.

F. Unused VDT capabilities:

	Booleans: erase_overstrike, has_meta_key, insert_null_glitch,
		move_insert, dest_tabs_magic_smso, transparent_underline,
		needs_xon_xoff, hard_cursor.
	Numerics: lines_of_memory, buttons.
	Strings: pkey_key, pkey_local, pkey_xmit, underline_char, 
		enter_xon_mode,	exit_xon_mode, xon_character, xoff_character, 
		display_clock, remove_clock, user[0-5], display_pc_char,
		enter_scancode_mode, exit_scancode_mode, pc_term_options, 
		scancode_escape, alt_scancode_esc.

These are the potentially important ones for ncurses.  Notes:

	i) ncurses doesn't need move_insert; it never uses cup/hpa/vpa while
		insert_mode is on.

	ii) We probably don't care about dest_tabs_magic_smso; only
		Telerays used it and they're all long obsolete.

5.  Untested features

The code for handling soft labels on a terminal type with built-in support
for them (num_labels > 0, label_height, label_width, label_format, label_off,
label_on, plab_norm, lab_f*) has not been tested.  The label_format and
lab_f* capabilities aren't presently used.

ORGANIZATION:

The following notes are intended to be a first step towards DOS and Macintosh
ports of the ncurses library.

The following library modules are `pure curses'; they operate only on the
curses internal structures, do all output through other curses calls (not
including tputs() and putp()) and do not call any other UNIX routines such
as signal(2) or the stdio library.  Thus, they should not need to be modified
for single-terminal ports.

lib_addch.c
lib_addstr.c
lib_bkgd.c
lib_box.c
lib_clear.c
lib_clrbot.c
lib_clreol.c
lib_delch.c
lib_delwin.c
lib_endwin.c
lib_erase.c
lib_getstr.c	(uses outstr())
lib_inchstr.c
lib_insch.c
lib_insdel.c
lib_insstr.c
lib_keyname.c
lib_move.c
lib_mvwin.c
lib_newwin.c
lib_overlay.c
lib_pad.c
lib_printw.c
lib_refresh.c
lib_scanw.c
lib_scroll.c
lib_scrreg.c
lib_set_term.c
lib_touch.c
lib_tparm.c
lib_tputs.c
lib_unctrl.c
lib_window.c

These modules are pure curses, except that they use tputs() and putp():

lib_beep.c
lib_color.c
lib_options.c
lib_slk.c
lib_vidattr.c

This modules assist in POSIX emulation on non-POSIX systems:

sigaction.c	-- signal calls
strerror.c	-- uses sys_errlist[]; for non-POSIX systems only

The following source files will not be needed for a single-terminal-type port.

captoinfo.c
clear.c
comp_captab.c
comp_error.c
comp_hash.c
comp_main.c
comp_parse.c
comp_scan.c
alloc_entry.c
dump_entry.c
parse_entry.c
read_entry.c
write_entry.c
infocmp.c
tput.c

The following modules will use open()/read()/write()/close()/lseek() on files,
but no other OS calls.

lib_screen.c	-- used to read/write screen dumps
lib_trace.c	-- used to write trace data to the logfile

Modules that would have to be modified for a port start here:

The following modules are `pure curses' but contain assumptions inappropriate
for a memory-mapped port.

lib_longname.c	-- assumes there may be multiple terminals
	longname()		-- return long name of terminal
lib_acs.c	-- assumes acs_map as a double indirection
	init_acs()		-- initialize acs map
lib_mvcur.c	-- assumes cursor moves have variable cost
	mvcur_init()		-- initialize
	mvcur()			-- do physical cursor move
	mvcur_wrap()		-- wrap
	scrolln()		-- do physical scrolling
lib_termcap.c	-- assumes there may be multiple terminals
	tgetent()		-- load entry
	tgetflag()		-- get boolean capability
	tgetnum()		-- get numeric capability
	tgetstr()		-- get string capability
lib_ti.c	-- assumes there may be multiple terminals
	tigetent()		-- load entry
	tigetflag()		-- get boolean capability
	tigetnum()		-- get numeric capability
	tigetstr()		-- get string capability

The following modules use UNIX-specific calls:

lib_doupdate.c	-- input checking
	doupdate()		-- repaint real screen to match virtual
	_outch()		-- put out a single character
lib_getch.c	-- read()
	wgetch()		-- get single character
	wungetch()		-- push back single character
lib_initscr.c	-- getenv()
	initscr()		-- initialize curses functions
lib_newterm.c
	newterm()		-- set up new terminal screen
lib_kernel.c	-- various tty-manipulation and system calls
	reset_prog_mode()	-- reset ccurses-raw mode
	reset_shell_mode()	-- reset cooked mode
	baudrate()		-- return the baudrate
	erasechar()		-- return the erase char
	killchar()		-- return the kill character
	flushinp()		-- flush pending input
	savetty()		-- save tty state
	resetty()		-- reset tty to state at last savetty() 
lib_raw.c	-- various tty-manipulation calls
	raw()
	echo()
	nl()
	qiflush()
	cbreak()
	noraw()
	noecho()
	nonl()
	noqiflush()
	nocbreak()
lib_setup.c	-- various tty-manipulation calls
	use_env()
	def_shell_mode()
	def_prog_mode()
	set_curterm()
	del_curterm()
lib_tstp.c	-- signal-manipulation calls
	curses_signal_handler()	-- enable/disable window-mode signal catching
lib_twait.c	-- gettimeofday(), select().
	usleep()		-- microsecond sleep
	timed_wait()		-- timed wait for input

The package kernel could be made smaller.
