libpayload: Rename PDCurses-3.4 to PDCurses

Change-Id: If881ec130833c7e7e62caa3d31e350a531f5bc8e
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: http://review.coreboot.org/12398
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Stefan Reinauer
2015-11-10 09:00:41 -08:00
parent 2ea24dabd6
commit 4f85a1eb76
164 changed files with 2 additions and 2 deletions

View File

@@ -0,0 +1,37 @@
# Makefile for PDCurses manext program.
all: manual
manual: PDCurses.txt
PDCurses.txt: manext
cat intro.txt > PDCurses.txt
echo PDCurses Definitions and Variables >> PDCurses.txt
echo ================================== >> PDCurses.txt
./manext ../curses.h >> PDCurses.txt
echo PDCurses Functions >> PDCurses.txt
echo ================== >> PDCurses.txt
./manext ../pdcurses/*.c >> PDCurses.txt
./manext ../x11/*.c >> PDCurses.txt
cat x11.txt >> PDCurses.txt
echo >> PDCurses.txt
echo >> PDCurses.txt
echo \
-------------------------------------------------------------------------- \
>> PDCurses.txt
echo >> PDCurses.txt
cat sdl.txt >> PDCurses.txt
manext: manext.c
install:
echo Does nothing at the moment
clean:
-rm -rf *.o manext PDCurses.txt
distclean: clean
mostlyclean: clean
realclean: distclean

View File

@@ -0,0 +1,833 @@
PDCurses User's Guide
=====================
Curses Overview
---------------
The X/Open Curses Interface Definition describes a set of C-Language
functions that provide screen-handling and updating, which are
collectively known as the curses library.
The curses library permits manipulation of data structures called
windows which may be thought of as two-dimensional arrays of
characters representing all or part of a terminal's screen. The
windows are manipulated using a procedural interface described
elsewhere. The curses package maintains a record of what characters
are on the screen. At the most basic level, manipulation is done with
the routines move() and addch() which are used to "move" the curses
around and add characters to the default window, stdscr, which
represents the whole screen.
An application may use these routines to add data to the window in any
convenient order. Once all data have been added, the routine
refresh() is called. The package then determines what changes have
been made which affect the screen. The screen contents are then
changed to reflect those characters now in the window, using a
sequence of operations optimized for the type of terminal in use.
At a higher level routines combining the actions of move() and addch()
are defined, as are routines to add whole strings and to perform
format conversions in the manner of printf().
Interfaces are also defined to erase the entire window and to specify
the attributes of individual characters in the window. Attributes
such as inverse video, underline and blink can be used on a
per-character basis.
New windows can be created by allowing the application to build
several images of the screen and display the appropriate one very
quickly. New windows are created using the routine newwin(). For
each routine that manipulates the default window, stdscr, there is a
corresponding routine prefixed with w to manipulate the contents of a
specified window; for example, move() and wmove(). In fact, move(...)
is functionally equivalent to wmove( stdscr, ...). This is similar to
the interface offered by printf(...) and fprintf(stdout, ...).
Windows do not have to correspond to the entire screen. It is
possible to create smaller windows, and also to indicate that the
window is only partially visible on the screen. Furthermore, large
windows or pads, which are bigger than the actual screen size, may be
created.
Interfaces are also defined to allow input character manipulation and
to disable and enable many input attributes: character echo, single
character input with or without signal processing (cbreak or raw
modes), carriage returns mapping to newlines, screen scrolling, etc.
Data Types and the <curses.h> Header
------------------------------------
The data types supported by curses are described in this section.
As the library supports a procedural interface to the data types, actual
structure contents are not described. All curses data are manipulated
using the routines provided.
THE <curses.h> HEADER
The <curses.h> header defines various constants and declares the data
types that are available to the application.
DATA TYPES
The following data types are declared:
WINDOW * pointer to screen representation
SCREEN * pointer to terminal descriptor
bool boolean data type
chtype representation of a character in a window
cchar_t the wide-character equivalent of chtype
attr_t for WA_-style attributes
The actual WINDOW and SCREEN objects used to store information are
created by the corresponding routines and a pointer to them is provided.
All manipulation is through that pointer.
VARIABLES
The following variables are defined:
LINES number of lines on terminal screen
COLS number of columns on terminal screen
stdscr pointer to the default screen window
curscr pointer to the current screen image
SP pointer to the current SCREEN struct
Mouse_status status of the mouse
COLORS number of colors available
COLOR_PAIRS number of color pairs available
TABSIZE size of one TAB block
acs_map[] alternate character set map
ttytype[] terminal name/description
CONSTANTS
The following constants are defined:
GENERAL
FALSE boolean false value
TRUE boolean true value
NULL zero pointer value
ERR value returned on error condition
OK value returned on successful completion
VIDEO ATTRIBUTES
Normally, attributes are a property of the character.
For chtype:
A_ALTCHARSET use the alternate character set
A_BLINK bright background or blinking
A_BOLD bright foreground or bold
A_DIM half bright -- no effect in PDCurses
A_INVIS invisible
A_ITALIC italic
A_LEFTLINE line along the left edge
A_PROTECT protected (?) -- PDCurses renders this as a
combination of the *LINE attributes
A_REVERSE reverse video
A_RIGHTLINE line along the right edge
A_STANDOUT terminal's best highlighting mode
A_UNDERLINE underline
A_ATTRIBUTES bit-mask to extract attributes
A_CHARTEXT bit-mask to extract a character
A_COLOR bit-mask to extract a color-pair
Not all attributes will work on all terminals. A_RIGHTLINE, A_LEFTLINE
and A_ITALIC are specific to PDCurses. A_INVIS and A_ITALIC are given
the same value in PDCurses.
For attr_t:
WA_ALTCHARSET same as A_ALTCHARSET
WA_BLINK same as A_BLINK
WA_BOLD same as A_BOLD
WA_DIM same as A_DIM
WA_INVIS same as A_INVIS
WA_LEFT same as A_LEFTLINE
WA_PROTECT same as A_PROTECT
WA_REVERSE same as A_REVERSE
WA_RIGHT same as A_RIGHTLINE
WA_STANDOUT same as A_STANDOUT
WA_UNDERLINE same as A_UNDERLINE
Note that while A_LEFTLINE and A_RIGHTLINE are PDCurses-specific,
WA_LEFT and WA_RIGHT are standard. The following are also defined, for
compatibility, but currently have no effect in PDCurses: WA_HORIZONTAL,
WA_LOW, WA_TOP, WA_VERTICAL.
THE ALTERNATE CHARACTER SET
For use in chtypes and with related functions. These are a portable way
to represent graphics characters on different terminals.
VT100-compatible symbols -- box characters:
ACS_ULCORNER upper left box corner
ACS_LLCORNER lower left box corner
ACS_URCORNER upper right box corner
ACS_LRCORNER lower right box corner
ACS_RTEE right "T"
ACS_LTEE left "T"
ACS_BTEE bottom "T"
ACS_TTEE top "T"
ACS_HLINE horizontal line
ACS_VLINE vertical line
ACS_PLUS plus sign, cross, or four-corner piece
VT100-compatible symbols -- other:
ACS_S1 scan line 1
ACS_S9 scan line 9
ACS_DIAMOND diamond
ACS_CKBOARD checkerboard -- 50% grey
ACS_DEGREE degree symbol
ACS_PLMINUS plus/minus sign
ACS_BULLET bullet
Teletype 5410v1 symbols -- these are defined in SysV curses, but
are not well-supported by most terminals. Stick to VT100 characters
for optimum portability:
ACS_LARROW left arrow
ACS_RARROW right arrow
ACS_DARROW down arrow
ACS_UARROW up arrow
ACS_BOARD checkerboard -- lighter (less dense) than
ACS_CKBOARD
ACS_LANTERN lantern symbol
ACS_BLOCK solid block
That goes double for these -- undocumented SysV symbols. Don't use
them:
ACS_S3 scan line 3
ACS_S7 scan line 7
ACS_LEQUAL less than or equal
ACS_GEQUAL greater than or equal
ACS_PI pi
ACS_NEQUAL not equal
ACS_STERLING pounds sterling symbol
Box character aliases:
ACS_BSSB same as ACS_ULCORNER
ACS_SSBB same as ACS_LLCORNER
ACS_BBSS same as ACS_URCORNER
ACS_SBBS same as ACS_LRCORNER
ACS_SBSS same as ACS_RTEE
ACS_SSSB same as ACS_LTEE
ACS_SSBS same as ACS_BTEE
ACS_BSSS same as ACS_TTEE
ACS_BSBS same as ACS_HLINE
ACS_SBSB same as ACS_VLINE
ACS_SSSS same as ACS_PLUS
For cchar_t and wide-character functions, WACS_ equivalents are also
defined.
COLORS
For use with init_pair(), color_set(), etc.:
COLOR_BLACK
COLOR_BLUE
COLOR_GREEN
COLOR_CYAN
COLOR_RED
COLOR_MAGENTA
COLOR_YELLOW
COLOR_WHITE
Use these instead of numeric values. The definition of the colors
depends on the implementation of curses.
INPUT VALUES
The following constants might be returned by getch() if keypad() has
been enabled. Note that not all of these may be supported on a
particular terminal:
KEY_BREAK break key
KEY_DOWN the four arrow keys
KEY_UP
KEY_LEFT
KEY_RIGHT
KEY_HOME home key (upward+left arrow)
KEY_BACKSPACE backspace
KEY_F0 function keys; space for 64 keys is reserved
KEY_F(n) (KEY_F0+(n))
KEY_DL delete line
KEY_IL insert line
KEY_DC delete character
KEY_IC insert character
KEY_EIC exit insert character mode
KEY_CLEAR clear screen
KEY_EOS clear to end of screen
KEY_EOL clear to end of line
KEY_SF scroll 1 line forwards
KEY_SR scroll 1 line backwards (reverse)
KEY_NPAGE next page
KEY_PPAGE previous page
KEY_STAB set tab
KEY_CTAB clear tab
KEY_CATAB clear all tabs
KEY_ENTER enter or send
KEY_SRESET soft (partial) reset
KEY_RESET reset or hard reset
KEY_PRINT print or copy
KEY_LL home down or bottom (lower left)
KEY_A1 upper left of virtual keypad
KEY_A3 upper right of virtual keypad
KEY_B2 center of virtual keypad
KEY_C1 lower left of virtual keypad
KEY_C3 lower right of virtual keypad
KEY_BTAB Back tab key
KEY_BEG Beginning key
KEY_CANCEL Cancel key
KEY_CLOSE Close key
KEY_COMMAND Cmd (command) key
KEY_COPY Copy key
KEY_CREATE Create key
KEY_END End key
KEY_EXIT Exit key
KEY_FIND Find key
KEY_HELP Help key
KEY_MARK Mark key
KEY_MESSAGE Message key
KEY_MOVE Move key
KEY_NEXT Next object key
KEY_OPEN Open key
KEY_OPTIONS Options key
KEY_PREVIOUS Previous object key
KEY_REDO Redo key
KEY_REFERENCE Reference key
KEY_REFRESH Refresh key
KEY_REPLACE Replace key
KEY_RESTART Restart key
KEY_RESUME Resume key
KEY_SAVE Save key
KEY_SBEG Shifted beginning key
KEY_SCANCEL Shifted cancel key
KEY_SCOMMAND Shifted command key
KEY_SCOPY Shifted copy key
KEY_SCREATE Shifted create key
KEY_SDC Shifted delete char key
KEY_SDL Shifted delete line key
KEY_SELECT Select key
KEY_SEND Shifted end key
KEY_SEOL Shifted clear line key
KEY_SEXIT Shifted exit key
KEY_SFIND Shifted find key
KEY_SHELP Shifted help key
KEY_SHOME Shifted home key
KEY_SIC Shifted input key
KEY_SLEFT Shifted left arrow key
KEY_SMESSAGE Shifted message key
KEY_SMOVE Shifted move key
KEY_SNEXT Shifted next key
KEY_SOPTIONS Shifted options key
KEY_SPREVIOUS Shifted prev key
KEY_SPRINT Shifted print key
KEY_SREDO Shifted redo key
KEY_SREPLACE Shifted replace key
KEY_SRIGHT Shifted right arrow
KEY_SRSUME Shifted resume key
KEY_SSAVE Shifted save key
KEY_SSUSPEND Shifted suspend key
KEY_SUNDO Shifted undo key
KEY_SUSPEND Suspend key
KEY_UNDO Undo key
The virtual keypad is arranged like this:
A1 up A3
left B2 right
C1 down C3
This list is incomplete -- see curses.h for the full list, and use the
testcurs demo to see what values are actually returned. The above are
just the keys required by X/Open. In particular, PDCurses defines many
CTL_ and ALT_ combinations; these are not portable.
FUNCTIONS
The following table lists each curses routine and the name of the manual
page on which it is described.
Functions from the X/Open curses standard -- complete, except for
getch() and ungetch(), which are implemented as macros for DOS
compatibility:
Curses Function Manual Page Name
addch addch
addchnstr addchstr
addchstr addchstr
addnstr addstr
addstr addstr
attroff attr
attron attr
attrset attr
attr_get attr
attr_off attr
attr_on attr
attr_set attr
baudrate termattr
beep beep
bkgd bkgd
bkgdset bkgd
border border
box border
can_change_color color
cbreak inopts
chgat attr
clearok outopts
clear clear
clrtobot clear
clrtoeol clear
color_content color
color_set attr
copywin overlay
curs_set kernel
def_prog_mode kernel
def_shell_mode kernel
del_curterm terminfo
delay_output util
delch delch
deleteln deleteln
delscreen initscr
delwin window
derwin window
doupdate refresh
dupwin window
echochar addch
echo inopts
endwin initscr
erasechar termattr
erase clear
filter util
flash beep
flushinp getch
getbkgd bkgd
getnstr getstr
getstr getstr
getwin scr_dump
halfdelay inopts
has_colors color
has_ic termattr
has_il termattr
hline border
idcok outopts
idlok outopts
immedok outopts
inchnstr inchstr
inchstr inchstr
inch inch
init_color color
init_pair color
initscr initscr
innstr instr
insch insch
insdelln deleteln
insertln deleteln
insnstr innstr
insstr innstr
instr instr
intrflush inopts
isendwin initscr
is_linetouched touch
is_wintouched touch
keyname keyname
keypad inopts
killchar termattr
leaveok outopts
longname termattr
meta inopts
move move
mvaddch addch
mvaddchnstr addchstr
mvaddchstr addchstr
mvaddnstr addstr
mvaddstr addstr
mvchgat attr
mvcur terminfo
mvdelch delch
mvderwin window
mvgetch getch
mvgetnstr getstr
mvgetstr getstr
mvhline border
mvinch inch
mvinchnstr inchstr
mvinchstr inchstr
mvinnstr instr
mvinsch insch
mvinsnstr insstr
mvinsstr insstr
mvinstr instr
mvprintw printw
mvscanw scanw
mvvline border
mvwaddchnstr addchstr
mvwaddchstr addchstr
mvwaddch addch
mvwaddnstr addstr
mvwaddstr addstr
mvwchgat attr
mvwdelch delch
mvwgetch getch
mvwgetnstr getstr
mvwgetstr getstr
mvwhline border
mvwinchnstr inchstr
mvwinchstr inchstr
mvwinch inch
mvwinnstr instr
mvwinsch insch
mvwinsnstr insstr
mvwinsstr insstr
mvwinstr instr
mvwin window
mvwprintw printw
mvwscanw scanw
mvwvline border
napms kernel
newpad pad
newterm initscr
newwin window
nl inopts
nocbreak inopts
nodelay inopts
noecho inopts
nonl inopts
noqiflush inopts
noraw inopts
notimeout inopts
overlay overlay
overwrite overlay
pair_content color
pechochar pad
pnoutrefresh pad
prefresh pad
printw printw
putp terminfo
putwin scr_dump
qiflush inopts
raw inopts
redrawwin refresh
refresh refresh
reset_prog_mode kernel
reset_shell_mode kernel
resetty kernel
restartterm terminfo
ripoffline kernel
savetty kernel
scanw scanw
scr_dump scr_dump
scr_init scr_dump
scr_restore scr_dump
scr_set scr_dump
scrl scroll
scroll scroll
scrollok outopts
set_term initscr
setscrreg outopts
setterm terminfo
setupterm terminfo
slk_attroff slk
slk_attr_off slk
slk_attron slk
slk_attr_on slk
slk_attrset slk
slk_attr_set slk
slk_clear slk
slk_color slk
slk_init slk
slk_label slk
slk_noutrefresh slk
slk_refresh slk
slk_restore slk
slk_set slk
slk_touch slk
standend attr
standout attr
start_color color
subpad pad
subwin window
syncok window
termattrs termattrs
term_attrs termattrs
termname termattrs
tgetent termcap
tgetflag termcap
tgetnum termcap
tgetstr termcap
tgoto termcap
tigetflag terminfo
tigetnum terminfo
tigetstr terminfo
timeout inopts
touchline touch
touchwin touch
tparm terminfo
tputs terminfo
typeahead inopts
untouchwin touch
use_env util
vidattr terminfo
vid_attr terminfo
vidputs terminfo
vid_puts terminfo
vline border
vw_printw printw
vwprintw printw
vw_scanw scanw
vwscanw scanw
waddchnstr addchstr
waddchstr addchstr
waddch addch
waddnstr addstr
waddstr addstr
wattroff attr
wattron attr
wattrset attr
wattr_get attr
wattr_off attr
wattr_on attr
wattr_set attr
wbkgdset bkgd
wbkgd bkgd
wborder border
wchgat attr
wclear clear
wclrtobot clear
wclrtoeol clear
wcolor_set attr
wcursyncup window
wdelch delch
wdeleteln deleteln
wechochar addch
werase clear
wgetch getch
wgetnstr getstr
wgetstr getstr
whline border
winchnstr inchstr
winchstr inchstr
winch inch
winnstr instr
winsch insch
winsdelln deleteln
winsertln deleteln
winsnstr insstr
winsstr insstr
winstr instr
wmove move
wnoutrefresh refresh
wprintw printw
wredrawln refresh
wrefresh refresh
wscanw scanw
wscrl scroll
wsetscrreg outopts
wstandend attr
wstandout attr
wsyncdown window
wsyncup window
wtimeout inopts
wtouchln touch
wvline border
Wide-character functions from the X/Open standard -- these are only
available when PDCurses is built with PDC_WIDE defined, and the
prototypes are only available from curses.h when PDC_WIDE is defined
before its inclusion in your app:
addnwstr addstr
addwstr addstr
add_wch addch
add_wchnstr addchstr
add_wchstr addchstr
border_set border
box_set border
echo_wchar addch
erasewchar termattr
getbkgrnd bkgd
getcchar util
getn_wstr getstr
get_wch getch
get_wstr getstr
hline_set border
innwstr instr
ins_nwstr insstr
ins_wch insch
ins_wstr insstr
inwstr instr
in_wch inch
in_wchnstr inchstr
in_wchstr inchstr
key_name keyname
killwchar termattr
mvaddnwstr addstr
mvaddwstr addstr
mvadd_wch addch
mvadd_wchnstr addchstr
mvadd_wchstr addchstr
mvgetn_wstr getstr
mvget_wch getch
mvget_wstr getstr
mvhline_set border
mvinnwstr instr
mvins_nwstr insstr
mvins_wch insch
mvins_wstr insstr
mvinwstr instr
mvwaddnwstr addstr
mvwaddwstr addstr
mvwadd_wch addch
mvwadd_wchnstr addchstr
mvwadd_wchstr addchstr
mvwgetn_wstr getstr
mvwget_wch getch
mvwget_wstr getstr
mvwhline_set border
mvwinnwstr instr
mvwins_nwstr insstr
mvwins_wch insch
mvwins_wstr insstr
mvwin_wch inch
mvwin_wchnstr inchstr
mvwin_wchstr inchstr
mvwinwstr instr
mvwvline_set border
pecho_wchar pad
setcchar util
slk_wset slk
unget_wch getch
vline_set border
waddnwstr addstr
waddwstr addstr
wadd_wch addch
wadd_wchnstr addchstr
wadd_wchstr addchstr
wbkgrnd bkgd
wbkgrndset bkgd
wborder_set border
wecho_wchar addch
wgetbkgrnd bkgd
wgetn_wstr getstr
wget_wch getch
wget_wstr getstr
whline_set border
winnwstr instr
wins_nwstr insstr
wins_wch insch
wins_wstr insstr
winwstr instr
win_wch inch
win_wchnstr inchstr
win_wchstr inchstr
wunctrl util
wvline_set border
Quasi-standard functions, from Sys V or BSD curses:
getattrs attr
getbegx getyx
getbegy getyx
getmaxx getyx
getmaxy getyx
getparx getyx
getparx getyx
traceoff debug
traceon debug
unctrl util
Classic PDCurses mouse functions, based on Sys V:
mouse_set mouse
mouse_on mouse
mouse_off mouse
request_mouse_pos mouse
map_button mouse
wmouse_position mouse
getmouse mouse
getbmap mouse
Functions from ncurses:
assume_default_colors color
curses_version initscr
has_key keyname
use_default_colors color
wresize window
mouseinterval mouse
mousemask mouse
mouse_trafo mouse
nc_getmouse mouse
ungetmouse mouse
wenclose mouse
wmouse_trafo mouse
PDCurses-specific functions -- avoid these in code that's intended to be
portable:
addrawch addch
insrawch insch
is_termresized initscr
mvaddrawch addch
mvdeleteln deleteln
mvinsertln deleteln
mvinsrawch insch
mvwaddrawch addch
mvwdeleteln deleteln
mvwinsertln deleteln
mvwinsrawch insch
raw_output outopts
resize_term initscr
resize_window window
slk_wlabel slk
waddrawch addch
winsrawch insch
wordchar termattr
PDC_debug debug
PDC_ungetch getch
PDC_set_blink pdcsetsc
PDC_set_line_color color
PDC_set_title pdcsetsc
PDC_clearclipboard pdcclip
PDC_freeclipboard pdcclip
PDC_getclipboard pdcclip
PDC_setclipboard pdcclip
PDC_get_input_fd pdckbd
PDC_get_key_modifiers getch
PDC_return_key_modifiers getch
PDC_save_key_modifiers getch
Functions specific to the X11 port of PDCurses:
Xinitscr initscr
XCursesExit -
sb_init sb
sb_set_horz sb
sb_set_vert sb
sb_get_horz sb
sb_get_vert sb
sb_refresh sb
--------------------------------------------------------------------------

View File

@@ -0,0 +1,119 @@
/***********************************************************************/
/* MANEXT - Extract manual pages from C source code. */
/***********************************************************************/
/*
* MANEXT - A program to extract manual pages from C source code.
* Copyright (C) 1991-1996 Mark Hessling
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* If you make modifications to this software that you feel increases
* it usefulness for the rest of the community, please email the
* changes, enhancements, bug fixes as well as any and all ideas to me.
* This software is going to be maintained and enhanced as deemed
* necessary by the community.
*
* Mark Hessling <mark@rexx.org>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LINE 255
void display_info()
{
fprintf(stderr, "\nMANEXT 1.03 Copyright (C) 1991-1996 Mark Hessling\n"
"All rights reserved.\n"
"MANEXT is distributed under the terms of the GNU\n"
"General Public License and comes with NO WARRANTY.\n"
"See the file COPYING for details.\n"
"\nUsage: manext sourcefile [...]\n\n");
}
int main(int argc, char **argv)
{
char s[MAX_LINE + 1]; /* input line */
int i;
FILE *fp;
#ifdef __EMX__
_wildcard(&argc, &argv);
#endif
if (strcmp(argv[1], "-h") == 0)
{
display_info();
exit(1);
}
for (i = 1; i < argc; i++)
{
if ((fp = fopen(argv[i], "r")) == NULL)
{
fprintf(stderr, "\nCould not open %s\n", argv[i]);
continue;
}
while (!feof(fp))
{
if (fgets(s, (int)sizeof(s), fp) == NULL)
{
if (ferror(fp) != 0)
{
fprintf(stderr, "*** Error reading %s. Exiting.\n",
argv[i]);
exit(1);
}
break;
}
/* check for manual entry marker at beginning of line */
if (strncmp(s, "/*man-start*", 12) != 0)
continue;
/* inner loop */
for (;;)
{
/* read next line of manual entry */
if (fgets(s, (int)sizeof(s), fp) == NULL)
{
if (ferror(fp) != 0)
{
fprintf(stderr, "*** Error reading %s. Exiting.\n",
argv[i]);
exit(1);
}
break;
}
/* check for end of entry marker */
if (strncmp(s, "**man-end", 9) == 0)
break;
printf("%s", s);
}
printf("\n\n-----------------------------------"
"---------------------------------------\n\n");
}
fclose(fp);
}
return 0;
}

