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

PORTABILITY:

Here are some -D options you might need to compile with.
The 'configure' script usually gets them right automatically.
  
-DHAVE_UNISTD_H		if <unistd.h> is present

-DHAVE_SIGACTION	if the sigaction function is present

-DHAVE_USLEEP		if the usleep function is present

-DSTRICTPOSIX		if _POSIX_SOURCE turns off non-POSIX features.

-DSVR4_ACTION		if (e.g., svr4) you need _POSIX_SOURCE to have sigaction

-DHAVE_TERMIOS_H	if you have <termios.h>; otherwise it uses <sgtty.h>

-DOPT_MVCUR		if you want mvcur() to cost its actions or you have a
			terminal that doesn't have direct cursor addressing.

-D_HPUX_SOURCE		so that we get POSIX and XOPEN features.

-DBROKEN_TIOCGETWINSZ	on SVR4 and HPUX

-DHAVE_SYS_SELECT_H	if (e.g., AIX) you have <sys/select.h>

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

	HP-UX:	-D_HPUX_SOURCE so that we get POSIX and XOPEN features.
	SVR4:	-DBROKEN_TIOCGETWINSZ guess what?

THE PANELS LIBRARY

This is a clone of the SVr3.3/SVr4 terminfo curses panels layer.  It
was written primarily to assist in porting u386mon 2.0
(comp.sources.misc v14i001-4) to systems lacking panels support;
u386mon 2.10 and beyond use it.  This version has been slightly cleaned
up for ncurses.

ORGANIZATION:

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

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
panel.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
	_nc_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
	_nc_signal_handler()	-- enable/disable window-mode signal catching
lib_twait.c	-- gettimeofday(), select().
	usleep()		-- microsecond sleep
	_nc_timed_wait()	-- timed wait for input

The package kernel could be made smaller.

GENERAL NOTES FOR DEVELOPERS:

The prefix _nc_ should be used on library public functions that are
not part of the curses API in order to prevent pollution of the
application namespace.