View File

@@ -0,0 +1,152 @@
SDL Considerations
==================
There are no special requirements to use PDCurses for SDL -- all
PDCurses-compatible code should work fine. (In fact, you can even build
against the Win32 console pdcurses.dll, and then swap in the SDL
pdcurses.dll.) Nothing extra is needed beyond the base SDL library.
However, there are some optional special features, described here.
The principal limitation of this port is that input is currently
restricted to ASCII (i.e., 0-127), plus the special keys like KEY_LEFT.
(You could have Unicode input, but then the input wouldn't match the
output, which is in Code Page 437.) Also, see the note about the
potential for incomplete output under "PDC_update_rects()", below.
Fonts
-----
The font is a simple BMP, 32 characters wide by 8 characters tall,
preferably with a palette. (BMPs without palettes still work, but in
that case, no attributes will be available, nor will the cursor work.)
The first entry in the palette (usually black) is treated as the
background color; the last entry (usually white) is treated as the
foreground. These are changed or made transparent as appropriate; any
other colors in the palette are passed through unchanged. So -- although
a one-bit depth is sufficient for a normal font -- you could redraw some
characters as multi-colored tiles.
The font must be monospaced. The size of each character is derived by
dividing the width of the BMP by 32 and the height by 8. There is no
constraint on the dimensions.
As provided in the default font and expected by acs_map[], the font is
in Code Page 437 form. But you can of course use any layout if you're
not relying on correct values for the ACS_* macros.
The font can be set via the environment variable PDC_FONT. If it's not
set, PDCurses looks for a file named "pdcfont.bmp" in the current
directory at the time of initscr(). If neither is found, it uses the
built-in default font encoded in deffont.h.
Backgrounds
-----------
PDCurses for SDL supports an optional background image BMP. This is used
whenever start_color() has not been called (see the ptest demo for an
example), or when use_default_colors() has been called after
start_color(), and the background color of a pair has been set to -1
(see newdemo, worm, and rain for examples). The usage parallels that of
ncurses in an appropriate terminal (e.g., Gnome Terminal). The image is
tiled to cover the PDCurses window, and can be any size or depth.
As with the font, you can point to a location for the background via the
environment variable PDC_BACKGROUND; "pdcback.bmp" is the fallback.
(There is no default background.)
Icons
-----
The icon (used with SDL_WM_SetIcon() -- not used for the executable
file) can be set via the environment variable PDC_ICON, and falls back
to "pdcicon.bmp", and then to the built-in icon from deficon.h. The
built-in icon is the PDCurses logo, as seen in ../x11/little_icon.xbm.
The SDL docs say that the icon must be 32x32, at least for use with MS
Windows.
If pdc_screen is preinitialized (see below), PDCurses does not attempt
to set the icon.
Screen size
-----------
The default screen size is 80x25 characters (whatever size they may be),
but you can override this via the environment variables PDC_COLS and/or
PDC_LINES. (Some other ports use COLS and LINES; this is not done here
because those values are, or should be, those of the controlling
terminal, and PDCurses for SDL is independent of the terminal.) If
pdc_screen is preinitialized (see below), these are ignored.
Integration with SDL
--------------------
If you want to go further, you can mix PDCurses and SDL functions. (Of
course this is extremely non-portable!) To aid you, there are several
external variables and functions specific to the SDL port; you could
include pdcsdl.h, or just add the declarations you need in your code:
PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back;
PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset;
void PDC_update_rects(void);
void PDC_retile(void);
pdc_screen is the main surface, created by SDL_SetVideoMode(), unless
it's preset before initscr(). You can perform normal SDL operations on
this surface, but PDCurses won't respect them when it updates. (For
that, see PDC_retile().) As an alternative, you can preinitialize this
surface before calling initscr(). In that case, you can use pdc_sheight,
pdc_swidth, pdc_yoffset and/or pdc_xoffset (q.v.) to confine PDCurses to
only a specific area of the surface, reserving the rest for other SDL
operations. If you preinitialize pdc_screen, you'll have to close it
yourself; PDCurses will ignore resize events, and won't try to set the
icon. Also note that if you preinitialize pdc_screen, it need not be the
display surface.
pdc_font, pdc_icon, and pdc_back are the SDL_surfaces for the font,
icon, and background, respectively. You can set any or all of them
before initscr(), and thus override any of the other ways to set them.
But note that pdc_icon will be ignored if pdc_screen is preset.
pdc_sheight and pdc_swidth are the dimensions of the area of pdc_screen
to be used by PDCurses. You can preset them before initscr(); if either
is not set, it defaults to the full screen size minus the x or y offset,
as appropriate.
pdc_xoffset and pdc_yoffset are the x and y offset for the area of
pdc_screen to be used by PDCurses. See the sdltest demo for an example.
PDC_retile() makes a copy of pdc_screen, then tiles it with the
background image, if any. The resulting surface is used as the
background for transparent character cells. PDC_retile() is called from
initscr() and resize_term(). However, you can also use it at other
times, to take advantage of the way it copies pdc_screen: Draw some SDL
stuff; call PDC_retile(); do some curses stuff -- it will use whatever
was on pdc_screen as the background. Then you can erase the curses
screen, do some more SDL stuff, and call PDC_retile() again to make a
new background. (If you don't erase the curses screen, it will be
incorporated into the background when you call PDC_retile().) But this
only works if no background image is set.
PDC_update_rects() is how the screen actually gets updated. For
performance reasons, when drawing, PDCurses for SDL maintains a table of
rectangles that need updating, and only updates (by calling this
function) during getch(), napms(), or when the table gets full.
Normally, this is sufficient; but if you're pausing in some way other
than by using napms(), and you're not doing keyboard checks, you may get
an incomplete update. If that happens, you can call PDC_update_rects()
manually.
Interaction with stdio
----------------------
As with X11, it's a bad idea to mix curses and stdio calls. (In fact,
that's true for PDCurses on any platform; but especially these two,
which don't run under terminals.) Depending on how SDL is built, stdout
and stderr may be redirected to files.

View File

@@ -0,0 +1,416 @@
X11 Considerations
==================
PDCurses for X11 uses the System V IPC shared memory facility, along
with sockets, to share data between the curses program and the child
process created to manage the X stuff.
When compiling your application, you need to include the <curses.h> or
<xcurses.h> that comes with PDCurses. You also need to link your code
with libXCurses. You may need to link with the following libraries under
X11R5:
Xaw Xmu Xt X11
or, under X11R6:
Xaw Xmu Xt X11 SM ICE Xext
You can run "xcurses-config --libs" to show the link parameters for your
system. If using dynamic linking, on some systems, "-lXCurses" suffices.
By calling Xinitscr() rather than initscr(), you can pass your program
name and resource overrides to PDCurses. The program name is used as the
title of the X window, and for defining X resources specific to your
program.
Interaction with stdio
----------------------
Be aware that curses programs that expect to have a normal tty
underneath them will be very disappointed! Output directed to stdout
will go to the xterm that invoked the PDCurses application, or to the
console if not invoked directly from an xterm. Similarly, stdin will
expect its input from the same place as stdout.
X Resources
-----------
PDCurses for X11 recognizes the following resources:
lines
cols
normalFont
italicFont
pointer
pointerForeColor
pointerBackColor
cursorColor
textCursor
colorBlack
colorRed
colorGreen
colorYellow
colorBlue
colorMagenta
colorCyan
colorWhite
colorBoldBlack
colorBoldRed
colorBoldGreen
colorBoldYellow
colorBoldBlue
colorBoldMagenta
colorBoldCyan
colorBoldWhite
bitmap
pixmap
translations
shmmin
borderWidth
borderColor
clickPeriod
doubleClickPeriod
composeKey
lines: Specifies the number of lines the "screen" will have.
Directly equates to LINES.
There is no theoretical maximum.
The minimum value must be 2.
Default: 24
cols: Specifies the number of columns the "screen" will have.
Directly equates to COLS.
There is no theoretical maximum.
The minimum value must be 2.
Default: 80
normalFont: The name of a fixed width font.
Default: 7x13
italicFont: The name of a fixed width font to be used for
characters with A_ITALIC attributes. Must have the
same cell size as normalFont.
Default: 7x13 (obviously not an italic font)
pointer: The name of a valid pointer cursor.
Default: xterm
pointerForeColor: The foreground color of the pointer.
Default: black
pointerBackColor: The background color of the pointer.
Default: white
textCursor: The alignment of the text cursor; horizontal or vertical.
Default: horizontal
colorBlack: The color of the COLOR_BLACK attribute.
Default: Black
colorRed: The color of the COLOR_RED attribute.
Default: red3
colorGreen: The color of the COLOR_GREEN attribute.
Default: green3
colorYellow: The color of the COLOR_YELLOW attribute.
Default: yellow3
colorBlue: The color of the COLOR_BLUE attribute.
Default: blue3
colorMagenta: The color of the COLOR_MAGENTA attribute.
Default: magenta3
colorCyan: The color of the COLOR_CYAN attribute.
Default: cyan3
colorWhite: The color of the COLOR_WHITE attribute.
Default: Grey
colorBoldBlack: COLOR_BLACK combined with A_BOLD.
Default: grey40
colorBoldRed: COLOR_RED combined with A_BOLD.
Default: red1
colorBoldGreen: COLOR_GREEN combined with A_BOLD.
Default: green1
colorBoldYellow: COLOR_YELLOW combined with A_BOLD.
Default: yellow1
colorBoldBlue: COLOR_BLUE combined with A_BOLD.
Default: blue1
colorBoldMagenta: COLOR_MAGENTA combined with A_BOLD.
Default: magenta1
colorBoldCyan: COLOR_CYAN combined with A_BOLD.
Default: cyan1
colorBoldWhite: COLOR_WHITE combined with A_BOLD.
Default: White
bitmap: The name of a valid bitmap file of depth 1 (black and white)
used for the application's icon. The file is an X bitmap.
Default: a 32x32 or 64x64 pixmap depending on the
window manager
pixmap: The name of a valid pixmap file of any depth
supported by the window manager (color) for the
application's icon, The file is an X11 pixmap. This
resource is only available if the libXpm package has
been installed (most systems have this by default).
This resource overrides the "bitmap" resource.
Default: none, uses default bitmap above
translations: Translations enable the user to customize the action
that occurs when a key, combination of keys, or a
button is pressed. The translations are similar to
those used by xterm.
Defaults:
<Key>: XCursesKeyPress()
<KeyUp>: XCursesKeyPress()
<BtnDown>: XCursesButton()
<BtnUp>: XCursesButton()
<BtnMotion>: XCursesButton()
The most useful action for KeyPress translations is
string(). The argument to the string() action can be
either a string or a hex representation of a
character; e.g., string(0x1b) will send the ASCII
escape character to the application; string("[11~")
will send [ 1 1 ~ , as separate keystrokes.
shmmin: On most systems, there are two Unix kernel parameters
that determine the allowable size of a shared memory
segment. These parameters are usually something like
SHMMIN and SHMMAX. To use shared memory, a program
must allocate a segment of shared memory that is
between these two values. Usually these values are
like 1 for SHMMIN and some large number for SHMMAX.
Sometimes the Unix kernel is configured to have a
value of SHMMIN that is bigger than the size of one
of the shared memory segments that libXCurses uses.
On these systems an error message like:
Cannot allocate shared memory for SCREEN: Invalid argument
will result. To overcome this problem, this resource
should be set to the kernel value for SHMMIN. This
ensures that a shared memory segment will always be
bigger than the kernel value for SHMMIN (and
hopefully less than SHMMAX!)
Default: 0
borderColor: The color of the border around the screen.
Default: black
borderWidth: The width in pixels of the border around the screen.
Default: 0
clickPeriod: The period (in milliseconds) between a button
press and a button release that determines if a click
of a button has occurred.
Default: 100
doubleClickPeriod: The period (in milliseconds) between two button
press events that determines if a double click
of a button has occurred.
Default: 200
composeKey: The name of the X key that defines the "compose key",
which is used to enter characters in the Latin-1
character set above 0xA0. (See "Compose Keys for
Latin-1" below.) This is used only when PDCurses is
built without XIM support. While in compose mode, the
text cursor will appear as a hollow rectangle.
Default: Multi_key
Using Resources
---------------
All applications have a top-level class name of "XCurses". If Xinitscr()
is used, it sets an application's top-level widget name. (Otherwise the
name defaults to "PDCurses".)
Examples for app-defaults or .Xdefaults:
!
! resources for XCurses class of programs
!
XCurses*lines: 30
XCurses*cols: 80
XCurses*normalFont: 9x13
XCurses*bitmap: /tmp/xcurses.xbm
XCurses*pointer: top_left_arrow
!
! resources for testcurs - XCurses
!
testcurs.colorRed: orange
testcurs.colorBlack: midnightblue
testcurs.lines: 25
*testcurs.Translations: #override \n \
<Key>F12: string(0x1b) string("[11~") \n
!
! resources for THE - XCurses
!
! resources with the * wildcard can be overridden by a parameter passed
! to initscr()
!
the*normalFont: 9x15
the*lines: 40
the*cols: 86
the*pointer: xterm
the*pointerForeColor: white
the*pointerBackColor: black
!
! resources with the . format can not be overridden by a parameter passed
! to Xinitscr()
!
the.bitmap: /home/mark/the/the64.xbm
the.pixmap: /home/mark/the/the64.xpm
Resources may also be passed as parameters to the Xinitscr() function.
Parameters are strings in the form of switches; e.g., to set the color
"red" to "indianred", and the number of lines to 30, the string passed
to Xinitscr would be: "-colorRed indianred -lines 30"
Compose Keys for Latin-1
------------------------
When built without XIM support, PDCurses for X11 provides its own,
limited compose key system for Latin-1 characters. The available
combinations are listed here. For a given character, any of the
combinations shown in the last column may be used. To generate a
character, press the "compose" key followed by one of the pairs of
keystrokes. Where no key is evident, the spacebar is used. Thus, to
generate the NO-BREAK SPACE, press the "compose" key followed by two
hits of the spacebar.
With a typical modern X server, you can get many more compose key
combinations by using XIM instead. Configure PDCurses with --enable-xim
to use XIM support.
This document is encoded in UTF-8.
+----+-----+---+---------------------------------+---------------------------+
|Hex | Dec |Chr| Description ISO 10646-1:1993(E) | Compose key combinations |
+----+-----+---+---------------------------------+---------------------------+
| A0 | 160 | | NO-BREAK SPACE | |
| A1 | 161 | ¡ | INVERTED EXCLAMATION MARK | ! !! |
| A2 | 162 | ¢ | CENT SIGN | c| |c c/ c$ C$ C| |
| A3 | 163 | £ | POUND SIGN | L- L$ L= l- l$ l= |-|
| A4 | 164 | ¤ | CURRENCY SIGN | xo ox XO g$ |
| A5 | 165 | ¥ | YEN SIGN | =y y= =Y Y= Y- y$ y-|
| A6 | 166 | ¦ | BROKEN BAR | | || vb VB |^ |
| A7 | 167 | § | SECTION SIGN | SO SS s! S! so |
| A8 | 168 | ¨ | DIAERESIS | " "" |
| A9 | 169 | © | COPYRIGHT SIGN | CO co OC |
| AA | 170 | ª | FEMININE ORDINAL INDICATOR | sa SA a_ A_ |
| AB | 171 | « | LEFT DOUBLE ANGLE QUOTES | << |
| AC | 172 | ¬ | NOT SIGN | -, no NO |
| AD | 173 | ­ | SOFT HYPHEN | - -- |
| AE | 174 | ® | REGISTERED SIGN | RO ro OR |
| AF | 175 | ¯ | MACRON | -^ _^ __ |
| B0 | 176 | ° | DEGREE SIGN | o 0^ 0* de DE ^0 |
| B1 | 177 | ± | PLUS-MINUS SIGN | -+ +- |
| B2 | 178 | ² | SUPERSCRIPT TWO | 2 2^ s2 ^2 |
| B3 | 179 | ³ | SUPERSCRIPT THREE | 3 3^ s3 ^3 |
| B4 | 180 | ´ | ACUTE ACCENT | ' '' |
| B5 | 181 | µ | MICRO SIGN | u /u /U *m *M |
| B6 | 182 | ¶ | PILCROW SIGN | p! P! pg PG |
| B7 | 183 | · | MIDDLE DOT | . .^ .. |
| B8 | 184 | ¸ | CEDILLA | , ,, |
| B9 | 185 | ¹ | SUPERSCRIPT ONE | 1 1^ s1 ^1 |
| BA | 186 | º | MASCULINE ORDINAL INDICATOR | o_ s0 S0 |
| BB | 187 | » | RIGHT DOUBLE ANGLE QUOTES | >> |
| BC | 188 | ¼ | VULGAR FRACTION ONE QUARTER | 14 |
| BD | 189 | ½ | VULGAR FRACTION ONE HALF | 12 |
| BE | 190 | ¾ | VULGAR FRACTION THREE QUARTERS | 34 |
| BF | 191 | ¿ | INVERTED QUESTION MARK | ? ?? |
| C0 | 192 | À | CAPITAL A WITH GRAVE ACCENT | `A A` |
| C1 | 193 | Á | CAPITAL A WITH ACUTE ACCENT | 'A A' |
| C2 | 194 | Â | CAPITAL A WITH CIRCUMFLEX ACCENT| ^A A^ A> |
| C3 | 195 | Ã | CAPITAL A WITH TILDE | ~A A~ A- |
| C4 | 196 | Ä | CAPITAL A WITH DIAERESIS | "A A" |
| C5 | 197 | Å | CAPITAL A WITH RING ABOVE | oA Ao A* OA *A |
| C6 | 198 | Æ | CAPITAL LIGATURE AE | AE |
| C7 | 199 | Ç | CAPITAL C WITH CEDILLA | ,C C, |
| C8 | 200 | È | CAPITAL E WITH GRAVE ACCENT | `E E` |
| C9 | 201 | É | CAPITAL E WITH ACUTE ACCENT | 'E E' |
| CA | 202 | Ê | CAPITAL E WITH CIRCUMFLEX ACCENT| ^E E^ E> |
| CB | 203 | Ë | CAPITAL E WITH DIAERESIS | "E E" |
| CC | 204 | Ì | CAPITAL I WITH GRAVE ACCENT | `I I` |
| CD | 205 | Í | CAPITAL I WITH ACUTE ACCENT | 'I I' |
| CE | 206 | Î | CAPITAL I WITH CIRCUMFLEX ACCENT| ^I I^ I> |
| CF | 207 | Ï | CAPITAL I WITH DIAERESIS | "I I" |
| D0 | 208 | Ð | CAPITAL ETH | D- |
| D1 | 209 | Ñ | CAPITAL N WITH TILDE | ~N N~ N- |
| D2 | 210 | Ò | CAPITAL O WITH GRAVE ACCENT | `O O` |
| D3 | 211 | Ó | CAPITAL O WITH ACUTE ACCENT | 'O O' |
| D4 | 212 | Ô | CAPITAL O WITH CIRCUMFLEX ACCENT| ^O O^ O> |
| D5 | 213 | Õ | CAPITAL O WITH TILDE | ~O O~ O- |
| D6 | 214 | Ö | CAPITAL O WITH DIAERESIS | "O O" |
| D7 | 215 | × | MULTIPLICATION SIGN | x xx XX mu MU |
| D8 | 216 | Ø | CAPITAL O WITH STROKE | /O O/ |
| D9 | 217 | Ù | CAPITAL U WITH GRAVE ACCENT | `U U` |
| DA | 218 | Ú | CAPITAL U WITH ACUTE ACCENT | 'U U' |
| DB | 219 | Û | CAPITAL U WITH CIRCUMFLEX ACCENT| ^U U^ U> |
| DC | 220 | Ü | CAPITAL U WITH DIAERESIS | "U U" |
| DD | 221 | Ý | CAPITAL Y WITH ACUTE ACCENT | 'Y Y' |
| DE | 222 | Þ | CAPITAL THORN | P TH |P |
| DF | 223 | ß | SMALL SHARP S | ss |
| E0 | 224 | à | SMALL A WITH GRAVE ACCENT | `a a` |
| E1 | 225 | á | SMALL A WITH ACUTE ACCENT | 'a a' |
| E2 | 226 | â | SMALL A WITH CIRCUMFLEX ACCENT | ^a a^ a> |
| E3 | 227 | ã | SMALL A WITH TILDE | ~a a~ a- |
| E4 | 228 | ä | SMALL A WITH DIAERESIS | "a a" |
| E5 | 229 | å | SMALL A WITH RING ABOVE | oa ao Oa a* *a |
| E6 | 230 | æ | SMALL LIGATURE AE | ae |
| E7 | 231 | ç | SMALL C WITH CEDILLA | ,c c, |
| E8 | 232 | è | SMALL E WITH GRAVE ACCENT | `e e` |
| E9 | 233 | é | SMALL E WITH ACUTE ACCENT | 'e e' |
| EA | 234 | ê | SMALL E WITH CIRCUMFLEX ACCENT | ^e e^ e> |
| EB | 235 | ë | SMALL E WITH DIAERESIS | "e e" |
| EC | 236 | ì | SMALL I WITH GRAVE ACCENT | `i i` |
| ED | 237 | í | SMALL I WITH ACUTE ACCENT | 'i i' |
| EE | 238 | î | SMALL I WITH CIRCUMFLEX ACCENT | ^i i^ i> |
| EF | 239 | ï | SMALL I WITH DIAERESIS | "i i" |
| F0 | 240 | ð | SMALL ETH | d- |
| F1 | 241 | ñ | SMALL N WITH TILDE | ~n n~ n- |
| F2 | 242 | ò | SMALL O WITH GRAVE ACCENT | `o o` |
| F3 | 243 | ó | SMALL O WITH ACUTE ACCENT | 'o o' |
| F4 | 244 | ô | SMALL O WITH CIRCUMFLEX ACCENT | ^o o^ o> |
| F5 | 245 | õ | SMALL O WITH TILDE | ~o o~ o- |
| F6 | 246 | ö | SMALL O WITH DIAERESIS | "o o" |
| F7 | 247 | ÷ | DIVISION SIGN | -: :- |
| F8 | 248 | ø | SMALL O WITH OBLIQUE BAR | /o o/ |
| F9 | 249 | ù | SMALL U WITH GRAVE ACCENT | `u u` |
| FA | 250 | ú | SMALL U WITH ACUTE ACCENT | 'u u' |
| FB | 251 | û | SMALL U WITH CIRCUMFLEX ACCENT | ^u u^ u> |
| FC | 252 | ü | SMALL U WITH DIAERESIS | "u u" |
| FD | 253 | ý | SMALL Y WITH ACUTE ACCENT | 'y y' |
| FE | 254 | þ | SMALL THORN | p th |p |
| FF | 255 | ÿ | SMALL Y WITH DIAERESIS | "y y" |
+----+-----+---+---------------------------------+---------------------------+
Deprecated
----------
XCursesProgramName is no longer used. To set the program name, you must
use Xinitscr(), or PDC_set_title() to set just the window title.
The XCursesExit() function is now called automatically via atexit().
(Multiple calls to it are OK, so you don't need to remove it if you've
already added it for previous versions of PDCurses.)
XCURSES is no longer defined automatically, but need not be defined,
unless you want the X11-specific prototypes. (Normal curses programs
won't need it.)