#define BUTTON3_TRIPLE_CLICKED 0x00004000L
#define BUTTON3_MOVED 0x00004000L /* PDCurses */
-/* For the ncurses-compatible functions only, BUTTON4_PRESSED and
- BUTTON5_PRESSED are returned for mouse scroll wheel up and down;
+/* For the ncurses-compatible functions only, BUTTON4_PRESSED and
+ BUTTON5_PRESSED are returned for mouse scroll wheel up and down;
otherwise PDCurses doesn't support buttons 4 and 5 */
#define BUTTON4_RELEASED 0x00008000L
struct _win *_parent; /* subwin's pointer to parent win */
} WINDOW;
-/* Avoid using the SCREEN struct directly -- use the corresponding
+/* Avoid using the SCREEN struct directly -- use the corresponding
functions if possible. This struct may eventually be made private. */
typedef struct
unsigned long _trap_mbe; /* trap these mouse button events */
unsigned long _map_mbe_to_key; /* map mouse buttons to slk */
int mouse_wait; /* time to wait (in ms) for a
- button release after a press, in
+ button release after a press, in
order to count it as a click */
int slklines; /* lines in use by slk_init() */
WINDOW *slk_winptr; /* window for slk */
int linesrippedoff; /* lines ripped off via ripoffline() */
- int linesrippedoffontop; /* lines ripped off on
+ int linesrippedoffontop; /* lines ripped off on
top via ripoffline() */
int delaytenths; /* 1/10ths second to wait block
getch() for */
PDCurses Text Attributes
========================
-Originally, PDCurses used a short (16 bits) for its chtype. To include
-color, a number of things had to be sacrificed from the strict Unix and
-System V support. The main problem was fitting all character attributes
+Originally, PDCurses used a short (16 bits) for its chtype. To include
+color, a number of things had to be sacrificed from the strict Unix and
+System V support. The main problem was fitting all character attributes
and color into an unsigned char (all 8 bits!).
-Today, PDCurses by default uses a long (32 bits) for its chtype, as in
-System V. The short chtype is still available, by undefining CHTYPE_LONG
+Today, PDCurses by default uses a long (32 bits) for its chtype, as in
+System V. The short chtype is still available, by undefining CHTYPE_LONG
and rebuilding the library.
The following is the structure of a win->_attrs chtype:
-------------------------------------------------
color number | attrs | character eg 'a'
-The available non-color attributes are bold, reverse and blink. Others
-have no effect. The high order char is an index into an array of
-physical colors (defined in color.c) -- 32 foreground/background color
+The available non-color attributes are bold, reverse and blink. Others
+have no effect. The high order char is an index into an array of
+physical colors (defined in color.c) -- 32 foreground/background color
pairs (5 bits) plus 3 bits for other attributes.
long form:
----------------------------------------------------------------------------
color number | modifiers | character eg 'a'
-The available non-color attributes are bold, underline, invisible,
-right-line, left-line, protect, reverse and blink. 256 color pairs (8
+The available non-color attributes are bold, underline, invisible,
+right-line, left-line, protect, reverse and blink. 256 color pairs (8
bits), 8 bits for other attributes, and 16 bits for character data.
**man-end****************************************************************/
#define ATR_MSK A_ATTRIBUTES /* Obsolete */
#define ATR_NRM A_NORMAL /* Obsolete */
-/* For use with attr_t -- X/Open says, "these shall be distinct", so
+/* For use with attr_t -- X/Open says, "these shall be distinct", so
this is a non-conforming implementation. */
#define WA_ALTCHARSET A_ALTCHARSET
/*** Alternate character set macros ***/
/* 'w' = 32-bit chtype; acs_map[] index | A_ALTCHARSET
- 'n' = 16-bit chtype; it gets the fallback set because no bit is
+ 'n' = 16-bit chtype; it gets the fallback set because no bit is
available for A_ALTCHARSET */
#ifdef CHTYPE_LONG
int border(chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype);
int box(WINDOW *, chtype, chtype);
bool can_change_color(void);
-int cbreak(void);
+int cbreak(void);
int chgat(int, attr_t, short, const void *);
int clearok(WINDOW *, bool);
int clear(void);
int delay_output(int);
int delch(void);
int deleteln(void);
-void delscreen(SCREEN *);
+void delscreen(SCREEN *);
int delwin(WINDOW *);
WINDOW *derwin(WINDOW *, int, int, int, int);
int doupdate(void);
int add_wch(const cchar_t *);
int add_wchnstr(const cchar_t *, int);
int add_wchstr(const cchar_t *);
-int border_set(const cchar_t *, const cchar_t *, const cchar_t *,
- const cchar_t *, const cchar_t *, const cchar_t *,
+int border_set(const cchar_t *, const cchar_t *, const cchar_t *,
+ const cchar_t *, const cchar_t *, const cchar_t *,
const cchar_t *, const cchar_t *);
int box_set(WINDOW *, const cchar_t *, const cchar_t *);
int echo_wchar(const cchar_t *);
int wbkgrnd(WINDOW *, const cchar_t *);
void wbkgrndset(WINDOW *, const cchar_t *);
int wborder_set(WINDOW *, const cchar_t *, const cchar_t *,
- const cchar_t *, const cchar_t *, const cchar_t *,
+ const cchar_t *, const cchar_t *, const cchar_t *,
const cchar_t *, const cchar_t *, const cchar_t *);
int wecho_wchar(WINDOW *, const cchar_t *);
int wgetbkgrnd(WINDOW *, cchar_t *);
seed = time((time_t *)0);
srand(seed);
flag = 0;
-
+
while (getch() == ERR) /* loop until a key is hit */
{
do {
/*
- * newdemo.c - A demo program using PDCurses. The program
+ * newdemo.c - A demo program using PDCurses. The program
* illustrates the use of colors for text output.
*
* Hacks by jbuhler@cs.washington.edu on 12/29/96
#endif
noecho();
- /* refresh stdscr so that reading from it will not cause it to
+ /* refresh stdscr so that reading from it will not cause it to
overwrite the other windows that are being created */
refresh();
wattrset(win, COLOR_PAIR(2));
box(win, ' ', ' ');
wrefresh(win);
-
+
wattrset(win, 0);
/* Do random output of a character */
long nap_msec = 1;
-char *mod[] =
+char *mod[] =
{
"test ", "TEST ", "(**) ", "*()* ", "<--> ", "LAST "
};
char num = *((char *)pan->user + 1);
int y, x, maxy, maxx;
- box(win, 0, 0);
+ box(win, 0, 0);
mvwprintw(win, 1, 1, "-pan%c-", num);
getmaxyx(win, maxy, maxx);
sw = w / 3;
sh = h / 3;
- if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2))
+ if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2))
== NULL)
return;
else if (BUTTON_CHANGED(3))
button = 3;
- if (button && (BUTTON_STATUS(button) &
+ if (button && (BUTTON_STATUS(button) &
BUTTON_MODIFIER_MASK))
{
waddstr(win, " Modifier(s):");
-
+
if (BUTTON_STATUS(button) & BUTTON_SHIFT)
waddstr(win, " SHIFT");
wmove(win1, 8, 26);
wrefresh(win1);
wgetch(win1);
-
+
wclear(win1);
wattron(win1, A_BLINK);
"ACS_LARROW", "ACS_RARROW", "ACS_UARROW", "ACS_DARROW",
"ACS_BOARD", "ACS_LANTERN", "ACS_BLOCK"
#ifdef ACS_S3
- , "ACS_S3", "ACS_S7", "ACS_LEQUAL", "ACS_GEQUAL",
+ , "ACS_S3", "ACS_S7", "ACS_LEQUAL", "ACS_GEQUAL",
"ACS_PI", "ACS_NEQUAL", "ACS_STERLING"
#endif
};
#if HAVE_WIDE
cchar_t *wacs_values[] =
{
- WACS_ULCORNER, WACS_URCORNER, WACS_LLCORNER, WACS_LRCORNER,
- WACS_LTEE, WACS_RTEE, WACS_TTEE, WACS_BTEE, WACS_HLINE,
+ WACS_ULCORNER, WACS_URCORNER, WACS_LLCORNER, WACS_LRCORNER,
+ WACS_LTEE, WACS_RTEE, WACS_TTEE, WACS_BTEE, WACS_HLINE,
WACS_VLINE, WACS_PLUS,
- WACS_S1, WACS_S9, WACS_DIAMOND, WACS_CKBOARD, WACS_DEGREE,
+ WACS_S1, WACS_S9, WACS_DIAMOND, WACS_CKBOARD, WACS_DEGREE,
WACS_PLMINUS, WACS_BULLET,
- WACS_LARROW, WACS_RARROW, WACS_UARROW, WACS_DARROW, WACS_BOARD,
+ WACS_LARROW, WACS_RARROW, WACS_UARROW, WACS_DARROW, WACS_BOARD,
WACS_LANTERN, WACS_BLOCK
# ifdef WACS_S3
- , WACS_S3, WACS_S7, WACS_LEQUAL, WACS_GEQUAL, WACS_PI,
+ , WACS_S3, WACS_S7, WACS_LEQUAL, WACS_GEQUAL, WACS_PI,
WACS_NEQUAL, WACS_STERLING
# endif
};
static const wchar_t greek[] = {0x0395, 0x03bb, 0x03bb, 0x03b7,
0x03bd, 0x03b9, 0x03ba, 0x03ac, 0};
- static const wchar_t georgian[] = {0x10e5, 0x10d0, 0x10e0, 0x10d7,
+ static const wchar_t georgian[] = {0x10e5, 0x10d0, 0x10e0, 0x10d7,
0x10e3, 0x10da, 0x10d8, L' ', 0x10d4, 0x10dc, 0x10d0, 0};
#endif
{
static const short colors[] =
{
- COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE,
+ COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE,
COLOR_CYAN, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE
};
static const char *colornames[] =
{
- "COLOR_BLACK", "COLOR_RED", "COLOR_GREEN", "COLOR_BLUE",
+ "COLOR_BLACK", "COLOR_RED", "COLOR_GREEN", "COLOR_BLUE",
"COLOR_CYAN", "COLOR_MAGENTA", "COLOR_YELLOW", "COLOR_WHITE"
};
#ifndef PDCURSES
static char wordchar(void)
{
- return 0x17; /* ^W */
+ return 0x17; /* ^W */
}
#endif
/* foreground, background */
- init_pair(TITLECOLOR & ~A_ATTR, COLOR_BLACK, COLOR_CYAN);
- init_pair(MAINMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
+ init_pair(TITLECOLOR & ~A_ATTR, COLOR_BLACK, COLOR_CYAN);
+ init_pair(MAINMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
init_pair(MAINMENUREVCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK);
- init_pair(SUBMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
- init_pair(SUBMENUREVCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK);
- init_pair(BODYCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLUE);
- init_pair(STATUSCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
+ init_pair(SUBMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
+ init_pair(SUBMENUREVCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK);
+ init_pair(BODYCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLUE);
+ init_pair(STATUSCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
init_pair(INPUTBOXCOLOR & ~A_ATTR, COLOR_BLACK, COLOR_CYAN);
init_pair(EDITBOXCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK);
#endif
#endif
wbkgd(win, attr);
- werase(win);
+ werase(win);
#ifdef PDCURSES
maxy = getmaxy(win);
tp->tm_hour, tp->tm_min, tp->tm_sec);
mvwaddstr(wtitl, 0, bw - strlen(buf) - 2, buf);
- wrefresh(wtitl);
+ wrefresh(wtitl);
}
static void menudim(menu *mp, int *lines, int *columns)
{
if (old != -1)
{
- mvwaddstr(wmain, 0, old * barlen,
+ mvwaddstr(wmain, 0, old * barlen,
prepad(padstr(mp[old].name, barlen - 1), 1));
statusmsg(mp[cur].desc);
setcolor(wmain, MAINMENUREVCOLOR);
- mvwaddstr(wmain, 0, cur * barlen,
+ mvwaddstr(wmain, 0, cur * barlen,
prepad(padstr(mp[cur].name, barlen - 1), 1));
setcolor(wmain, MAINMENUCOLOR);
if (cur != old)
{
if (old != -1)
- mvwaddstr(wmenu, old + 1, 1,
+ mvwaddstr(wmenu, old + 1, 1,
prepad(padstr(mp[old].name, barlen - 1), 1));
setcolor(wmenu, SUBMENUREVCOLOR);
werase(win);
mvwprintw(win, 0, 0, "%s", padstr(buf, maxx));
wmove(win, 0, x);
- wrefresh(win);
+ wrefresh(win);
}
/*
Description:
The initial value of 'str' with a maximum length of 'field' - 1,
- which is supplied by the calling routine, is editted. The user's
- erase (^H), kill (^U) and delete word (^W) chars are interpreted.
+ which is supplied by the calling routine, is editted. The user's
+ erase (^H), kill (^U) and delete word (^W) chars are interpreted.
The PC insert or Tab keys toggle between insert and edit mode.
Escape aborts the edit session, leaving 'str' unchanged.
Enter, Up or Down Arrow are used to accept the changes to 'str'.
NOTE: editstr(), mveditstr(), and mvweditstr() are macros.
Return Value:
- Returns the input terminating character on success (Escape,
+ Returns the input terminating character on success (Escape,
Enter, Up or Down Arrow) and ERR on error.
Errors:
{
tp = bp;
- while ((bp > buf) && (*(bp - 1) == ' '))
+ while ((bp > buf) && (*(bp - 1) == ' '))
bp--;
- while ((bp > buf) && (*(bp - 1) != ' '))
+ while ((bp > buf) && (*(bp - 1) != ' '))
bp--;
memmove((void *)bp, (const void *)tp, strlen(tp) + 1);
if (!*bp)
bp[1] = '\0';
-
+
*bp++ = c;
}
}
getyx(wbody, oldy, oldx);
getmaxyx(wbody, maxy, maxx);
- winput = mvwinputbox(wbody, (maxy - nlines) / 2, (maxx - ncols) / 2,
+ winput = mvwinputbox(wbody, (maxy - nlines) / 2, (maxx - ncols) / 2,
nlines, ncols);
for (i = 0; i < n; i++)
typedef void (*FUNC)(void);
-typedef struct
+typedef struct
{
char *name; /* item label */
FUNC func; /* (pointer to) function */
void address(void)
{
- char *fieldname[6] =
+ char *fieldname[6] =
{
"Name", "Street", "City", "State", "Country", (char *)0
};
int PDC_clearclipboard(void);
Description:
- PDC_getclipboard() gets the textual contents of the system's
- clipboard. This function returns the contents of the clipboard
- in the contents argument. It is the responsibilitiy of the
+ PDC_getclipboard() gets the textual contents of the system's
+ clipboard. This function returns the contents of the clipboard
+ in the contents argument. It is the responsibilitiy of the
caller to free the memory returned, via PDC_freeclipboard().
- The length of the clipboard contents is returned in the length
+ The length of the clipboard contents is returned in the length
argument.
- PDC_setclipboard copies the supplied text into the system's
+ PDC_setclipboard copies the supplied text into the system's
clipboard, emptying the clipboard prior to the copy.
PDC_clearclipboard() clears the internal clipboard.
Return Values:
indicator of success/failure of call.
PDC_CLIP_SUCCESS the call was successful
- PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
+ PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
the clipboard contents
PDC_CLIP_EMPTY the clipboard contains no text
PDC_CLIP_ACCESS_ERROR no clipboard support
if (contents)
{
- /* NOTE: We free the memory, but we can not set caller's pointer
- to NULL, so if caller calls again then will try to access
- free'd memory. We 1st overwrite memory with a string so if
- caller tries to use free memory they won't get what they
+ /* NOTE: We free the memory, but we can not set caller's pointer
+ to NULL, so if caller calls again then will try to access
+ free'd memory. We 1st overwrite memory with a string so if
+ caller tries to use free memory they won't get what they
expect & hopefully notice. */
/* memset(contents, 0xFD, strlen(contents)); */
{
PDC_LOG(("PDC_clearclipboard() - called\n"));
- if (pdc_DOS_clipboard)
+ if (pdc_DOS_clipboard)
{
free(pdc_DOS_clipboard);
pdc_DOS_clipboard = NULL;
chtype acs_map[128] =
{
- A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9), A(10),
- A(11), A(12), A(13), A(14), A(15), A(16), A(17), A(18), A(19),
- A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27), A(28),
- A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&', '\'', '(',
+ A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9), A(10),
+ A(11), A(12), A(13), A(14), A(15), A(16), A(17), A(18), A(19),
+ A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27), A(28),
+ A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&', '\'', '(',
')', '*',
A(0x1a), A(0x1b), A(0x18), A(0x19),
0xdb,
- '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
- '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
- 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
+ '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+ 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
A(0x04), 0xb1,
'b', 'c', 'd', 'e',
- 0xf8, 0xf1, 0xb0, A(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d, 0x2d,
- 0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3, 0xf2, 0xe3,
+ 0xf8, 0xf1, 0xb0, A(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d, 0x2d,
+ 0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3, 0xf2, 0xe3,
0xd8, 0x9c, 0xf9,
A(127)
PDCINT(0x10, regs);
}
-/* update the given physical line to look like the corresponding line in
+/* update the given physical line to look like the corresponding line in
curscr */
void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
struct {unsigned char text, attr;} temp_line[256];
- /* replace the attribute part of the chtype with the actual
+ /* replace the attribute part of the chtype with the actual
color value for each chtype in the line */
for (j = 0; j < len; j++)
struct
{
unsigned short di, di_hi, si, si_hi, bp, bp_hi, res, res_hi,
- bx, bx_hi, dx, dx_hi, cx, cx_hi, ax, ax_hi,
+ bx, bx_hi, dx, dx_hi, cx, cx_hi, ax, ax_hi,
flags, es, ds, fs, gs, ip, cs, sp, ss;
} w;
/* Public Domain Curses */
-
+
/* MS C doesn't return flags from int86() */
#ifdef MSC
# define USE_KBHIT
unsigned long PDC_get_input_fd(void);
Description:
- PDC_get_input_fd() returns the file descriptor that PDCurses
+ PDC_get_input_fd() returns the file descriptor that PDCurses
reads its input from. It can be used for select().
Portability X/Open BSD SYS V
{
if (button[i].pressed)
{
- /* Check for a click -- a PRESS followed
+ /* Check for a click -- a PRESS followed
immediately by a release */
if (!button[i].released)
return key;
}
-/* discard any pending keyboard or mouse input -- this is the core
+/* discard any pending keyboard or mouse input -- this is the core
routine for flushinp() */
void PDC_flushinp(void)
{
PDC_LOG(("PDC_flushinp() - called\n"));
- /* Force the BIOS keyboard buffer head and tail pointers to be
+ /* Force the BIOS keyboard buffer head and tail pointers to be
the same... Real nasty trick... */
setdosmemword(0x41a, getdosmemword(0x41c));
return retval;
}
-/* _set_font() - Sets the current font size, if the adapter allows such a
- change. It is an error to attempt to change the font size on a
- "bogus" adapter. The reason for this is that we have a known video
- adapter identity problem. e.g. Two adapters report the same identifying
+/* _set_font() - Sets the current font size, if the adapter allows such a
+ change. It is an error to attempt to change the font size on a
+ "bogus" adapter. The reason for this is that we have a known video
+ adapter identity problem. e.g. Two adapters report the same identifying
characteristics. */
static void _set_font(int size)
pdc_font = _get_font();
}
-/* _set_80x25() - force a known screen state: 80x25 text mode. Forces the
+/* _set_80x25() - force a known screen state: 80x25 text mode. Forces the
appropriate 80x25 alpha mode given the display adapter. */
static void _set_80x25(void)
return (int)regs.h.al;
}
-/* _set_scrn_mode() - Sets the BIOS Video Mode Number only if it is
+/* _set_scrn_mode() - Sets the BIOS Video Mode Number only if it is
different from the current video mode. */
static void _set_scrn_mode(int new_mode)
COLS = PDC_get_columns();
}
-/* _sanity_check() - A video adapter identification sanity check. This
+/* _sanity_check() - A video adapter identification sanity check. This
routine will force sane values for various control flags. */
static int _sanity_check(int adapter)
switch (rows)
{
case 25:
- case 43:
+ case 43:
break;
default:
pdc_bogus_adapter = TRUE;
return _sanity_check(retval);
}
-/* close the physical screen -- may restore the screen to its state
+/* close the physical screen -- may restore the screen to its state
before PDC_scr_open(); miscellaneous cleanup */
void PDC_scr_close(void)
pdc_atrtab = (unsigned char *)NULL;
}
-/* open the physical screen -- allocate SP, miscellaneous intialization,
+/* open the physical screen -- allocate SP, miscellaneous intialization,
and may save the existing screen for later restoration */
int PDC_scr_open(int argc, char **argv)
SP->mouse_wait = PDC_CLICK_PERIOD;
SP->audible = TRUE;
- /* If the environment variable PDCURSES_BIOS is set, the DOS int10()
+ /* If the environment variable PDCURSES_BIOS is set, the DOS int10()
BIOS calls are used in place of direct video memory access. */
if (getenv("PDCURSES_BIOS"))
PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n",
nlines, ncols));
- /* Trash the stored value of orig_cursor -- it's only good if the
+ /* Trash the stored value of orig_cursor -- it's only good if the
video mode doesn't change */
SP->orig_cursor = 0x0607;
PDC_set_blink() toggles whether the A_BLINK attribute sets an
actual blink mode (TRUE), or sets the background color to high
intensity (FALSE). The default is platform-dependent (FALSE in
- most cases). It returns OK if it could set the state to match
- the given parameter, ERR otherwise. Current platforms also
- adjust the value of COLORS according to this function -- 16 for
+ most cases). It returns OK if it could set the state to match
+ the given parameter, ERR otherwise. Current platforms also
+ adjust the value of COLORS according to this function -- 16 for
FALSE, and 8 for TRUE.
PDC_set_title() sets the title of the window in which the curses
/* if scrnmode is not set, some BIOSes hang */
regs.h.ah = 0x01;
- regs.h.al = (unsigned char)pdc_scrnmode;
+ regs.h.al = (unsigned char)pdc_scrnmode;
regs.h.ch = (unsigned char)start;
regs.h.cl = (unsigned char)end;
PDCINT(0x10, regs);
int PDC_clearclipboard(void);
Description:
- PDC_getclipboard() gets the textual contents of the system's
- clipboard. This function returns the contents of the clipboard
- in the contents argument. It is the responsibilitiy of the
+ PDC_getclipboard() gets the textual contents of the system's
+ clipboard. This function returns the contents of the clipboard
+ in the contents argument. It is the responsibilitiy of the
caller to free the memory returned, via PDC_freeclipboard().
- The length of the clipboard contents is returned in the length
+ The length of the clipboard contents is returned in the length
argument.
- PDC_setclipboard copies the supplied text into the system's
+ PDC_setclipboard copies the supplied text into the system's
clipboard, emptying the clipboard prior to the copy.
PDC_clearclipboard() clears the internal clipboard.
Return Values:
indicator of success/failure of call.
PDC_CLIP_SUCCESS the call was successful
- PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
+ PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
the clipboard contents
PDC_CLIP_EMPTY the clipboard contains no text
PDC_CLIP_ACCESS_ERROR no clipboard support
RCSID("$Id: pdcdisp.c,v 1.49 2008/07/14 04:24:51 wmcbrine Exp $")
-/* ACS definitions originally by jshumate@wrdis01.robins.af.mil -- these
+/* ACS definitions originally by jshumate@wrdis01.robins.af.mil -- these
match code page 437 and compatible pages (CP850, CP852, etc.) */
#ifdef CHTYPE_LONG
PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno));
- /* replace the attribute part of the chtype with the
+ /* replace the attribute part of the chtype with the
actual color value for each chtype in the line */
for (j = 0; j < len; j++)
unsigned long PDC_get_input_fd(void);
Description:
- PDC_get_input_fd() returns the file descriptor that PDCurses
+ PDC_get_input_fd() returns the file descriptor that PDCurses
reads its input from. It can be used for select().
Portability X/Open BSD SYS V
#ifdef EMXVIDEO
if (tahead == -1) /* Nothing typed yet */
- {
+ {
tahead = _read_kbd(0, 0, 0);
/* Read additional */
- if (tahead == 0)
+ if (tahead == 0)
tahead = _read_kbd(0, 1, 0) << 8;
}
return kbhit();
# endif
#endif
-}
+}
#ifndef EMXVIDEO
((event.fs & move_mask[i]) ? BUTTON_MOVED : 0) |
((event.fs & press_mask[i]) ? BUTTON_PRESSED : 0);
- /* PRESS events are sometimes mistakenly reported as MOVE
- events. A MOVE should always follow a PRESS, so treat a MOVE
+ /* PRESS events are sometimes mistakenly reported as MOVE
+ events. A MOVE should always follow a PRESS, so treat a MOVE
immediately after a RELEASE as a PRESS. */
if ((pdc_mouse_status.button[i] == BUTTON_MOVED) &&
if (pdc_mouse_status.button[i] == BUTTON_PRESSED && SP->mouse_wait)
{
- /* Check for a click -- a PRESS followed immediately by a
+ /* Check for a click -- a PRESS followed immediately by a
release */
if (!mouse_events)
USHORT mask = ((mbe & (BUTTON1_PRESSED | BUTTON1_CLICKED |
BUTTON1_MOVED)) ? 6 : 0) |
- ((mbe & (BUTTON3_PRESSED | BUTTON3_CLICKED |
+ ((mbe & (BUTTON3_PRESSED | BUTTON3_CLICKED |
BUTTON3_MOVED)) ? 24 : 0) |
- ((mbe & (BUTTON2_PRESSED | BUTTON2_CLICKED |
+ ((mbe & (BUTTON2_PRESSED | BUTTON2_CLICKED |
BUTTON2_MOVED)) ? 96 : 0);
MouSetEventMask(&mask, mouse_handle);
return ((current.cb == oldmode->cb) &&
(current.fbType == oldmode->fbType) &&
- (current.color == oldmode->color) &&
+ (current.color == oldmode->color) &&
(current.col == oldmode->col) &&
- (current.row == oldmode->row) &&
+ (current.row == oldmode->row) &&
(current.hres == oldmode->vres) &&
(current.vres == oldmode->vres));
}
PDC_set_blink() toggles whether the A_BLINK attribute sets an
actual blink mode (TRUE), or sets the background color to high
intensity (FALSE). The default is platform-dependent (FALSE in
- most cases). It returns OK if it could set the state to match
- the given parameter, ERR otherwise. Current platforms also
- adjust the value of COLORS according to this function -- 16 for
+ most cases). It returns OK if it could set the state to match
+ the given parameter, ERR otherwise. Current platforms also
+ adjust the value of COLORS according to this function -- 16 for
FALSE, and 8 for TRUE.
PDC_set_title() sets the title of the window in which the curses
mvaddch() moves the cursor to the specified (y, x) position, and
adds ch to stdscr. mvadd_wch() is the wide version.
- mvwaddch() moves the cursor to the specified position and adds
+ mvwaddch() moves the cursor to the specified position and adds
ch to the specified window. mvwadd_wch() is the wide version.
- echochar() adds ch to stdscr at the current cursor position and
+ echochar() adds ch to stdscr at the current cursor position and
calls refresh(). echo_wchar() is the wide version.
- wechochar() adds ch to the specified window and calls
+ wechochar() adds ch to the specified window and calls
wrefresh(). wecho_wchar() is the wide version.
addrawch(), waddrawch(), mvaddrawch() and mvwaddrawch() are
- PDCurses-specific wrappers for addch() etc. that disable the
+ PDCurses-specific wrappers for addch() etc. that disable the
translation of control characters.
The following applies to all these functions:
- If the cursor moves on to the right margin, an automatic newline
- is performed. If scrollok is enabled, and a character is added
- to the bottom right corner of the window, the scrolling region
- will be scrolled up one line. If scrolling is not allowed, ERR
+ If the cursor moves on to the right margin, an automatic newline
+ is performed. If scrollok is enabled, and a character is added
+ to the bottom right corner of the window, the scrolling region
+ will be scrolled up one line. If scrolling is not allowed, ERR
will be returned.
- If ch is a tab, newline, or backspace, the cursor will be moved
- appropriately within the window. If ch is a newline, the
- clrtoeol routine is called before the cursor is moved to the
- beginning of the next line. If newline mapping is off, the
- cursor will be moved to the next line, but the x coordinate will
- be unchanged. If ch is a tab the cursor is moved to the next
- tab position within the window. If ch is another control
- character, it will be drawn in the ^X notation. Calling the
- inch() routine after adding a control character returns the
- representation of the control character, not the control
+ If ch is a tab, newline, or backspace, the cursor will be moved
+ appropriately within the window. If ch is a newline, the
+ clrtoeol routine is called before the cursor is moved to the
+ beginning of the next line. If newline mapping is off, the
+ cursor will be moved to the next line, but the x coordinate will
+ be unchanged. If ch is a tab the cursor is moved to the next
+ tab position within the window. If ch is another control
+ character, it will be drawn in the ^X notation. Calling the
+ inch() routine after adding a control character returns the
+ representation of the control character, not the control
character.
- Video attributes can be combined with a character by ORing them
- into the parameter. Text, including attributes, can be copied
+ Video attributes can be combined with a character by ORing them
+ into the parameter. Text, including attributes, can be copied
from one place to another by using inch() and addch().
Note that in PDCurses, for now, a cchar_t and a chtype are the
if (!(attr & A_COLOR))
attr |= win->_attrs;
- /* wrs (4/10/93): Apply the same sort of logic for the window
- background, in that it only takes precedence if other color
- attributes are not there and that the background character
+ /* wrs (4/10/93): Apply the same sort of logic for the window
+ background, in that it only takes precedence if other color
+ attributes are not there and that the background character
will only print if the printing character is blank. */
if (!(attr & A_COLOR))
int n);
Description:
- These routines write a chtype or cchar_t string directly into
- the window structure, starting at the current or specified
- position. The four routines with n as the last argument copy at
- most n elements, but no more than will fit on the line. If n =
- -1 then the whole string is copied, up to the maximum number
+ These routines write a chtype or cchar_t string directly into
+ the window structure, starting at the current or specified
+ position. The four routines with n as the last argument copy at
+ most n elements, but no more than will fit on the line. If n =
+ -1 then the whole string is copied, up to the maximum number
that will fit on the line.
- The cursor position is not advanced. These routines do not check
- for newline or other special characters, nor does any line
+ The cursor position is not advanced. These routines do not check
+ for newline or other special characters, nor does any line
wrapping occur.
Return Value:
PDC_LOG(("y %d x %d minx %d maxx %d *ptr %x *ch"
" %x firstch: %d lastch: %d\n",
- y, x, minx, maxx, *ptr, *ch,
+ y, x, minx, maxx, *ptr, *ch,
win->_firstch[y], win->_lastch[y]));
*ptr = *ch;
chtype getattrs(WINDOW *win);
Description:
- These functions manipulate the current attributes and/or colors
- of the named window. These attributes can be any combination
+ These functions manipulate the current attributes and/or colors
+ of the named window. These attributes can be any combination
of A_STANDOUT, A_REVERSE, A_BOLD, A_DIM, A_BLINK, A_UNDERLINE.
These constants are defined in <curses.h> and can be combined
with the bitwise-OR operator (|).
- The current attributes of a window are applied to all chtypes
- that are written into the window with waddch(). Attributes are
- a property of the chtype, and move with the character through
+ The current attributes of a window are applied to all chtypes
+ that are written into the window with waddch(). Attributes are
+ a property of the chtype, and move with the character through
any scrolling or insert/delete operations.
- attrset() sets the current attributes of the given window to
- attrs. attroff() turns off the named attributes without
- affecting any other attributes; attron() turns them on.
+ attrset() sets the current attributes of the given window to
+ attrs. attroff() turns off the named attributes without
+ affecting any other attributes; attron() turns them on.
color_set() sets the window color to the value of color_pair.
- standout() is the same as attron(A_STANDOUT). standend() is the
+ standout() is the same as attron(A_STANDOUT). standend() is the
same as attrset(A_NORMAL); that is, it turns off all attributes.
Return Value:
if (!win)
return ERR;
- if ((win->_attrs & A_COLOR) && (attrs & A_COLOR))
+ if ((win->_attrs & A_COLOR) && (attrs & A_COLOR))
{
oldcolr = win->_attrs & A_COLOR;
oldattr = win->_attrs ^ oldcolr;
there is a conflict (e.g., different color pairs).
Return Value:
- bkgd() and wbkgd() return OK, unless the window is NULL, in
+ bkgd() and wbkgd() return OK, unless the window is NULL, in
which case they return ERR.
Portability X/Open BSD SYS V
newch = win->_bkgd & A_CHARTEXT;
- /* what follows is what seems to occur in the System V
+ /* what follows is what seems to occur in the System V
implementation of this routine */
for (y = 0; y < win->_maxy; y++)
ch = *winptr;
- /* determine the colors and attributes of the character read
+ /* determine the colors and attributes of the character read
from the window */
colr = ch & A_COLOR;
attr = ch & (A_ATTRIBUTES ^ A_COLOR);
- /* if the color is the same as the old background color,
+ /* if the color is the same as the old background color,
then make it the new background color, otherwise leave it */
if (colr == oldcolr)
colr = newcolr;
- /* remove any attributes (non color) from the character that
- were part of the old background, then combine the
+ /* remove any attributes (non color) from the character that
+ were part of the old background, then combine the
remaining ones with the new background */
attr ^= oldattr;
attr |= newattr;
- /* change character if it is there because it was the old
+ /* change character if it is there because it was the old
background character */
ch &= A_CHARTEXT;
Name: border
Synopsis:
- int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl,
+ int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl,
chtype tr, chtype bl, chtype br);
- int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts,
+ int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts,
chtype bs, chtype tl, chtype tr, chtype bl, chtype br);
int box(WINDOW *win, chtype verch, chtype horch);
int hline(chtype ch, int n);
int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n);
Description:
- border(), wborder(), and box() draw a border around the edge of
- the window. If any argument is zero, an appropriate default is
+ border(), wborder(), and box() draw a border around the edge of
+ the window. If any argument is zero, an appropriate default is
used:
ls left side of border ACS_VLINE
bl bottom left corner of border ACS_LLCORNER
br bottom right corner of border ACS_LRCORNER
- hline() and whline() draw a horizontal line, using ch, starting
- from the current cursor position. The cursor position does not
- change. The line is at most n characters long, or as many as
+ hline() and whline() draw a horizontal line, using ch, starting
+ from the current cursor position. The cursor position does not
+ change. The line is at most n characters long, or as many as
will fit in the window.
- vline() and wvline() draw a vertical line, using ch, starting
- from the current cursor position. The cursor position does not
- change. The line is at most n characters long, or as many as
+ vline() and wvline() draw a vertical line, using ch, starting
+ from the current cursor position. The cursor position does not
+ change. The line is at most n characters long, or as many as
will fit in the window.
Return Value:
**man-end****************************************************************/
-/* _attr_passthru() -- Takes a single chtype 'ch' and checks if the
- current attribute of window 'win', as set by wattrset(), and/or the
- current background of win, as set by wbkgd(), should by combined with
+/* _attr_passthru() -- Takes a single chtype 'ch' and checks if the
+ current attribute of window 'win', as set by wattrset(), and/or the
+ current background of win, as set by wbkgd(), should by combined with
it. Attributes set explicitly in ch take precedence. */
static chtype _attr_passthru(WINDOW *win, chtype ch)
{
chtype attr;
- /* If the incoming character doesn't have its own attribute, then
- use the current attributes for the window. If the incoming
- character has attributes, but not a color component, OR the
- attributes to the current attributes for the window. If the
- incoming character has a color component, use only the attributes
+ /* If the incoming character doesn't have its own attribute, then
+ use the current attributes for the window. If the incoming
+ character has attributes, but not a color component, OR the
+ attributes to the current attributes for the window. If the
+ incoming character has a color component, use only the attributes
from the incoming character. */
attr = ch & A_ATTRIBUTES;
if (!(attr & A_COLOR))
attr |= win->_attrs;
- /* wrs (4/10/93) -- Apply the same sort of logic for the window
- background, in that it only takes precedence if other color
+ /* wrs (4/10/93) -- Apply the same sort of logic for the window
+ background, in that it only takes precedence if other color
attributes are not there. */
if (!(attr & A_COLOR))
return ch;
}
-int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs,
+int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs,
chtype tl, chtype tr, chtype bl, chtype br)
{
int i, ymax, xmax;
int wclrtoeol(WINDOW *win);
Description:
- erase() and werase() copy blanks (i.e. the background chtype) to
+ erase() and werase() copy blanks (i.e. the background chtype) to
every cell of the window.
clear() and wclear() are similar to erase() and werase(), but
- they also call clearok() to ensure that the the window is
+ they also call clearok() to ensure that the the window is
cleared on the next wrefresh().
- clrtobot() and wclrtobot() clear the window from the current
+ clrtobot() and wclrtobot() clear the window from the current
cursor position to the end of the window.
clrtoeol() and wclrtoeol() clear the window from the current
Description:
To use these routines, start_color() must be called, usually
- immediately after initscr(). Colors are always used in pairs,
- referred to as color-pairs. A color-pair consists of a
- foreground color and a background color. A color-pair is
- initialized via init_pair(). After initialization, COLOR_PAIR(n)
+ immediately after initscr(). Colors are always used in pairs,
+ referred to as color-pairs. A color-pair consists of a
+ foreground color and a background color. A color-pair is
+ initialized via init_pair(). After initialization, COLOR_PAIR(n)
can be used like any other video attribute.
start_color() initializes eight basic colors (black, red, green,
maximum number of colors and color-pairs the terminal is capable
of displaying).
- init_pair() changes the definition of a color-pair. It takes
- three arguments: the number of the color-pair to be redefined,
- and the new values of the foreground and background colors. The
- pair number must be between 0 and COLOR_PAIRS - 1, inclusive.
- The foreground and background must be between 0 and COLORS - 1,
- inclusive. If the color pair was previously initialized, the
- screen is refreshed, and all occurrences of that color-pair are
+ init_pair() changes the definition of a color-pair. It takes
+ three arguments: the number of the color-pair to be redefined,
+ and the new values of the foreground and background colors. The
+ pair number must be between 0 and COLOR_PAIRS - 1, inclusive.
+ The foreground and background must be between 0 and COLORS - 1,
+ inclusive. If the color pair was previously initialized, the
+ screen is refreshed, and all occurrences of that color-pair are
changed to the new definition.
- has_colors() indicates if the terminal supports, and can
+ has_colors() indicates if the terminal supports, and can
maniplulate color. It returns TRUE or FALSE.
can_change_color() indicates if the terminal has the capability
_normalize(&fg, &bg);
- /* To allow the PDC_PRESERVE_SCREEN option to work, we only reset
- curscr if this call to init_pair() alters a color pair created by
+ /* To allow the PDC_PRESERVE_SCREEN option to work, we only reset
+ curscr if this call to init_pair() alters a color pair created by
the user. */
if (pair_set[pair])
return PDC_color_content(color, red, green, blue);
else
{
- /* Simulated values for platforms that don't support palette
+ /* Simulated values for platforms that don't support palette
changing */
short maxval = (color & 8) ? 1000 : 680;
void PDC_debug(const char *, ...);
Description:
- traceon() and traceoff() toggle the recording of debugging
- information to the file "trace". Although not standard, similar
+ traceon() and traceoff() toggle the recording of debugging
+ information to the file "trace". Although not standard, similar
functions are in some other curses implementations.
- PDC_debug() is the function that writes to the file, based on
- whether traceon() has been called. It's used from the PDC_LOG()
+ PDC_debug() is the function that writes to the file, based on
+ whether traceon() has been called. It's used from the PDC_LOG()
macro.
Portability X/Open BSD SYS V
time_t now;
if (!pdc_trace_on)
- return;
+ return;
/* open debug log file append */
current line are moved up one line. The bottom line of the
window is cleared. The cursor position does not change.
- With the insertln() and winsertn() functions, a blank line is
+ With the insertln() and winsertn() functions, a blank line is
inserted above the current line and the bottom line is lost.
- mvdeleteln(), mvwdeleteln(), mvinsertln() and mvwinsertln()
+ mvdeleteln(), mvwdeleteln(), mvinsertln() and mvwinsertln()
allow moving the cursor and inserting/deleting in one call.
Return Value:
for (ptr = temp; (ptr - temp < win->_maxx); ptr++)
*ptr = blank; /* make a blank line */
- if (win->_cury <= win->_bmarg)
+ if (win->_cury <= win->_bmarg)
{
win->_firstch[win->_bmarg] = 0;
win->_lastch[win->_bmarg] = win->_maxx - 1;
RCSID("$Id: deprec.c,v 1.6 2008/07/13 16:08:18 wmcbrine Exp $")
-/* Deprecated functions. These should not be used, and will eventually
- be removed. They're here solely for the benefit of applications that
+/* Deprecated functions. These should not be used, and will eventually
+ be removed. They're here solely for the benefit of applications that
linked to them in older versions of PDCurses. */
bool PDC_check_bios_key(void)
int PDC_return_key_modifiers(bool flag);
Description:
- With the getch(), wgetch(), mvgetch(), and mvwgetch() functions,
- a character is read from the terminal associated with the window.
- In nodelay mode, if there is no input waiting, the value ERR is
- returned. In delay mode, the program will hang until the system
- passes text through to the program. Depending on the setting of
- cbreak(), this will be after one character or after the first
- newline. Unless noecho() has been set, the character will also
+ With the getch(), wgetch(), mvgetch(), and mvwgetch() functions,
+ a character is read from the terminal associated with the window.
+ In nodelay mode, if there is no input waiting, the value ERR is
+ returned. In delay mode, the program will hang until the system
+ passes text through to the program. Depending on the setting of
+ cbreak(), this will be after one character or after the first
+ newline. Unless noecho() has been set, the character will also
be echoed into the designated window.
If keypad() is TRUE, and a function key is pressed, the token for
If nodelay(win, TRUE) has been called on the window and no input
is waiting, the value ERR is returned.
- ungetch() places ch back onto the input queue to be returned by
+ ungetch() places ch back onto the input queue to be returned by
the next call to wgetch().
- flushinp() throws away any type-ahead that has been typed by the
+ flushinp() throws away any type-ahead that has been typed by the
user and has not yet been read by the program.
- PDC_get_key_modifiers() returns the keyboard modifiers (shift,
- control, alt, numlock) effective at the time of the last getch()
- call, if PDC_save_key_modifiers(TRUE) has been called before the
- getch(). Use the macros PDC_KEY_MODIFIER_* to determine which
- modifier(s) were set. PDC_return_key_modifiers() tells getch()
- to return modifier keys pressed alone as keystrokes (KEY_ALT_L,
+ PDC_get_key_modifiers() returns the keyboard modifiers (shift,
+ control, alt, numlock) effective at the time of the last getch()
+ call, if PDC_save_key_modifiers(TRUE) has been called before the
+ getch(). Use the macros PDC_KEY_MODIFIER_* to determine which
+ modifier(s) were set. PDC_return_key_modifiers() tells getch()
+ to return modifier keys pressed alone as keystrokes (KEY_ALT_L,
etc.). These may not work on all platforms.
- NOTE: getch() and ungetch() are implemented as macros, to avoid
+ NOTE: getch() and ungetch() are implemented as macros, to avoid
conflict with many DOS compiler's runtime libraries.
Return Value:
- These functions return ERR or the value of the character, meta
+ These functions return ERR or the value of the character, meta
character or function key token.
Portability X/Open BSD SYS V
else
if (win->_delayms)
{
- /* Can't really do millisecond intervals, so delay in
+ /* Can't really do millisecond intervals, so delay in
1/20ths of a second (50ms) */
waitcount = win->_delayms / 50;
waitcount = 1;
}
- /* refresh window when wgetch is called if there have been changes
+ /* refresh window when wgetch is called if there have been changes
to it and it is not a pad */
if (!(win->_flags & _PAD) && ((!win->_leaveit &&
if (!win->_use_keypad)
key = -1;
- /* filter mouse events; translate mouse clicks in the slk
+ /* filter mouse events; translate mouse clicks in the slk
area to function keys */
else if (key == KEY_MOUSE)
int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n);
Description:
- These routines call wgetch() repeatedly to build a string,
- interpreting erase and kill characters along the way, until a
- newline or carriage return is received. When PDCurses is built
- with wide-character support enabled, the narrow-character
- functions convert the wgetch()'d values into a multibyte string
- in the current locale before returning it. The resulting string
- is placed in the area pointed to by *str. The routines with n as
+ These routines call wgetch() repeatedly to build a string,
+ interpreting erase and kill characters along the way, until a
+ newline or carriage return is received. When PDCurses is built
+ with wide-character support enabled, the narrow-character
+ functions convert the wgetch()'d values into a multibyte string
+ in the current locale before returning it. The resulting string
+ is placed in the area pointed to by *str. The routines with n as
the last argument read at most n characters.
- Note that there's no way to know how long the buffer passed to
+ Note that there's no way to know how long the buffer passed to
wgetstr() is, so use wgetnstr() to avoid buffer overflows.
Return Value:
- This functions return ERR on failure or any other value on
+ This functions return ERR on failure or any other value on
success.
Portability X/Open BSD SYS V
{
if (chars < n)
{
- if (oldecho)
+ if (oldecho)
waddch(win, ch);
*p++ = ch;
++chars;
case _ECHAR: /* CTRL-H -- Delete character */
if (p > str)
{
- if (oldecho)
+ if (oldecho)
waddstr(win, "\b \b");
ch = (unsigned char)(*--p);
if ((ch < ' ') && (oldecho))
case _DLCHAR: /* CTRL-U -- Delete line */
while (p > str)
{
- if (oldecho)
+ if (oldecho)
waddstr(win, "\b \b");
ch = (unsigned char)(*--p);
if ((ch < ' ') && (oldecho))
while ((p > str) && (*(p - 1) == ' '))
{
- if (oldecho)
+ if (oldecho)
waddstr(win, "\b \b");
--p; /* remove space */
}
while ((p > str) && (*(p - 1) != ' '))
{
- if (oldecho)
+ if (oldecho)
waddstr(win, "\b \b");
ch = (unsigned char)(*--p);
case '\n':
case '\r':
stop = TRUE;
- if (oldecho)
+ if (oldecho)
waddch(win, '\n');
break;
if (!SP->key_code && ch < 0x100)
{
*p++ = ch;
- if (oldecho)
+ if (oldecho)
waddch(win, ch);
chars++;
}
beep();
break;
-
+
}
wrefresh(win);
{
if (chars < n)
{
- if (oldecho)
+ if (oldecho)
waddch(win, ch);
*p++ = ch;
++chars;
case _ECHAR: /* CTRL-H -- Delete character */
if (p > wstr)
{
- if (oldecho)
+ if (oldecho)
waddstr(win, "\b \b");
ch = *--p;
if ((ch < ' ') && (oldecho))
case _DLCHAR: /* CTRL-U -- Delete line */
while (p > wstr)
{
- if (oldecho)
+ if (oldecho)
waddstr(win, "\b \b");
ch = *--p;
if ((ch < ' ') && (oldecho))
while ((p > wstr) && (*(p - 1) == ' '))
{
- if (oldecho)
+ if (oldecho)
waddstr(win, "\b \b");
--p; /* remove space */
}
while ((p > wstr) && (*(p - 1) != ' '))
{
- if (oldecho)
+ if (oldecho)
waddstr(win, "\b \b");
ch = *--p;
case '\n':
case '\r':
stop = TRUE;
- if (oldecho)
+ if (oldecho)
waddch(win, '\n');
break;
beep();
break;
-
+
}
wrefresh(win);
int getmaxx(WINDOW *win);
Description:
- The getyx() macro (defined in curses.h -- the prototypes here
- are merely illustrative) puts the current cursor position of the
- specified window into y and x. getbegyx() and getmaxyx() return
- the starting coordinates and size of the specified window,
- respectively. getparyx() returns the starting coordinates of the
- parent's window, if the specified window is a subwindow;
+ The getyx() macro (defined in curses.h -- the prototypes here
+ are merely illustrative) puts the current cursor position of the
+ specified window into y and x. getbegyx() and getmaxyx() return
+ the starting coordinates and size of the specified window,
+ respectively. getparyx() returns the starting coordinates of the
+ parent's window, if the specified window is a subwindow;
otherwise it sets y and x to -1. These are all macros.
getsyx() gets the coordinates of the virtual screen cursor, and
int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval);
Description:
- The inch() functions retrieve the character and attribute from
- the current or specified window position, in the form of a
+ The inch() functions retrieve the character and attribute from
+ the current or specified window position, in the form of a
chtype. If a NULL window is specified, (chtype)ERR is returned.
- The in_wch() functions are the wide-character versions; instead
- of returning a chtype, they store a cchar_t at the address
- specified by wcval, and return OK or ERR. (No value is stored
- when ERR is returned.) Note that in PDCurses, chtype and cchar_t
+ The in_wch() functions are the wide-character versions; instead
+ of returning a chtype, they store a cchar_t at the address
+ specified by wcval, and return OK or ERR. (No value is stored
+ when ERR is returned.) Note that in PDCurses, chtype and cchar_t
are the same.
Portability X/Open BSD SYS V
int mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wch, int n);
Description:
- These routines read a chtype or cchar_t string from the window,
- starting at the current or specified position, and ending at the
+ These routines read a chtype or cchar_t string from the window,
+ starting at the current or specified position, and ending at the
right margin, or after n elements, whichever is less.
Return Value:
- All functions return the number of elements read, or ERR on
+ All functions return the number of elements read, or ERR on
error.
Portability X/Open BSD SYS V
const char *curses_version(void);
Description:
- initscr() should be the first curses routine called. It will
- initialize all curses data structures, and arrange that the
- first call to refresh() will clear the screen. In case of
- error, initscr() will write a message to standard error and end
+ initscr() should be the first curses routine called. It will
+ initialize all curses data structures, and arrange that the
+ first call to refresh() will clear the screen. In case of
+ error, initscr() will write a message to standard error and end
the program.
- endwin() should be called before exiting or escaping from curses
- mode temporarily. It will restore tty modes, move the cursor to
- the lower left corner of the screen and reset the terminal into
- the proper non-visual mode. To resume curses after a temporary
+ endwin() should be called before exiting or escaping from curses
+ mode temporarily. It will restore tty modes, move the cursor to
+ the lower left corner of the screen and reset the terminal into
+ the proper non-visual mode. To resume curses after a temporary
escape, call refresh() or doupdate().
- isendwin() returns TRUE if endwin() has been called without a
+ isendwin() returns TRUE if endwin() has been called without a
subsequent refresh, unless SP is NULL.
- In some implementations of curses, newterm() allows the use of
- multiple terminals. Here, it's just an alternative interface for
+ In some implementations of curses, newterm() allows the use of
+ multiple terminals. Here, it's just an alternative interface for
initscr(). It always returns SP, or NULL.
delscreen() frees the memory allocated by newterm() or
usually not needed. In PDCurses, the parameter must be the
value of SP, and delscreen() sets SP to NULL.
- set_term() does nothing meaningful in PDCurses, but is included
+ set_term() does nothing meaningful in PDCurses, but is included
for compatibility with other curses implementations.
- resize_term() is effectively two functions: When called with
- nonzero values for nlines and ncols, it attempts to resize the
- screen to the given size. When called with (0, 0), it merely
- adjusts the internal structures to match the current size after
- the screen is resized by the user. On the currently supported
- platforms, this functionality is mutually exclusive: X11 allows
- user resizing, while DOS, OS/2 and Win32 allow programmatic
- resizing. If you want to support user resizing, you should check
- for getch() returning KEY_RESIZE, and/or call is_termresized()
- at appropriate times; if either condition occurs, call
- resize_term(0, 0). Then, with either user or programmatic
- resizing, you'll have to resize any windows you've created, as
+ resize_term() is effectively two functions: When called with
+ nonzero values for nlines and ncols, it attempts to resize the
+ screen to the given size. When called with (0, 0), it merely
+ adjusts the internal structures to match the current size after
+ the screen is resized by the user. On the currently supported
+ platforms, this functionality is mutually exclusive: X11 allows
+ user resizing, while DOS, OS/2 and Win32 allow programmatic
+ resizing. If you want to support user resizing, you should check
+ for getch() returning KEY_RESIZE, and/or call is_termresized()
+ at appropriate times; if either condition occurs, call
+ resize_term(0, 0). Then, with either user or programmatic
+ resizing, you'll have to resize any windows you've created, as
appropriate; resize_term() only handles stdscr and curscr.
is_termresized() returns TRUE if the curses screen has been
- resized by the user, and a call to resize_term() is needed.
- Checking for KEY_RESIZE is generally preferable, unless you're
+ resized by the user, and a call to resize_term() is needed.
+ Checking for KEY_RESIZE is generally preferable, unless you're
not handling the keyboard.
- curses_version() returns a string describing the version of
+ curses_version() returns a string describing the version of
PDCurses.
Return Value:
PDC_slk_initialize();
LINES -= SP->slklines;
- /* We have to sort out ripped off lines here, and reduce the height
+ /* We have to sort out ripped off lines here, and reduce the height
of stdscr by the number of lines ripped off */
for (i = 0; i < linesrippedoff; i++)
bool isendwin(void)
{
PDC_LOG(("isendwin() - called\n"));
-
+
return SP ? !(SP->alive) : FALSE;
}
int nocrmode(void);
Description:
- cbreak() and nocbreak() toggle cbreak mode. In cbreak mode,
- characters typed by the user are made available immediately, and
- erase/kill character processing is not performed. In nocbreak
- mode, typed characters are buffered until a newline or carriage
- return. Interrupt and flow control characters are unaffected by
+ cbreak() and nocbreak() toggle cbreak mode. In cbreak mode,
+ characters typed by the user are made available immediately, and
+ erase/kill character processing is not performed. In nocbreak
+ mode, typed characters are buffered until a newline or carriage
+ return. Interrupt and flow control characters are unaffected by
this mode. PDCurses always starts in cbreak mode.
- echo() and noecho() control whether typed characters are echoed
- by the input routine. Initially, input characters are echoed.
+ echo() and noecho() control whether typed characters are echoed
+ by the input routine. Initially, input characters are echoed.
Subsequent calls to echo() and noecho() do not flush type-ahead.
- halfdelay() is similar to cbreak(), but allows for a time limit
- to be specified, in tenths of a second. This causes getch() to
- block for that period before returning ERR if no key has been
+ halfdelay() is similar to cbreak(), but allows for a time limit
+ to be specified, in tenths of a second. This causes getch() to
+ block for that period before returning ERR if no key has been
received. tenths must be between 1 and 255.
- keypad() controls whether getch() returns function/special keys
- as single key codes (e.g., the left arrow key as KEY_LEFT). Per
- X/Open, the default for keypad mode is OFF. You'll probably want
- it on. With keypad mode off, if a special key is pressed,
+ keypad() controls whether getch() returns function/special keys
+ as single key codes (e.g., the left arrow key as KEY_LEFT). Per
+ X/Open, the default for keypad mode is OFF. You'll probably want
+ it on. With keypad mode off, if a special key is pressed,
getch() does nothing or returns ERR.
- nodelay() controls whether wgetch() is a non-blocking call. If
- the option is enabled, and no input is ready, wgetch() will
- return ERR. If disabled, wgetch() will hang until input is
+ nodelay() controls whether wgetch() is a non-blocking call. If
+ the option is enabled, and no input is ready, wgetch() will
+ return ERR. If disabled, wgetch() will hang until input is
ready.
- nl() enables the translation of a carriage return into a newline
- on input. nonl() disables this. Initially, the translation does
+ nl() enables the translation of a carriage return into a newline
+ on input. nonl() disables this. Initially, the translation does
occur.
- raw() and noraw() toggle raw mode. Raw mode is similar to cbreak
- mode, in that characters typed are immediately passed through to
- the user program. The difference is that in raw mode, the INTR,
- QUIT, SUSP, and STOP characters are passed through without being
+ raw() and noraw() toggle raw mode. Raw mode is similar to cbreak
+ mode, in that characters typed are immediately passed through to
+ the user program. The difference is that in raw mode, the INTR,
+ QUIT, SUSP, and STOP characters are passed through without being
interpreted, and without generating a signal.
In PDCurses, the meta() function sets raw mode on or off.
- timeout() and wtimeout() set blocking or non-blocking reads for
- the specified window. The delay is measured in milliseconds. If
- it's negative, a blocking read is used; if zero, then non-
- blocking reads are done -- if no input is waiting, ERR is
- returned immediately. If the delay is positive, the read blocks
+ timeout() and wtimeout() set blocking or non-blocking reads for
+ the specified window. The delay is measured in milliseconds. If
+ it's negative, a blocking read is used; if zero, then non-
+ blocking reads are done -- if no input is waiting, ERR is
+ returned immediately. If the delay is positive, the read blocks
for the delay period; if the period expires, ERR is returned.
intrflush(), notimeout(), noqiflush(), qiflush() and typeahead()
- do nothing in PDCurses, but are included for compatibility with
+ do nothing in PDCurses, but are included for compatibility with
other curses implementations.
- crmode() and nocrmode() are archaic equivalents to cbreak() and
+ crmode() and nocrmode() are archaic equivalents to cbreak() and
nocbreak(), respectively.
Return Value:
if (delay < 0)
{
- /* This causes a blocking read on the window, so turn on delay
+ /* This causes a blocking read on the window, so turn on delay
mode */
win->_nodelay = FALSE;
}
else if (!delay)
{
- /* This causes a non-blocking read on the window, so turn off
+ /* This causes a non-blocking read on the window, so turn off
delay mode */
win->_nodelay = TRUE;
}
else
{
- /* This causes the read on the window to delay for the number of
- milliseconds. Also forces the window into non-blocking read
+ /* This causes the read on the window to delay for the number of
+ milliseconds. Also forces the window into non-blocking read
mode */
/*win->_nodelay = TRUE;*/
int mvwins_wch(WINDOW *win, int y, int x, const cchar_t *wch);
Description:
- The insch() functions insert a chtype into the window at the
- current or specified cursor position. The cursor is NOT
- advanced. A newline is equivalent to clrtoeol(); tabs are
- expanded; other control characters are converted as with
+ The insch() functions insert a chtype into the window at the
+ current or specified cursor position. The cursor is NOT
+ advanced. A newline is equivalent to clrtoeol(); tabs are
+ expanded; other control characters are converted as with
unctrl().
The ins_wch() functions are the wide-character
equivalents, taking cchar_t pointers rather than chtypes.
Video attributes can be combined with a character by ORing
- them into the parameter. Text, including attributes, can be
+ them into the parameter. Text, including attributes, can be
copied from one place to another using inch() and insch().
- insrawch() etc. are PDCurses-specific wrappers for insch() etc.
+ insrawch() etc. are PDCurses-specific wrappers for insch() etc.
that disable the translation of control characters.
Return Value:
at the current cursor position, by repeatedly calling winsch().
When PDCurses is built with wide-character support enabled, the
narrow-character functions treat the string as a multibyte
- string in the current locale, and convert it first. All
- characters to the right of the cursor are moved to the right,
- with the possibility of the rightmost characters on the line
- being lost. The cursor position does not change (after moving
- to y, x, if specified). The routines with n as the last
- argument insert at most n characters; if n is negative, then the
+ string in the current locale, and convert it first. All
+ characters to the right of the cursor are moved to the right,
+ with the possibility of the rightmost characters on the line
+ being lost. The cursor position does not change (after moving
+ to y, x, if specified). The routines with n as the last
+ argument insert at most n characters; if n is negative, then the
entire string is inserted.
Return Value:
int mvwinnwstr(WINDOW *win, int y, int x, wchar_t *wstr, int n);
Description:
- These functions take characters (or wide characters) from the
- current or specified position in the window, and return them as
- a string in str (or wstr). Attributes are ignored. The functions
- with n as the last argument return a string at most n characters
+ These functions take characters (or wide characters) from the
+ current or specified position in the window, and return them as
+ a string in str (or wstr). Attributes are ignored. The functions
+ with n as the last argument return a string at most n characters
long.
Return Value:
- Upon successful completion, innstr(), mvinnstr(), mvwinnstr()
+ Upon successful completion, innstr(), mvinnstr(), mvwinnstr()
and winnstr() return the number of characters actually read into
- the string; instr(), mvinstr(), mvwinstr() and winstr() return
+ the string; instr(), mvinstr(), mvwinstr() and winstr() return
OK. Otherwise, all these functions return ERR.
Portability X/Open BSD SYS V
0 makes it disappear; 1 makes it appear "normal" (usually an
underline) and 2 makes it "highly visible" (usually a block).
- ripoffline() reduces the size of stdscr by one line. If the
- "line" parameter is positive, the line is removed from the top
- of the screen; if negative, from the bottom. Up to 5 lines can
- be ripped off stdscr by calling ripoffline() repeatedly. The
- function argument, init, is called from within initscr() or
- newterm(), so ripoffline() must be called before either of these
- functions. The init function receives a pointer to a one-line
- WINDOW, and the width of the window. Calling ripoffline() with a
+ ripoffline() reduces the size of stdscr by one line. If the
+ "line" parameter is positive, the line is removed from the top
+ of the screen; if negative, from the bottom. Up to 5 lines can
+ be ripped off stdscr by calling ripoffline() repeatedly. The
+ function argument, init, is called from within initscr() or
+ newterm(), so ripoffline() must be called before either of these
+ functions. The init function receives a pointer to a one-line
+ WINDOW, and the width of the window. Calling ripoffline() with a
NULL init function pointer is an error.
- napms() suspends the program for the specified number of
+ napms() suspends the program for the specified number of
milliseconds. draino() is an archaic equivalent.
resetterm(), fixterm() and saveterm() are archaic equivalents
ret_vis = PDC_curs_set(visibility);
- /* If the cursor is changing from invisible to visible, update
+ /* If the cursor is changing from invisible to visible, update
its position */
if (visibility && !ret_vis)
bool has_key(int key);
Description:
- keyname() returns a string corresponding to the argument key.
+ keyname() returns a string corresponding to the argument key.
key may be any key returned by wgetch().
- key_name() is the wide-character version. It takes a wchar_t
+ key_name() is the wide-character version. It takes a wchar_t
parameter, but still returns a char *.
- has_key() returns TRUE for recognized keys, FALSE otherwise.
+ has_key() returns TRUE for recognized keys, FALSE otherwise.
This function is an ncurses extension.
Portability X/Open BSD SYS V
reported) through 1000ms. In x11, the timeout can also be set
via the clickPeriod resource. The return value from
mouseinterval() is the old timeout. To check the old value
- without setting a new one, call it with a parameter of -1. Note
- that although there's no classic equivalent for this function
- (apart from the clickPeriod resource), the value set applies in
+ without setting a new one, call it with a parameter of -1. Note
+ that although there's no classic equivalent for this function
+ (apart from the clickPeriod resource), the value set applies in
both interfaces.
wenclose() reports whether the given screen-relative y, x
mousemask() is nearly equivalent to mouse_set(), but instead of
OK/ERR, it returns the value of the mask after setting it. (This
isn't necessarily the same value passed in, since the mask could
- be altered on some platforms.) And if the second parameter is a
- non-null pointer, mousemask() stores the previous mask value
- there. Also, since the ncurses interface doesn't work with
+ be altered on some platforms.) And if the second parameter is a
+ non-null pointer, mousemask() stores the previous mask value
+ there. Also, since the ncurses interface doesn't work with
PDCurses' BUTTON_MOVED events, mousemask() filters them out.
- nc_getmouse() returns the current mouse status in an MEVENT
- struct. This is equivalent to ncurses' getmouse(), renamed to
- avoid conflict with PDCurses' getmouse(). But if you define
- NCURSES_MOUSE_VERSION (preferably as 2) before including
- curses.h, it defines getmouse() to nc_getmouse(), along with a
- few other redefintions needed for compatibility with ncurses
- code. nc_getmouse() calls request_mouse_pos(), which (not
+ nc_getmouse() returns the current mouse status in an MEVENT
+ struct. This is equivalent to ncurses' getmouse(), renamed to
+ avoid conflict with PDCurses' getmouse(). But if you define
+ NCURSES_MOUSE_VERSION (preferably as 2) before including
+ curses.h, it defines getmouse() to nc_getmouse(), along with a
+ few other redefintions needed for compatibility with ncurses
+ code. nc_getmouse() calls request_mouse_pos(), which (not
getmouse()) is the classic equivalent.
- ungetmouse() is the mouse equivalent of ungetch(). However,
- PDCurses doesn't maintain a queue of mouse events; only one can
- be pushed back, and it can overwrite or be overwritten by real
+ ungetmouse() is the mouse equivalent of ungetch(). However,
+ PDCurses doesn't maintain a queue of mouse events; only one can
+ be pushed back, and it can overwrite or be overwritten by real
mouse events.
Portability X/Open BSD SYS V
if (oldmask)
*oldmask = SP->_trap_mbe;
- /* The ncurses interface doesn't work with our move events, so
+ /* The ncurses interface doesn't work with our move events, so
filter them here */
mask &= ~(BUTTON1_MOVED | BUTTON2_MOVED | BUTTON3_MOVED);
int shf = i * 5;
short button = 0;
- if (bstate & ((BUTTON1_RELEASED | BUTTON1_PRESSED |
+ if (bstate & ((BUTTON1_RELEASED | BUTTON1_PRESSED |
BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED) << shf))
{
pdc_mouse_status.changes |= 1 << i;
int raw_output(bool bf);
Description:
- With clearok(), if bf is TRUE, the next call to wrefresh() with
- this window will clear the screen completely and redraw the
+ With clearok(), if bf is TRUE, the next call to wrefresh() with
+ this window will clear the screen completely and redraw the
entire screen.
- immedok(), called with a second argument of TRUE, causes an
- automatic wrefresh() every time a change is made to the
+ immedok(), called with a second argument of TRUE, causes an
+ automatic wrefresh() every time a change is made to the
specified window.
Normally, the hardware cursor is left at the location of the
the need for cursor motions. If possible, the cursor is made
invisible when this option is enabled.
- wsetscrreg() sets a scrolling region in a window; "top" and
- "bot" are the line numbers for the top and bottom margins. If
- this option and scrollok() are enabled, any attempt to move off
- the bottom margin will cause all lines in the scrolling region
+ wsetscrreg() sets a scrolling region in a window; "top" and
+ "bot" are the line numbers for the top and bottom margins. If
+ this option and scrollok() are enabled, any attempt to move off
+ the bottom margin will cause all lines in the scrolling region
to scroll up one line. setscrreg() is the stdscr version.
- idlok() and idcok() do nothing in PDCurses, but are provided for
+ idlok() and idcok() do nothing in PDCurses, but are provided for
compatibility with other curses implementations.
- raw_output() enables the output of raw characters using the
- standard *add* and *ins* curses functions (that is, it disables
+ raw_output() enables the output of raw characters using the
+ standard *add* and *ins* curses functions (that is, it disables
translation of control characters).
Return Value:
**man-end****************************************************************/
-/* Thanks to Andreas Otte <venn@@uni-paderborn.de> for the
+/* Thanks to Andreas Otte <venn@@uni-paderborn.de> for the
corrected overlay()/overwrite() behavior. */
static int _copy_win(const WINDOW *src_w, WINDOW *dst_w, int src_tr,
if (fc == _NO_CHANGE)
fc = col + dst_tc;
-
+
lc = col + dst_tc;
}
last_col = min(src_w->_begx + src_w->_maxx, dst_w->_begx + dst_w->_maxx);
last_line = min(src_w->_begy + src_w->_maxy, dst_w->_begy + dst_w->_maxy);
- /* determine the overlapping region of the two windows in real
+ /* determine the overlapping region of the two windows in real
coordinates */
/* if no overlapping region, do nothing */
last_col = min(src_w->_begx + src_w->_maxx, dst_w->_begx + dst_w->_maxx);
last_line = min(src_w->_begy + src_w->_maxy, dst_w->_begy + dst_w->_maxy);
- /* determine the overlapping region of the two windows in real
+ /* determine the overlapping region of the two windows in real
coordinates */
/* if no overlapping region, do nothing */
to specify the part of the pad to be displayed, and the location
to use on the screen.
- newpad() creates a new pad data structure.
+ newpad() creates a new pad data structure.
subpad() creates a new sub-pad within a pad, at position (begy,
- begx), with dimensions of nlines lines and ncols columns. This
- position is relative to the pad, and not to the screen as with
- subwin. Changes to either the parent pad or sub-pad will affect
- both. When using sub-pads, you may need to call touchwin()
+ begx), with dimensions of nlines lines and ncols columns. This
+ position is relative to the pad, and not to the screen as with
+ subwin. Changes to either the parent pad or sub-pad will affect
+ both. When using sub-pads, you may need to call touchwin()
before calling prefresh().
pnoutrefresh() copies the specified pad to the virtual screen.
These routines are analogous to wnoutrefresh() and wrefresh().
(py, px) specifies the upper left corner of the part of the pad
- to be displayed; (sy1, sx1) and (sy2, sx2) describe the screen
+ to be displayed; (sy1, sx1) and (sy2, sx2) describe the screen
rectangle that will contain the selected part of the pad.
pechochar() is functionally equivalent to addch() followed by
win->_flags = _PAD;
- /* save default values in case pechochar() is the first call to
+ /* save default values in case pechochar() is the first call to
prefresh(). */
save_pminrow = 0;
(begx + ncols) > (orig->_begx + orig->_maxx))
return (WINDOW *)NULL;
- if (!nlines)
+ if (!nlines)
nlines = orig->_maxy - 1 - j;
- if (!ncols)
+ if (!ncols)
ncols = orig->_maxx - 1 - k;
if ( !(win = PDC_makenew(nlines, ncols, begy, begx)) )
memcpy(curscr->_y[sline] + sx1, w->_y[pline] + px,
num_cols * sizeof(chtype));
- if ((curscr->_firstch[sline] == _NO_CHANGE)
+ if ((curscr->_firstch[sline] == _NO_CHANGE)
|| (curscr->_firstch[sline] > sx1))
curscr->_firstch[sline] = sx1;
curscr->_clear = TRUE;
}
- /* position the cursor to the pad's current position if possible --
- is the pad current position going to end up displayed? if not,
+ /* position the cursor to the pad's current position if possible --
+ is the pad current position going to end up displayed? if not,
then don't move the cursor; if so, move it to the correct place */
if (!w->_leaveit && w->_cury >= py && w->_curx >= px &&
if (waddch(pad, ch) == ERR)
return ERR;
- return prefresh(pad, save_pminrow, save_pmincol, save_sminrow,
+ return prefresh(pad, save_pminrow, save_pmincol, save_sminrow,
save_smincol, save_smaxrow, save_smaxcol);
}
if (!wch || (waddch(pad, *wch) == ERR))
return ERR;
- return prefresh(pad, save_pminrow, save_pmincol, save_sminrow,
+ return prefresh(pad, save_pminrow, save_pmincol, save_sminrow,
save_smincol, save_smaxrow, save_smaxcol);
}
#endif
panels, fetch and set their associated windows, shuffle panels
in the deck, and manipulate panels in other ways.
- bottom_panel() places pan at the bottom of the deck. The size,
+ bottom_panel() places pan at the bottom of the deck. The size,
location and contents of the panel are unchanged.
del_panel() deletes pan, but not its associated winwow.
- hide_panel() removes a panel from the deck and thus hides it
+ hide_panel() removes a panel from the deck and thus hides it
from view.
- move_panel() moves the curses window associated with pan, so
- that its upper lefthand corner is at the supplied coordinates.
+ move_panel() moves the curses window associated with pan, so
+ that its upper lefthand corner is at the supplied coordinates.
(Do not use mvwin() on the window.)
- new_panel() creates a new panel associated with win and returns
- the panel pointer. The new panel is placed at the top of the
+ new_panel() creates a new panel associated with win and returns
+ the panel pointer. The new panel is placed at the top of the
deck.
- panel_above() returns a pointer to the panel in the deck above
- pan, or NULL if pan is the top panel. If the value of pan passed
- is NULL, this function returns a pointer to the bottom panel in
+ panel_above() returns a pointer to the panel in the deck above
+ pan, or NULL if pan is the top panel. If the value of pan passed
+ is NULL, this function returns a pointer to the bottom panel in
the deck.
- panel_below() returns a pointer to the panel in the deck below
- pan, or NULL if pan is the bottom panel. If the value of pan
- passed is NULL, this function returns a pointer to the top panel
+ panel_below() returns a pointer to the panel in the deck below
+ pan, or NULL if pan is the bottom panel. If the value of pan
+ passed is NULL, this function returns a pointer to the top panel
in the deck.
panel_hidden() returns OK if pan is hidden and ERR if it is not.
- panel_userptr() - Each panel has a user pointer available for
- maintaining relevant information. This function returns a
- pointer to that information previously set up by
+ panel_userptr() - Each panel has a user pointer available for
+ maintaining relevant information. This function returns a
+ pointer to that information previously set up by
set_panel_userptr().
- panel_window() returns a pointer to the curses window associated
+ panel_window() returns a pointer to the curses window associated
with the panel.
replace_panel() replaces the current window of pan with win.
- set_panel_userptr() - Each panel has a user pointer available
- for maintaining relevant information. This function sets the
+ set_panel_userptr() - Each panel has a user pointer available
+ for maintaining relevant information. This function sets the
value of that information.
- show_panel() makes a previously hidden panel visible and places
+ show_panel() makes a previously hidden panel visible and places
it back in the deck on top.
- top_panel() places pan on the top of the deck. The size,
+ top_panel() places pan on the top of the deck. The size,
location and contents of the panel are unchanged.
- update_panels() refreshes the virtual screen to reflect the
- depth relationships between the panels in the deck. The user
+ update_panels() refreshes the virtual screen to reflect the
+ depth relationships between the panels in the deck. The user
must use doupdate() to refresh the physical screen.
Return Value:
- Each routine that returns a pointer to an object returns NULL if
- an error occurs. Each panel routine that returns an integer,
+ Each routine that returns a pointer to an object returns NULL if
+ an error occurs. Each panel routine that returns an integer,
returns OK if it executes successfully and ERR if it does not.
Portability X/Open BSD SYS V
if (is_wintouched(stdscr))
Wnoutrefresh(&_stdscr_pseudo_panel);
-
+
pan = _bottom_panel;
while (pan)
int vw_printw(WINDOW *win, const char *fmt, va_list varglist);
Description:
- The printw() functions add a formatted string to the window at
- the current or specified cursor position. The format strings are
- the same as used in the standard C library's printf(). (printw()
+ The printw() functions add a formatted string to the window at
+ the current or specified cursor position. The format strings are
+ the same as used in the standard C library's printf(). (printw()
can be used as a drop-in replacement for printf().)
Return Value:
- All functions return the number of characters printed, or
+ All functions return the number of characters printed, or
ERR on error.
Portability X/Open BSD SYS V
int wredrawln(WINDOW *win, int beg_line, int num_lines);
Description:
- wrefresh() copies the named window to the physical terminal
- screen, taking into account what is already there in order to
- optimize cursor movement. refresh() does the same, using stdscr.
- These routines must be called to get any output on the terminal,
- as other routines only manipulate data structures. Unless
- leaveok() has been enabled, the physical cursor of the terminal
+ wrefresh() copies the named window to the physical terminal
+ screen, taking into account what is already there in order to
+ optimize cursor movement. refresh() does the same, using stdscr.
+ These routines must be called to get any output on the terminal,
+ as other routines only manipulate data structures. Unless
+ leaveok() has been enabled, the physical cursor of the terminal
is left at the location of the window's cursor.
- wnoutrefresh() and doupdate() allow multiple updates with more
- efficiency than wrefresh() alone. wrefresh() works by first
- calling wnoutrefresh(), which copies the named window to the
- virtual screen. It then calls doupdate(), which compares the
- virtual screen to the physical screen and does the actual
- update. A series of calls to wrefresh() will result in
- alternating calls to wnoutrefresh() and doupdate(), causing
- several bursts of output to the screen. By first calling
- wnoutrefresh() for each window, it is then possible to call
+ wnoutrefresh() and doupdate() allow multiple updates with more
+ efficiency than wrefresh() alone. wrefresh() works by first
+ calling wnoutrefresh(), which copies the named window to the
+ virtual screen. It then calls doupdate(), which compares the
+ virtual screen to the physical screen and does the actual
+ update. A series of calls to wrefresh() will result in
+ alternating calls to wnoutrefresh() and doupdate(), causing
+ several bursts of output to the screen. By first calling
+ wnoutrefresh() for each window, it is then possible to call
doupdate() only once.
- In PDCurses, redrawwin() is equivalent to touchwin(), and
- wredrawln() is the same as touchline(). In some other curses
- implementations, there's a subtle distinction, but it has no
+ In PDCurses, redrawwin() is equivalent to touchwin(), and
+ wredrawln() is the same as touchline(). In some other curses
+ implementations, there's a subtle distinction, but it has no
meaning in PDCurses.
Return Value:
int first = win->_firstch[i]; /* first changed */
int last = win->_lastch[i]; /* last changed */
- /* ignore areas on the outside that are marked as changed,
+ /* ignore areas on the outside that are marked as changed,
but really aren't */
while (first <= last && src[first] == dest[first])
memcpy(dest + first, src + first,
(last - first + 1) * sizeof(chtype));
- first += begx;
+ first += begx;
last += begx;
if (first < curscr->_firstch[j] ||
#ifndef HAVE_VSSCANF
-/* _pdc_vsscanf() - Internal routine to parse and format an input
- buffer. It scans a series of input fields; each field is formatted
- according to a supplied format string and the formatted input is
- stored in the variable number of addresses passed. Returns the number
+/* _pdc_vsscanf() - Internal routine to parse and format an input
+ buffer. It scans a series of input fields; each field is formatted
+ according to a supplied format string and the formatted input is
+ stored in the variable number of addresses passed. Returns the number
of input fields or EOF on error.
- Don't compile this unless required. Some compilers (at least Borland
+ Don't compile this unless required. Some compilers (at least Borland
C++ 3.0) have to link with math libraries due to the use of floats.
- Based on vsscanf.c and input.c from emx 0.8f library source,
- Copyright (c) 1990-1992 by Eberhard Mattes, who has kindly agreed to
+ Based on vsscanf.c and input.c from emx 0.8f library source,
+ Copyright (c) 1990-1992 by Eberhard Mattes, who has kindly agreed to
its inclusion in PDCurses. */
#define WHITE(x) ((x) == ' ' || (x) == '\t' || (x) == '\n')
int scr_set(const char *filename);
Description:
- getwin() reads window-related data previously stored in a file
- by putwin(). It then creates and initialises a new window using
+ getwin() reads window-related data previously stored in a file
+ by putwin(). It then creates and initialises a new window using
that data.
- putwin() writes all data associated with a window into a file,
- using an unspecified format. This information can be retrieved
+ putwin() writes all data associated with a window into a file,
+ using an unspecified format. This information can be retrieved
later using getwin().
- scr_dump() writes the current contents of the virtual screen to
+ scr_dump() writes the current contents of the virtual screen to
the file named by filename in an unspecified format.
- scr_restore() function sets the virtual screen to the contents
- of the file named by filename, which must have been written
- using scr_dump(). The next refresh operation restores the screen
+ scr_restore() function sets the virtual screen to the contents
+ of the file named by filename, which must have been written
+ using scr_dump(). The next refresh operation restores the screen
to the way it looked in the dump file.
- In PDCurses, scr_init() does nothing, and scr_set() is a synonym
- for scr_restore(). Also, scr_dump() and scr_restore() save and
- load from curscr. This differs from some other implementations,
- where scr_init() works with curscr, and scr_restore() works with
- newscr; but the effect should be the same. (PDCurses has no
+ In PDCurses, scr_init() does nothing, and scr_set() is a synonym
+ for scr_restore(). Also, scr_dump() and scr_restore() save and
+ load from curscr. This differs from some other implementations,
+ where scr_init() works with curscr, and scr_restore() works with
+ newscr; but the effect should be the same. (PDCurses has no
newscr.)
Return Value:
- On successful completion, getwin() returns a pointer to the
- window it created. Otherwise, it returns a null pointer. Other
+ On successful completion, getwin() returns a pointer to the
+ window it created. Otherwise, it returns a null pointer. Other
functions return OK or ERR.
Portability X/Open BSD SYS V
int wscrl(WINDOW *win, int n);
Description:
- scroll() causes the window to scroll up one line. This involves
+ scroll() causes the window to scroll up one line. This involves
moving the lines in the window data strcture.
-
- With a positive n, scrl() and wscrl() scroll the window up n
- lines (line i + n becomes i); otherwise they scroll the window
+
+ With a positive n, scrl() and wscrl() scroll the window up n
+ lines (line i + n becomes i); otherwise they scroll the window
down n lines.
-
- For these functions to work, scrolling must be enabled via
- scrollok(). Note also that scrolling is not allowed if the
+
+ For these functions to work, scrolling must be enabled via
+ scrollok(). Note also that scrolling is not allowed if the
supplied window is a pad.
Return Value:
dir = -1;
}
- for (l = 0; l < (n * dir); l++)
+ for (l = 0; l < (n * dir); l++)
{
temp = win->_y[start];
wchar_t *slk_wlabel(int labnum)
Description:
- These functions manipulate a window that contain Soft Label Keys
- (SLK). To use the SLK functions, a call to slk_init() must be
- made BEFORE initscr() or newterm(). slk_init() removes 1 or 2
+ These functions manipulate a window that contain Soft Label Keys
+ (SLK). To use the SLK functions, a call to slk_init() must be
+ made BEFORE initscr() or newterm(). slk_init() removes 1 or 2
lines from the useable screen, depending on the format selected.
- The line(s) removed from the screen are used as a separate
+ The line(s) removed from the screen are used as a separate
window, in which SLKs are displayed.
- slk_init() requires a single parameter which describes the
+ slk_init() requires a single parameter which describes the
format of the SLKs as follows:
-
+
0 3-2-3 format
1 4-4 format
2 4-4-4 format (ncurses extension)
if (SP)
return ERR;
- switch (fmt)
+ switch (fmt)
{
case 0: /* 3 - 2 - 3 */
labels = LABEL_NORMAL;
labnum--;
- if (!label || !(*label))
+ if (!label || !(*label))
{
/* Clear the label */
col += label_length;
if (i == 3)
- col = COLS - (label_length * 4) + 1;
+ col = COLS - (label_length * 4) + 1;
}
break;
if (!SP->slk_winptr)
{
- if ( !(SP->slk_winptr = newwin(SP->slklines, COLS,
+ if ( !(SP->slk_winptr = newwin(SP->slklines, COLS,
LINES - SP->slklines, 0)) )
return;
PDC_LOG(("PDC_mouse_in_slk() - called: y->%d x->%d\n", y, x));
- /* If the line on which the mouse was clicked is NOT the last line
+ /* If the line on which the mouse was clicked is NOT the last line
of the screen, we are not interested in it. */
if (!slk || !SP->slk_winptr || (y != SP->slk_winptr->_begy + label_line))
labnum--;
- if (!label || !(*label))
+ if (!label || !(*label))
{
/* Clear the label */
char wordchar(void);
Description:
- baudrate() is supposed to return the output speed of the
+ baudrate() is supposed to return the output speed of the
terminal. In PDCurses, it simply returns INT_MAX.
- has_ic and has_il() return TRUE. These functions have meaning in
+ has_ic and has_il() return TRUE. These functions have meaning in
some other implementations of curses.
- erasechar() and killchar() return ^H and ^U, respectively -- the
- ERASE and KILL characters. In other curses implementations,
- these may vary by terminal type. erasewchar() and killwchar()
- are the wide-character versions; they take a pointer to a
+ erasechar() and killchar() return ^H and ^U, respectively -- the
+ ERASE and KILL characters. In other curses implementations,
+ these may vary by terminal type. erasewchar() and killwchar()
+ are the wide-character versions; they take a pointer to a
location in which to store the character, and return OK or ERR.
longname() returns a pointer to a static area containing a
termattrs() returns a logical OR of all video attributes
supported by the terminal.
- wordchar() is a PDCurses extension of the concept behind the
- functions erasechar() and killchar(), returning the "delete
+ wordchar() is a PDCurses extension of the concept behind the
+ functions erasechar() and killchar(), returning the "delete
word" character, ^W.
Portability X/Open BSD SYS V
{
PDC_LOG(("term_attrs() - called\n"));
- return WA_BLINK | WA_BOLD | WA_INVIS | WA_LEFT | WA_REVERSE |
+ return WA_BLINK | WA_BOLD | WA_INVIS | WA_LEFT | WA_REVERSE |
WA_RIGHT | WA_UNDERLINE;
}
int tputs(const char *, int, int (*)(int));
Description:
- mvcur() lets you move the physical cursor without updating any
+ mvcur() lets you move the physical cursor without updating any
window cursor positions. It returns OK or ERR.
- The rest of these functions are currently implemented as stubs,
+ The rest of these functions are currently implemented as stubs,
returning the appropriate errors and doing nothing else.
Portability X/Open BSD SYS V
bool is_wintouched(WINDOW *win);
Description:
- touchwin() and touchline() throw away all information about
- which parts of the window have been touched, pretending that the
- entire window has been drawn on. This is sometimes necessary
- when using overlapping windows, since a change to one window
- will affect the other window, but the records of which lines
- have been changed in the other window will not reflect the
+ touchwin() and touchline() throw away all information about
+ which parts of the window have been touched, pretending that the
+ entire window has been drawn on. This is sometimes necessary
+ when using overlapping windows, since a change to one window
+ will affect the other window, but the records of which lines
+ have been changed in the other window will not reflect the
change.
- untouchwin() marks all lines in the window as unchanged since
+ untouchwin() marks all lines in the window as unchanged since
the last call to wrefresh().
- wtouchln() makes n lines in the window, starting at line y, look
- as if they have (changed == 1) or have not (changed == 0) been
+ wtouchln() makes n lines in the window, starting at line y, look
+ as if they have (changed == 1) or have not (changed == 0) been
changed since the last call to wrefresh().
- is_linetouched() returns TRUE if the specified line in the
- specified window has been changed since the last call to
+ is_linetouched() returns TRUE if the specified line in the
+ specified window has been changed since the last call to
wrefresh().
- is_wintouched() returns TRUE if the specified window
+ is_wintouched() returns TRUE if the specified window
has been changed since the last call to wrefresh().
Return Value:
win->_firstch[i] = 0;
win->_lastch[i] = win->_maxx - 1;
}
- else
+ else
{
win->_firstch[i] = _NO_CHANGE;
win->_lastch[i] = _NO_CHANGE;
size_t PDC_wcstombs(char *dest, const wchar_t *src, size_t n);
Description:
- unctrl() expands the text portion of the chtype c into a
- printable string. Control characters are changed to the "^X"
- notation; others are passed through. wunctrl() is the wide-
+ unctrl() expands the text portion of the chtype c into a
+ printable string. Control characters are changed to the "^X"
+ notation; others are passed through. wunctrl() is the wide-
character version of the function.
filter() and use_env() are no-ops in PDCurses.
delay_output() inserts an ms millisecond pause in output.
- getcchar() works in two modes: When wch is not NULL, it reads
- the cchar_t pointed to by wcval and stores the attributes in
+ getcchar() works in two modes: When wch is not NULL, it reads
+ the cchar_t pointed to by wcval and stores the attributes in
attrs, the color pair in color_pair, and the text in the
- wide-character string wch. When wch is NULL, getcchar() merely
- returns the number of wide characters in wcval. In either mode,
+ wide-character string wch. When wch is NULL, getcchar() merely
+ returns the number of wide characters in wcval. In either mode,
the opts argument is unused.
- setcchar constructs a cchar_t at wcval from the wide-character
- text at wch, the attributes in attr and the color pair in
+ setcchar constructs a cchar_t at wcval from the wide-character
+ text at wch, the attributes in attr and the color pair in
color_pair. The opts argument is unused.
Currently, the length returned by getcchar() is always 1 or 0.
Similarly, setcchar() will only take the first wide character
from wch, and ignore any others that it "should" take (i.e.,
- combining characters). Nor will it correctly handle any
+ combining characters). Nor will it correctly handle any
character outside the basic multilingual plane (UCS-2).
Return Value:
- unctrl() and wunctrl() return NULL on failure. delay_output()
+ unctrl() and wunctrl() return NULL on failure. delay_output()
always returns OK.
- getcchar() returns the number of wide characters wcval points to
- when wch is NULL; when it's not, getcchar() returns OK or ERR.
+ getcchar() returns the number of wide characters wcval points to
+ when wch is NULL; when it's not, getcchar() returns OK or ERR.
setcchar() returns OK or ERR.
LINES - begy; ncols to COLS - begx. Create a new full-screen
window by calling newwin(0, 0, 0, 0).
- delwin() deletes the named window, freeing all associated
- memory. In the case of overlapping windows, subwindows should be
+ delwin() deletes the named window, freeing all associated
+ memory. In the case of overlapping windows, subwindows should be
deleted before the main window.
mvwin() moves the window so that the upper left-hand corner is
wsyncdown() causes a touchwin() of the current window if any of
its parent's windows have been touched.
- resize_window() allows the user to resize an existing window. It
+ resize_window() allows the user to resize an existing window. It
returns the pointer to the new window, or NULL on failure.
wresize() is an ncurses-compatible wrapper for resize_window().
Note that, unlike ncurses, it will NOT process any subwindows of
- the window. (However, you still can call it _on_ subwindows.) It
+ the window. (However, you still can call it _on_ subwindows.) It
returns OK or ERR.
PDC_makenew() allocates all data for a new WINDOW * except the
int PDC_clearclipboard(void);
Description:
- PDC_getclipboard() gets the textual contents of the system's
- clipboard. This function returns the contents of the clipboard
- in the contents argument. It is the responsibilitiy of the
+ PDC_getclipboard() gets the textual contents of the system's
+ clipboard. This function returns the contents of the clipboard
+ in the contents argument. It is the responsibilitiy of the
caller to free the memory returned, via PDC_freeclipboard().
- The length of the clipboard contents is returned in the length
+ The length of the clipboard contents is returned in the length
argument.
- PDC_setclipboard copies the supplied text into the system's
+ PDC_setclipboard copies the supplied text into the system's
clipboard, emptying the clipboard prior to the copy.
PDC_clearclipboard() clears the internal clipboard.
Return Values:
indicator of success/failure of call.
PDC_CLIP_SUCCESS the call was successful
- PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
+ PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
the clipboard contents
PDC_CLIP_EMPTY the clipboard contains no text
PDC_CLIP_ACCESS_ERROR no clipboard support
{
PDC_LOG(("PDC_clearclipboard() - called\n"));
- if (pdc_SDL_clipboard)
+ if (pdc_SDL_clipboard)
{
free(pdc_SDL_clipboard);
pdc_SDL_clipboard = NULL;
{
if (rectcount)
{
- /* if the maximum number of rects has been reached, we're
+ /* if the maximum number of rects has been reached, we're
probably better off doing a full screen update */
if (rectcount == MAXRECT)
if (newfg != foregr)
{
- SDL_SetPalette(pdc_font, SDL_LOGPAL,
+ SDL_SetPalette(pdc_font, SDL_LOGPAL,
pdc_color + newfg, pdc_flastc, 1);
foregr = newfg;
}
if (!SP->visibility)
return;
- /* draw a new cursor by overprinting the existing character in
- reverse, either the full cell (when visibility == 2) or the
+ /* draw a new cursor by overprinting the existing character in
+ reverse, either the full cell (when visibility == 2) or the
lowest quarter of it (when visibility == 1) */
ch = curscr->_y[row][col] ^ A_REVERSE;
else
if (lastrect.y != dest.y)
uprect[rectcount++] = dest;
- }
+ }
else
uprect[rectcount++] = dest;
unsigned long PDC_get_input_fd(void);
Description:
- PDC_get_input_fd() returns the file descriptor that PDCurses
+ PDC_get_input_fd() returns the file descriptor that PDCurses
reads its input from. It can be used for select().
Portability X/Open BSD SYS V
Uint32 current = SDL_GetTicks();
int haveevent = SDL_PollEvent(&event);
- /* if we have an event, or 30 ms have passed without a screen
+ /* if we have an event, or 30 ms have passed without a screen
update, or the timer has wrapped, update now */
if (haveevent ||
PDC_set_blink() toggles whether the A_BLINK attribute sets an
actual blink mode (TRUE), or sets the background color to high
intensity (FALSE). The default is platform-dependent (FALSE in
- most cases). It returns OK if it could set the state to match
- the given parameter, ERR otherwise. Current platforms also
- adjust the value of COLORS according to this function -- 16 for
+ most cases). It returns OK if it could set the state to match
+ the given parameter, ERR otherwise. Current platforms also
+ adjust the value of COLORS according to this function -- 16 for
FALSE, and 8 for TRUE.
PDC_set_title() sets the title of the window in which the curses
#include <stdlib.h>
#include <time.h>
-/* You could #include pdcsdl.h, or just add the relevant declarations
+/* You could #include pdcsdl.h, or just add the relevant declarations
here: */
PDCEX SDL_Surface *pdc_screen;
dest.w = i;
dest.h = j;
- SDL_FillRect(pdc_screen, &dest,
+ SDL_FillRect(pdc_screen, &dest,
SDL_MapRGB(pdc_screen->format, rand() % 256,
rand() % 256, rand() % 256));
}
/* $Id: term.h,v 1.16 2008/07/13 16:08:16 wmcbrine Exp $ */
-/* PDCurses doesn't operate with terminfo, but we need these functions for
- compatibility, to allow some things (notably, interface libraries for
- other languages) to be compiled. Anyone who tries to actually _use_
+/* PDCurses doesn't operate with terminfo, but we need these functions for
+ compatibility, to allow some things (notably, interface libraries for
+ other languages) to be compiled. Anyone who tries to actually _use_
them will be disappointed, since they only return ERR. */
#ifndef __PDCURSES_TERM_H__
int tigetflag(const char *);
int tigetnum(const char *);
char *tigetstr(const char *);
-char *tparm(const char *, long, long, long, long, long,
+char *tparm(const char *, long, long, long, long, long,
long, long, long, long);
int tputs(const char *, int, int (*)(int));
int PDC_clearclipboard(void);
Description:
- PDC_getclipboard() gets the textual contents of the system's
- clipboard. This function returns the contents of the clipboard
- in the contents argument. It is the responsibilitiy of the
+ PDC_getclipboard() gets the textual contents of the system's
+ clipboard. This function returns the contents of the clipboard
+ in the contents argument. It is the responsibilitiy of the
caller to free the memory returned, via PDC_freeclipboard().
- The length of the clipboard contents is returned in the length
+ The length of the clipboard contents is returned in the length
argument.
- PDC_setclipboard copies the supplied text into the system's
+ PDC_setclipboard copies the supplied text into the system's
clipboard, emptying the clipboard prior to the copy.
PDC_clearclipboard() clears the internal clipboard.
Return Values:
indicator of success/failure of call.
PDC_CLIP_SUCCESS the call was successful
- PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
+ PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
the clipboard contents
PDC_CLIP_EMPTY the clipboard contains no text
PDC_CLIP_ACCESS_ERROR no clipboard support
if (!OpenClipboard(NULL))
return PDC_CLIP_ACCESS_ERROR;
- ptr1 = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
+ ptr1 = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
(length + 1) * sizeof(TCHAR));
if (!ptr1)
{
A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9), A(10),
A(11), A(12), A(13), A(14), A(15), A(16), A(17), A(18), A(19),
- A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27), A(28),
- A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&', '\'', '(',
+ A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27), A(28),
+ A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&', '\'', '(',
')', '*',
# ifdef PDC_WIDE
int PDC_get_cursor_mode(void)
{
CONSOLE_CURSOR_INFO ci;
-
+
PDC_LOG(("PDC_get_cursor_mode() - called\n"));
GetConsoleCursorInfo(pdc_con_out, &ci);
unsigned long PDC_get_input_fd(void);
Description:
- PDC_get_input_fd() returns the file descriptor that PDCurses
+ PDC_get_input_fd() returns the file descriptor that PDCurses
reads its input from. It can be used for select().
Portability X/Open BSD SYS V
#define MEV save_ip.Event.MouseEvent
/************************************************************************
- * Table for key code translation of function keys in keypad mode *
+ * Table for key code translation of function keys in keypad mode *
* These values are for strict IBM keyboard compatibles only *
************************************************************************/
{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
}
else
{
- /* Check for diacritics. These are dead keys. Some locales
- have modified characters like umlaut-a, which is an "a"
- with two dots on it. In some locales you have to press a
- special key (the dead key) immediately followed by the
- "a" to get a composed umlaut-a. The special key may have
+ /* Check for diacritics. These are dead keys. Some locales
+ have modified characters like umlaut-a, which is an "a"
+ with two dots on it. In some locales you have to press a
+ special key (the dead key) immediately followed by the
+ "a" to get a composed umlaut-a. The special key may have
a normal meaning with different modifiers. */
if (KEV.uChar.UnicodeChar || !(MapVirtualKey(vk, 2) & 0x80000000))
int PDC_mouse_set(void)
{
- /* If turning on mouse input: Set ENABLE_MOUSE_INPUT, and clear
+ /* If turning on mouse input: Set ENABLE_MOUSE_INPUT, and clear
all other flags, including the extended flags;
- If turning off the mouse: Set QuickEdit Mode to the status it
+ If turning off the mouse: Set QuickEdit Mode to the status it
had on startup, and clear all other flags */
SetConsoleMode(pdc_con_in, SP->_trap_mbe ?
enum { PDC_RESTORE_NONE, PDC_RESTORE_BUFFER, PDC_RESTORE_WINDOW };
-/* Struct for storing console registry keys, and for use with the
- undocumented WM_SETCONSOLEINFO message. Originally by James Brown,
+/* Struct for storing console registry keys, and for use with the
+ undocumented WM_SETCONSOLEINFO message. Originally by James Brown,
www.catch22.net. */
static struct
ULONG QuickEdit;
ULONG AutoPosition;
ULONG InsertMode;
-
+
USHORT ScreenColors;
USHORT PopupColors;
ULONG HistoryNoDup;
ULONG HistoryBufferSize;
ULONG NumberOfHistoryBuffers;
-
+
COLORREF ColorTable[16];
ULONG CodePage;
#define WM_SETCONSOLEINFO (WM_USER + 201)
-/* Wrapper around WM_SETCONSOLEINFO. We need to create the necessary
- section (file-mapping) object in the context of the process which
+/* Wrapper around WM_SETCONSOLEINFO. We need to create the necessary
+ section (file-mapping) object in the context of the process which
owns the console, before posting the message. Originally by JB. */
static void _set_console_info(void)
/* Open the process which "owns" the console */
GetWindowThreadProcessId(console_info.Hwnd, &dwConsoleOwnerPid);
-
+
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwConsoleOwnerPid);
/* Create a SECTION object backed by page-file, then map a view of
console_info.AutoPosition = 0x10000;
console_info.ScreenColors = SP->orig_back << 4 | SP->orig_fore;
console_info.PopupColors = 0xf5;
-
+
console_info.HistoryNoDup = FALSE;
console_info.HistoryBufferSize = 50;
console_info.NumberOfHistoryBuffers = 4;
origin.X = origin.Y = 0;
- if (!WriteConsoleOutput(pdc_con_out, ci_save, orig_scr.dwSize,
+ if (!WriteConsoleOutput(pdc_con_out, ci_save, orig_scr.dwSize,
origin, &rect))
return;
}
if (!ReadConsoleOutput(pdc_con_out, ci_save, bufsize, origin, &rect))
{
- /* We can't save the complete buffer, so try and save just
+ /* We can't save the complete buffer, so try and save just
the displayed window */
free(ci_save);
rect.Bottom = orig_scr.srWindow.Bottom;
rect.Right = orig_scr.srWindow.Right;
- if (!ReadConsoleOutput(pdc_con_out, ci_save, bufsize,
+ if (!ReadConsoleOutput(pdc_con_out, ci_save, bufsize,
origin, &rect))
{
#ifdef PDCDEBUG
CHAR LastError[256];
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
- GetLastError(), MAKELANGID(LANG_NEUTRAL,
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+ GetLastError(), MAKELANGID(LANG_NEUTRAL,
SUBLANG_DEFAULT), LastError, 256, NULL);
PDC_LOG(("PDC_scr_open() - %s\n", LastError));
return OK;
}
- /* Calls SetConsoleWindowInfo with the given parameters, but fits them
- if a scoll bar shrinks the maximum possible value. The rectangle
+ /* Calls SetConsoleWindowInfo with the given parameters, but fits them
+ if a scoll bar shrinks the maximum possible value. The rectangle
must at least fit in a half-sized window. */
static BOOL _fit_console_window(HANDLE con_out, CONST SMALL_RECT *rect)
PDC_set_blink() toggles whether the A_BLINK attribute sets an
actual blink mode (TRUE), or sets the background color to high
intensity (FALSE). The default is platform-dependent (FALSE in
- most cases). It returns OK if it could set the state to match
- the given parameter, ERR otherwise. Current platforms also
- adjust the value of COLORS according to this function -- 16 for
+ most cases). It returns OK if it could set the state to match
+ the given parameter, ERR otherwise. Current platforms also
+ adjust the value of COLORS according to this function -- 16 for
FALSE, and 8 for TRUE.
PDC_set_title() sets the title of the window in which the curses
* *
************************************************************************/
-static XtResource resources[] =
+static XtResource resources[] =
{
{ XtNhSpace, XtCHSpace, XtRDimension, sizeof(Dimension),
- XtOffset(ScrollBoxWidget, scrollBox.h_space),
+ XtOffset(ScrollBoxWidget, scrollBox.h_space),
XtRImmediate, (XtPointer)4 },
{ XtNvSpace, XtCVSpace, XtRDimension, sizeof(Dimension),
- XtOffset(ScrollBoxWidget, scrollBox.v_space),
+ XtOffset(ScrollBoxWidget, scrollBox.v_space),
XtRImmediate, (XtPointer)4 },
{ XtNheightInc, XtCHeightInc, XtRDimension, sizeof(Dimension),
- XtOffset(ScrollBoxWidget, scrollBox.increment_height),
+ XtOffset(ScrollBoxWidget, scrollBox.increment_height),
XtRImmediate, (XtPointer)13 },
{ XtNwidthInc, XtCWidthInc, XtRDimension, sizeof(Dimension),
- XtOffset(ScrollBoxWidget, scrollBox.increment_width),
+ XtOffset(ScrollBoxWidget, scrollBox.increment_width),
XtRImmediate, (XtPointer)7 },
};
* *
************************************************************************/
-/* Do a layout, either actually assigning positions, or just
+/* Do a layout, either actually assigning positions, or just
calculating size. */
static void DoLayout(Widget w, Boolean doit)
XtAppError(XtWidgetToApplicationContext(w),
"ScrollBox: must manage exactly three widgets.");
- for (i = 0; i < sbw->composite.num_children; i++)
+ for (i = 0; i < sbw->composite.num_children; i++)
{
child = sbw->composite.children[i];
- if (!XtIsManaged(child))
+ if (!XtIsManaged(child))
XtAppError(XtWidgetToApplicationContext(w),
"ScrollBox: all three widgets must be managed.");
}
- /* Child one is the main window, two is the vertical scrollbar,
+ /* Child one is the main window, two is the vertical scrollbar,
and three is the horizontal scrollbar. */
wmain = sbw->composite.children[0];
sbw->scrollBox.increment_height) +
sbw->scrollBox.increment_height;
- vx = wmain->core.x + mw + sbw->scrollBox.h_space +
- wmain->core.border_width + vscroll->core.border_width;
+ vx = wmain->core.x + mw + sbw->scrollBox.h_space +
+ wmain->core.border_width + vscroll->core.border_width;
- hy = wmain->core.y + mh + sbw->scrollBox.v_space +
- wmain->core.border_width + hscroll->core.border_width;
+ hy = wmain->core.y + mh + sbw->scrollBox.v_space +
+ wmain->core.border_width + hscroll->core.border_width;
vh = mh; /* scrollbars are always same length as main window */
hw = mw;
}
/* Calculate preferred size. We can't just use the current sizes
- of the children, because that calculation would always end up with
- our current size. Could query each child, and use that size to
- recalculate a size for us, then if it ends up being larger than width
- and height passed in, accept bounding box. However, we know our
- children and they don't have any particular preferred geometry,
- except the bigger the better. Therefore, if the parent suggested a
+ of the children, because that calculation would always end up with
+ our current size. Could query each child, and use that size to
+ recalculate a size for us, then if it ends up being larger than width
+ and height passed in, accept bounding box. However, we know our
+ children and they don't have any particular preferred geometry,
+ except the bigger the better. Therefore, if the parent suggested a
size, we'll take it. */
static XtGeometryResult QueryGeometry(Widget w, XtWidgetGeometry *request,
/* if proposed size is large enough, accept it. Otherwise, suggest
our arbitrary initial size. */
- if (request->request_mode & CWHeight)
+ if (request->request_mode & CWHeight)
{
- if (request->height < INITIAL_HEIGHT)
+ if (request->height < INITIAL_HEIGHT)
{
result = XtGeometryAlmost;
reply_return->height = INITIAL_HEIGHT;
result = XtGeometryYes;
}
- if (request->request_mode & CWWidth)
+ if (request->request_mode & CWWidth)
{
- if (request->width < INITIAL_WIDTH)
+ if (request->width < INITIAL_WIDTH)
{
result = XtGeometryAlmost;
reply_return->width = INITIAL_WIDTH;
}
-static Boolean SetValues(Widget current, Widget request, Widget new,
+static Boolean SetValues(Widget current, Widget request, Widget new,
ArgList args, Cardinal *num_args)
{
ScrollBoxWidget sbwcurrent = (ScrollBoxWidget)current;
$Id: ScrollBoxP.h,v 1.5 2008/07/14 04:24:52 wmcbrine Exp $
*/
-/*
+/*
* scrollBoxP.h - Private definitions for scrollBox widget
- *
+ *
*/
#ifndef _XORAscrollBoxP_h
/* $Id: compose.h,v 1.3 2008/07/14 04:24:52 wmcbrine Exp $ */
-/* Tables and variables for the built-in compose key system. This file
+/* Tables and variables for the built-in compose key system. This file
is not included when PDCurses is built with XIM support. */
#define MAX_COMPOSE_CHARS 14
*
* This file is only used with the ncurses test programs.
*
- * Have ncurses-5.6 unpacked in your $(HOME) (you don't need to build
- * it), or edit ncurses_testdir appropriately in the Makefile. Configure
- * and build PDCurses for X11. (Sorry, other ports won't work yet.)
+ * Have ncurses-5.6 unpacked in your $(HOME) (you don't need to build
+ * it), or edit ncurses_testdir appropriately in the Makefile. Configure
+ * and build PDCurses for X11. (Sorry, other ports won't work yet.)
* Change to this directory, and:
*
* "make ncurses_tests" to start.
# define USE_WIDEC_SUPPORT 1
#endif
-/* Fool ncurses.c so it gives us all the tests, and doesn't redefine
+/* Fool ncurses.c so it gives us all the tests, and doesn't redefine
ACS_ chars
*/
int PDC_clearclipboard(void);
Description:
- PDC_getclipboard() gets the textual contents of the system's
- clipboard. This function returns the contents of the clipboard
- in the contents argument. It is the responsibilitiy of the
+ PDC_getclipboard() gets the textual contents of the system's
+ clipboard. This function returns the contents of the clipboard
+ in the contents argument. It is the responsibilitiy of the
caller to free the memory returned, via PDC_freeclipboard().
- The length of the clipboard contents is returned in the length
+ The length of the clipboard contents is returned in the length
argument.
- PDC_setclipboard copies the supplied text into the system's
+ PDC_setclipboard copies the supplied text into the system's
clipboard, emptying the clipboard prior to the copy.
PDC_clearclipboard() clears the internal clipboard.
Return Values:
indicator of success/failure of call.
PDC_CLIP_SUCCESS the call was successful
- PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
+ PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
the clipboard contents
PDC_CLIP_EMPTY the clipboard contains no text
PDC_CLIP_ACCESS_ERROR no clipboard support
0x2534, 0x252c, 0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3,
0x00b7,
# else
- A(7), A(8), '#', 0xa4, A(11), A(12), A(13), A(14), A(15), A(16),
- A(17), A(18), A(19), A(20), A(21), A(22), A(23), A(24), A(25),
+ A(7), A(8), '#', 0xa4, A(11), A(12), A(13), A(14), A(15), A(16),
+ A(17), A(18), A(19), A(20), A(21), A(22), A(23), A(24), A(25),
A(26), A(27), A(28), A(29), A(30), 0xb7,
# endif
unsigned long PDC_get_input_fd(void);
Description:
- PDC_get_input_fd() returns the file descriptor that PDCurses
+ PDC_get_input_fd() returns the file descriptor that PDCurses
reads its input from. It can be used for select().
Portability X/Open BSD SYS V
FD_ZERO(&xc_readfds);
FD_SET(xc_key_sock, &xc_readfds);
- if ((s = select(FD_SETSIZE, (FD_SET_CAST)&xc_readfds, NULL,
+ if ((s = select(FD_SETSIZE, (FD_SET_CAST)&xc_readfds, NULL,
NULL, &socket_timeout)) < 0)
XCursesExitCursesProcess(3, "child - exiting from "
"PDC_check_key select failed");
XCursesCOLS = SP->cols;
PDC_LOG(("%s:shmid_Xcurscr %d shmkey_Xcurscr %d SP->lines %d "
- "SP->cols %d\n", XCLOGMSG, shmid_Xcurscr,
+ "SP->cols %d\n", XCLOGMSG, shmid_Xcurscr,
shmkey_Xcurscr, SP->lines, SP->cols));
Xcurscr = (unsigned char*)shmat(shmid_Xcurscr, 0, 0);
PDC_set_blink() toggles whether the A_BLINK attribute sets an
actual blink mode (TRUE), or sets the background color to high
intensity (FALSE). The default is platform-dependent (FALSE in
- most cases). It returns OK if it could set the state to match
- the given parameter, ERR otherwise. Current platforms also
- adjust the value of COLORS according to this function -- 16 for
+ most cases). It returns OK if it could set the state to match
+ the given parameter, ERR otherwise. Current platforms also
+ adjust the value of COLORS according to this function -- 16 for
FALSE, and 8 for TRUE.
PDC_set_title() sets the title of the window in which the curses
SP->resized = FALSE;
memcpy(buf, &rc, sizeof(int));
-
+
return 0;
}
if (wait_value != CURSES_CHILD)
return ERR;
- /* Set LINES and COLS now so that the size of the shared memory
+ /* Set LINES and COLS now so that the size of the shared memory
segment can be allocated */
if ((shmidSP = shmget(shmkeySP, sizeof(SCREEN) + XCURSESSHMMIN, 0700)) < 0)
XC_LOG(("XCursesInitscr() - called\n"));
shmkeySP = getpid();
-
+
if (socketpair(AF_UNIX, SOCK_STREAM, 0, xc_display_sockets) < 0)
{
fprintf(stderr, "ERROR: cannot create display socketpair\n");
return ERR;
}
-
+
if (socketpair(AF_UNIX, SOCK_STREAM, 0, xc_key_sockets) < 0)
{
fprintf(stderr, "ERROR: cannot create key socketpair\n");
enum
{
- CURSES_CLEAR_SELECTION, CURSES_DISPLAY_CURSOR, CURSES_SET_SELECTION,
- CURSES_GET_SELECTION, CURSES_TITLE, CURSES_REFRESH_SCROLLBAR,
- CURSES_RESIZE, CURSES_BELL, CURSES_CONTINUE, CURSES_CURSOR,
- CURSES_CHILD, CURSES_REFRESH, CURSES_GET_COLOR, CURSES_SET_COLOR,
+ CURSES_CLEAR_SELECTION, CURSES_DISPLAY_CURSOR, CURSES_SET_SELECTION,
+ CURSES_GET_SELECTION, CURSES_TITLE, CURSES_REFRESH_SCROLLBAR,
+ CURSES_RESIZE, CURSES_BELL, CURSES_CONTINUE, CURSES_CURSOR,
+ CURSES_CHILD, CURSES_REFRESH, CURSES_GET_COLOR, CURSES_SET_COLOR,
CURSES_EXIT
};
CCOLOR(Black), CCOLOR(Red), CCOLOR(Green), CCOLOR(Yellow),
CCOLOR(Blue), CCOLOR(Magenta), CCOLOR(Cyan), CCOLOR(White),
- CCOLOR(BoldBlack), CCOLOR(BoldRed), CCOLOR(BoldGreen),
- CCOLOR(BoldYellow), CCOLOR(BoldBlue), CCOLOR(BoldMagenta),
+ CCOLOR(BoldBlack), CCOLOR(BoldRed), CCOLOR(BoldGreen),
+ CCOLOR(BoldYellow), CCOLOR(BoldBlue), CCOLOR(BoldMagenta),
CCOLOR(BoldCyan), CCOLOR(BoldWhite)
};
PDC_LOG(("%s:XCursesSigwinchHandler() - called: SIGNO: %d\n",
XCLOGMSG, signo));
- /* Patch by: Georg Fuchs, georg.fuchs@rz.uni-regensburg.de
+ /* Patch by: Georg Fuchs, georg.fuchs@rz.uni-regensburg.de
02-Feb-1999 */
SP->resized += 1;
#endif
}
-/* Convert character positions x and y to pixel positions, stored in
+/* Convert character positions x and y to pixel positions, stored in
xpos and ypos */
static void _make_xy(int x, int y, int *xpos, int *ypos)
{
*xpos = (x * font_width) + xc_app_data.borderWidth;
- *ypos = xc_app_data.normalFont->ascent + (y * font_height) +
+ *ypos = xc_app_data.normalFont->ascent + (y * font_height) +
xc_app_data.borderWidth;
}
start_col = (int)*(Xcurscr + XCURSCR_START_OFF + row);
_display_text((const chtype *)(Xcurscr + XCURSCR_Y_OFF(row) +
- (start_col * sizeof(chtype))), row, start_col,
+ (start_col * sizeof(chtype))), row, start_col,
num_cols, FALSE);
*(Xcurscr + XCURSCR_LENGTH_OFF + row) = 0;
{
XC_LOG(("ClientMessage received\n"));
- /* This code used to include handling of WM_SAVE_YOURSELF, but
- it resulted in continual failure of THE on my Toshiba laptop.
+ /* This code used to include handling of WM_SAVE_YOURSELF, but
+ it resulted in continual failure of THE on my Toshiba laptop.
Removed on 3-3-2001. Now only exits on WM_DELETE_WINDOW. */
if ((Atom)client_event->data.s[0] == wm_atom[0])
if (event->type == KeyRelease)
{
- /* The keysym value was set by a previous call to this function
+ /* The keysym value was set by a previous call to this function
with a KeyPress event (or reset by the mouse event handler) */
if (SP->return_key_modifiers &&
#ifndef PDC_XIM
- keysym != compose_key &&
+ keysym != compose_key &&
#endif
IsModifierKey(keysym))
{
#ifndef PDC_XIM
- /* Check if the key just pressed is the user-specified compose
+ /* Check if the key just pressed is the user-specified compose
key; if it is, set the compose state and exit. */
if (keysym == compose_key)
SP->visibility = save_visibility;
_make_xy(SP->curscol, SP->cursrow, &xpos, &ypos);
- ch = (chtype *)(Xcurscr + XCURSCR_Y_OFF(SP->cursrow) +
+ ch = (chtype *)(Xcurscr + XCURSCR_Y_OFF(SP->cursrow) +
(SP->curscol * sizeof(chtype)));
_set_cursor_color(ch, &fore, &back);
XSetForeground(XCURSESDISPLAY, rect_cursor_gc, colors[back]);
- XDrawRectangle(XCURSESDISPLAY, XCURSESWIN, rect_cursor_gc,
- xpos + 1, ypos - font_height +
- xc_app_data.normalFont->descent + 1,
+ XDrawRectangle(XCURSESDISPLAY, XCURSESWIN, rect_cursor_gc,
+ xpos + 1, ypos - font_height +
+ xc_app_data.normalFont->descent + 1,
font_width - 2, font_height - 2);
compose_state = STATE_COMPOSE;
key = buffer[0];
compose_index = -1;
-
+
for (i = 0; i < (int)strlen(compose_chars); i++)
if (compose_chars[i] == key)
{
compose_state = STATE_NORMAL;
compose_index = 0;
-
+
_redraw_cursor();
return;
}
}
- /* After all that, send the key back to the application if is
+ /* After all that, send the key back to the application if is
NOT zero. */
if (key)
ptr = (unsigned char *)*params;
if (ptr[0] == '0' && ptr[1] == 'x' && ptr[2] != '\0')
- {
+ {
unsigned char c;
unsigned long total = 0;
if (!*type || !*length)
{
- XtGetSelectionValue(w, XA_PRIMARY, XA_STRING, _paste_string,
+ XtGetSelectionValue(w, XA_PRIMARY, XA_STRING, _paste_string,
event, ((XButtonEvent *)event)->time);
return;
}
if (*target == XA_TARGETS(XtDisplay(topLevel)))
{
- XSelectionRequestEvent *req = XtGetSelectionRequest(w,
+ XSelectionRequestEvent *req = XtGetSelectionRequest(w,
*selection, (XtRequestId)NULL);
Atom *targetP;
XPointer std_targets;
unsigned long std_length;
- XmuConvertStandardSelection(topLevel, req->time, selection,
+ XmuConvertStandardSelection(topLevel, req->time, selection,
target, type_return, &std_targets,
&std_length, format_return);
return True;
}
else
- return XmuConvertStandardSelection(topLevel, CurrentTime,
+ return XmuConvertStandardSelection(topLevel, CurrentTime,
selection, target, type_return, (XPointer*)value_return,
length_return, format_return);
}
_display_screen();
- selection_start_x = selection_start_y = selection_end_x =
+ selection_start_x = selection_start_y = selection_end_x =
selection_end_y = 0;
mouse_selection = FALSE;
static void _selection_extend(int x, int y)
{
- int temp, current_start, current_end, current_start_x,
- current_end_x, current_start_y, current_end_y, new_start,
+ int temp, current_start, current_end, current_start_x,
+ current_end_x, current_start_y, current_end_y, new_start,
new_end, new_start_x, new_end_x, new_start_y, new_end_y;
XC_LOG(("_selection_extend() - called\n"));
current_start_y = selection_start_y;
}
- /* Now we have the current selection as a linear expression.
+ /* Now we have the current selection as a linear expression.
Convert the new position to a linear expression. */
selection_end_x = x;
}
if (new_end > current_end)
- _show_selection(current_end_x, current_end_y, new_end_x,
+ _show_selection(current_end_x, current_end_y, new_end_x,
new_end_y, TRUE);
else if (new_end < current_end)
- _show_selection(new_end_x, new_end_y, current_end_x,
+ _show_selection(new_end_x, new_end_y, current_end_x,
current_end_y, FALSE);
else if (new_start < current_start)
- _show_selection(new_start_x, new_start_y, current_start_x,
+ _show_selection(new_start_x, new_start_y, current_start_x,
current_start_y, TRUE);
else if (new_start > current_start)
- _show_selection(current_start_x, current_start_y,
+ _show_selection(current_start_x, current_start_y,
new_start_x, new_start_y, FALSE);
else
- _show_selection(current_start_x, current_start_y,
+ _show_selection(current_start_x, current_start_y,
new_start_x, new_start_y, TRUE);
}
static void _selection_set(void)
{
- int i, j, start, end, start_x, end_x, start_y, end_y, num_cols,
+ int i, j, start, end, start_x, end_x, start_y, end_y, num_cols,
start_col, row, num_chars, ch, last_nonblank, length, newlen;
chtype *ptr = NULL;
PDC_LOG(("%s:_display_cursor() - draw char at row: %d col %d\n",
XCLOGMSG, old_row, old_x));
- /* if the cursor position is outside the boundary of the screen,
+ /* if the cursor position is outside the boundary of the screen,
ignore the request */
if (old_row >= XCursesLINES || old_x >= COLS ||
for (i = 1; i <= SP->visibility; i++)
XDrawLine(XCURSESDISPLAY, XCURSESWIN, rect_cursor_gc,
xpos + i, ypos - xc_app_data.normalFont->ascent,
- xpos + i, ypos - xc_app_data.normalFont->ascent +
+ xpos + i, ypos - xc_app_data.normalFont->ascent +
font_height - 1);
}
else
window_entered = FALSE;
- /* Display the cursor so it stays on while the window is
+ /* Display the cursor so it stays on while the window is
not current */
_redraw_cursor();
memset(&Mouse_status, 0, sizeof(Mouse_status));
- Mouse_status.changes = (button_no == 5) ?
+ Mouse_status.changes = (button_no == 5) ?
PDC_MOUSE_WHEEL_DOWN : PDC_MOUSE_WHEEL_UP;
MOUSE_X_POS = MOUSE_Y_POS = -1;
case MotionNotify:
MOUSE_LOG(("\nMotionNotify: y: %d x: %d Width: %d "
- "Height: %d\n", event->xbutton.y, event->xbutton.x,
+ "Height: %d\n", event->xbutton.y, event->xbutton.x,
font_width, font_height));
MOUSE_X_POS = (event->xbutton.x - xc_app_data.borderWidth) /
else
_selection_off();
- /* Throw away mouse movements if they are in the same character
- position as the last mouse event, or if we are currently in
+ /* Throw away mouse movements if they are in the same character
+ position as the last mouse event, or if we are currently in
the middle of a double click event. */
if ((MOUSE_X_POS == save_mouse_status.x &&
- MOUSE_Y_POS == save_mouse_status.y) ||
+ MOUSE_Y_POS == save_mouse_status.y) ||
save_mouse_status.button[button_no - 1] == BUTTON_DOUBLE_CLICKED)
{
send_key = FALSE;
if (!handle_real_release)
{
if ((event->xbutton.time - last_button_press_time) <
- SP->mouse_wait &&
+ SP->mouse_wait &&
(event->xbutton.time != last_button_press_time))
{
/* The "real" release was shorter than usleep() time;
{
send_key = FALSE;
- if (XtOwnSelection(topLevel, XA_PRIMARY,
+ if (XtOwnSelection(topLevel, XA_PRIMARY,
event->xbutton.time, _convert_proc,
_lose_ownership, NULL) == False)
_selection_off();
}
else
{
- /* Button release longer than usleep() time;
- therefore generate a press and wait for the real
+ /* Button release longer than usleep() time;
+ therefore generate a press and wait for the real
release to occur later. */
MOUSE_LOG(("Generated Release at: %ld - "
{
send_key = FALSE;
- if (XtOwnSelection(topLevel, XA_PRIMARY,
- event->xbutton.time, _convert_proc,
+ if (XtOwnSelection(topLevel, XA_PRIMARY,
+ event->xbutton.time, _convert_proc,
_lose_ownership, NULL) == False)
_selection_off();
BUTTON_STATUS(button_no), Mouse_status.changes));
MOUSE_LOG(("Send: %d Button1: %x Button2: %x Button3: %x %d %d\n",
- send_key, BUTTON_STATUS(1), BUTTON_STATUS(2),
+ send_key, BUTTON_STATUS(1), BUTTON_STATUS(2),
BUTTON_STATUS(3), XCursesLINES, XCursesCOLS));
if (!send_key || MOUSE_X_POS < 0 || MOUSE_X_POS >= XCursesCOLS ||
double viewport_y = (double)SP->sb_viewport_y;
int cur_y = SP->sb_cur_y;
- /* If the size of the viewport is > overall area simply return,
+ /* If the size of the viewport is > overall area simply return,
as no scrolling is permitted. */
if (SP->sb_viewport_y >= SP->sb_total_y)
XawScrollbarSetThumb(w, (double)(cur_x / total_x),
(double)(viewport_x / total_x));
-
+
_send_key_to_curses(KEY_SR, NULL, TRUE);
}
static void _resize(void)
{
- short save_atrtab[PDC_COLOR_PAIRS * 2];
+ short save_atrtab[PDC_COLOR_PAIRS * 2];
after_first_curses_request = FALSE;
if ((shmid_Xcurscr = shmget(shmkey_Xcurscr,
SP->XcurscrSize + XCURSESSHMMIN, 0700 | IPC_CREAT)) < 0)
- {
+ {
perror("Cannot allocate shared memory for curscr");
_exit_process(4, SIGKILL, "exiting from _process_curses_requests");
- }
+ }
Xcurscr = (unsigned char*)shmat(shmid_Xcurscr, 0, 0);
memset(Xcurscr, 0, SP->XcurscrSize);
static void _set_title(void)
{
- char title[1024]; /* big enough for window title */
+ char title[1024]; /* big enough for window title */
int pos;
if ((XC_read_socket(xc_display_sock, &pos, sizeof(int)) < 0) ||
}
else
{
- /* Here all is OK, send PDC_CLIP_SUCCESS, then length, then
+ /* Here all is OK, send PDC_CLIP_SUCCESS, then length, then
contents */
if (XC_write_display_socket_int(PDC_CLIP_SUCCESS) < 0)
wcontents[i] = 0;
len = i;
- /* Here all is OK, send PDC_CLIP_SUCCESS, then length, then
+ /* Here all is OK, send PDC_CLIP_SUCCESS, then length, then
contents */
if (XC_write_display_socket_int(PDC_CLIP_SUCCESS) >= 0)
if (XC_write_display_socket_int(len) >= 0)
- if (XC_write_socket(xc_display_sock,
+ if (XC_write_socket(xc_display_sock,
wcontents, len * sizeof(wchar_t)) >= 0)
{
free(wcontents);
/* The curses process sent us a message */
static void _process_curses_requests(XtPointer client_data, int *fid,
- XtInputId *id)
-{
+ XtInputId *id)
+{
struct timeval socket_timeout = {0};
int s;
int old_row, new_row;
int old_x, new_x;
int pos, num_cols;
- char buf[12]; /* big enough for 2 integers */
+ char buf[12]; /* big enough for 2 integers */
XC_LOG(("_process_curses_requests() - called\n"));
- if (!received_map_notify)
- return;
+ if (!received_map_notify)
+ return;
- FD_ZERO(&xc_readfds);
- FD_SET(xc_display_sock, &xc_readfds);
+ FD_ZERO(&xc_readfds);
+ FD_SET(xc_display_sock, &xc_readfds);
- if ((s = select(FD_SETSIZE, (FD_SET_CAST)&xc_readfds, NULL,
+ if ((s = select(FD_SETSIZE, (FD_SET_CAST)&xc_readfds, NULL,
NULL, &socket_timeout)) < 0)
_exit_process(2, SIGKILL, "exiting from _process_curses_requests"
" - select failed");
- if (!s) /* no requests pending - should never happen! */
- return;
+ if (!s) /* no requests pending - should never happen! */
+ return;
- if (FD_ISSET(xc_display_sock, &xc_readfds))
- {
+ if (FD_ISSET(xc_display_sock, &xc_readfds))
+ {
/* read first integer to determine total message has been
received */
XC_LOG(("_process_curses_requests() - before XC_read_socket()\n"));
- if (XC_read_socket(xc_display_sock, &num_cols, sizeof(int)) < 0)
+ if (XC_read_socket(xc_display_sock, &num_cols, sizeof(int)) < 0)
_exit_process(3, SIGKILL, "exiting from _process_curses_requests"
" - first read");
after_first_curses_request = TRUE;
- switch(num_cols)
- {
+ switch(num_cols)
+ {
case CURSES_EXIT: /* request from curses to stop */
XC_LOG(("CURSES_EXIT received from child\n"));
_exit_process(0, 0, "XCursesProcess requested to exit by child");
XBell(XCURSESDISPLAY, 50);
break;
- /* request from curses to confirm completion of display */
+ /* request from curses to confirm completion of display */
case CURSES_REFRESH:
XC_LOG(("CURSES_REFRESH received from child\n"));
- _refresh_screen();
+ _refresh_screen();
_resume_curses();
break;
_exit_process(5, SIGKILL, "exiting from CURSES_CURSOR "
"_process_curses_requests");
- memcpy(&pos, buf, sizeof(int));
+ memcpy(&pos, buf, sizeof(int));
old_row = pos & 0xFF;
old_x = pos >> 8;
cursor will stay solid. */
if (window_entered)
- {
- if (visible_cursor)
- {
+ {
+ if (visible_cursor)
+ {
/* Cursor currently ON, turn it off */
int save_visibility = SP->visibility;
SP->visibility = save_visibility;
visible_cursor = FALSE;
}
- else
- {
- /* Cursor currently OFF, turn it on */
+ else
+ {
+ /* Cursor currently OFF, turn it on */
_redraw_cursor();
visible_cursor = TRUE;
- }
- }
+ }
+ }
- break;
+ break;
case CURSES_TITLE:
XC_LOG(("CURSES_TITLE received from child\n"));
case CURSES_RESIZE:
XC_LOG(("CURSES_RESIZE received from child\n"));
_resize();
- _resume_curses();
- break;
+ _resume_curses();
+ break;
case CURSES_GET_SELECTION:
XC_LOG(("CURSES_GET_SELECTION received from child\n"));
_resume_curses();
break;
- default:
+ default:
PDC_LOG(("%s:Unknown request %d\n", XCLOGMSG, num_cols));
- }
- }
-}
+ }
+ }
+}
-static void _handle_structure_notify(Widget w, XtPointer client_data,
+static void _handle_structure_notify(Widget w, XtPointer client_data,
XEvent *event, Boolean *unused)
{
XC_LOG(("_handle_structure_notify() - called\n"));
/* Check application resource values here */
- font_width = xc_app_data.normalFont->max_bounds.rbearing -
+ font_width = xc_app_data.normalFont->max_bounds.rbearing -
xc_app_data.normalFont->min_bounds.lbearing;
- font_height = xc_app_data.normalFont->max_bounds.ascent +
+ font_height = xc_app_data.normalFont->max_bounds.ascent +
xc_app_data.normalFont->max_bounds.descent;
font_ascent = xc_app_data.normalFont->max_bounds.ascent;
xc_app_data.italicFont->max_bounds.rbearing -
xc_app_data.italicFont->min_bounds.lbearing ||
font_height !=
- xc_app_data.italicFont->max_bounds.ascent +
+ xc_app_data.italicFont->max_bounds.ascent +
xc_app_data.italicFont->max_bounds.descent;
/* Calculate size of display window */
if (xc_app_data.scrollbarWidth && sb_started)
{
- scrollBox = XtVaCreateManagedWidget(program_name,
- scrollBoxWidgetClass, topLevel, XtNwidth,
- window_width + xc_app_data.scrollbarWidth,
+ scrollBox = XtVaCreateManagedWidget(program_name,
+ scrollBoxWidgetClass, topLevel, XtNwidth,
+ window_width + xc_app_data.scrollbarWidth,
XtNheight, window_height + xc_app_data.scrollbarWidth,
XtNwidthInc, font_width, XtNheightInc, font_height, NULL);
- drawing = XtVaCreateManagedWidget(program_name,
- boxWidgetClass, scrollBox, XtNwidth,
- window_width, XtNheight, window_height, XtNwidthInc,
+ drawing = XtVaCreateManagedWidget(program_name,
+ boxWidgetClass, scrollBox, XtNwidth,
+ window_width, XtNheight, window_height, XtNwidthInc,
font_width, XtNheightInc, font_height, NULL);
- scrollVert = XtVaCreateManagedWidget("scrollVert",
- scrollbarWidgetClass, scrollBox, XtNorientation,
- XtorientVertical, XtNheight, window_height, XtNwidth,
+ scrollVert = XtVaCreateManagedWidget("scrollVert",
+ scrollbarWidgetClass, scrollBox, XtNorientation,
+ XtorientVertical, XtNheight, window_height, XtNwidth,
xc_app_data.scrollbarWidth, NULL);
XtAddCallback(scrollVert, XtNscrollProc, _scroll_up_down, drawing);
XtAddCallback(scrollVert, XtNjumpProc, _thumb_up_down, drawing);
- scrollHoriz = XtVaCreateManagedWidget("scrollHoriz",
- scrollbarWidgetClass, scrollBox, XtNorientation,
- XtorientHorizontal, XtNwidth, window_width, XtNheight,
+ scrollHoriz = XtVaCreateManagedWidget("scrollHoriz",
+ scrollbarWidgetClass, scrollBox, XtNorientation,
+ XtorientHorizontal, XtNwidth, window_width, XtNheight,
xc_app_data.scrollbarWidth, NULL);
XtAddCallback(scrollHoriz, XtNscrollProc, _scroll_left_right, drawing);
LINES = XCursesLINES;
COLS = XCursesCOLS;
- if ((shmidSP = shmget(shmkeySP, sizeof(SCREEN) + XCURSESSHMMIN,
+ if ((shmidSP = shmget(shmkeySP, sizeof(SCREEN) + XCURSESSHMMIN,
0700 | IPC_CREAT)) < 0)
{
perror("Cannot allocate shared memory for SCREEN");
PDC_LOG(("%s:SHM size for curscr %d\n", XCLOGMSG, SP->XcurscrSize));
- if ((shmid_Xcurscr = shmget(shmkey_Xcurscr, SP->XcurscrSize +
+ if ((shmid_Xcurscr = shmget(shmkey_Xcurscr, SP->XcurscrSize +
XCURSESSHMMIN, 0700 | IPC_CREAT)) < 0)
{
perror("Cannot allocate shared memory for curscr");
}
Xcurscr = (unsigned char *)shmat(shmid_Xcurscr, 0, 0);
- memset(Xcurscr, 0, SP->XcurscrSize);
+ memset(Xcurscr, 0, SP->XcurscrSize);
xc_atrtab = (short *)(Xcurscr + XCURSCR_ATRTAB_OFF);
PDC_LOG(("%s:shmid_Xcurscr %d shmkey_Xcurscr %d LINES %d COLS %d\n",
/* Add Event handlers to the drawing widget */
XtAddEventHandler(drawing, ExposureMask, False, _handle_expose, NULL);
- XtAddEventHandler(drawing, StructureNotifyMask, False,
+ XtAddEventHandler(drawing, StructureNotifyMask, False,
_handle_structure_notify, NULL);
XtAddEventHandler(drawing, EnterWindowMask | LeaveWindowMask, False,
_handle_enter_leave, NULL);
XtAddEventHandler(topLevel, 0, True, _handle_nonmaskable, NULL);
- /* Add input handler from xc_display_sock (requests from curses
+ /* Add input handler from xc_display_sock (requests from curses
program) */
- XtAppAddInput(app_context, xc_display_sock, (XtPointer)XtInputReadMask,
+ XtAppAddInput(app_context, xc_display_sock, (XtPointer)XtInputReadMask,
_process_curses_requests, NULL);
/* If there is a cursorBlink resource, start the Timeout event */
XtAppAddTimeOut(app_context, xc_app_data.cursorBlinkRate,
_blink_cursor, NULL);
- /* Leave telling the curses process that it can start to here so
- that when the curses process makes a request, the Xcurses
+ /* Leave telling the curses process that it can start to here so
+ that when the curses process makes a request, the Xcurses
process can service the request. */
XC_write_display_socket_int(CURSES_CHILD);
_get_gc(&normal_gc, xc_app_data.normalFont, COLOR_WHITE, COLOR_BLACK);
- _get_gc(&italic_gc, italic_font_valid ? xc_app_data.italicFont :
+ _get_gc(&italic_gc, italic_font_valid ? xc_app_data.italicFont :
xc_app_data.normalFont, COLOR_WHITE, COLOR_BLACK);
_get_gc(&block_cursor_gc, xc_app_data.normalFont,
MODULE_ID("$Id: fld_ftchoice.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_fieldtype_choice(
| FIELDTYPE *typ,
| bool (* const next_choice)(FIELD *,const void *),
MODULE_ID("$Id: fld_ftlink.c,v 1.14 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : FIELDTYPE *link_fieldtype(
| FIELDTYPE *type1,
| FIELDTYPE *type2)
-|
+|
| Description : Create a new fieldtype built from the two given types.
| They are connected by an logical 'OR'.
-| If an error occurs, errno is set to
+| If an error occurs, errno is set to
| E_BAD_ARGUMENT - invalid arguments
| E_SYSTEM_ERROR - system error (no memory)
|
MODULE_ID("$Id: fld_info.c,v 1.11 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int field_info(const FIELD *field,
| int *rows, int *cols,
| int *frow, int *fcol,
| int *nrow, int *nbuf)
-|
+|
| Description : Retrieve infos about the fields creation parameters.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int dynamic_field_info(const FIELD *field,
| int *drows, int *dcols,
| int *maxgrow)
-|
+|
| Description : Retrieve informations about a dynamic fields current
| dynamic parameters.
|
MODULE_ID("$Id: fld_just.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_field_just(FIELD *field, int just)
-|
+|
| Description : Set the fields type of justification.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int field_just( const FIELD *field )
-|
+|
| Description : Retrieve the fields type of justification
|
| Return Values : The justification type.
MODULE_ID("$Id: fld_link.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
-| Function : FIELD *link_field(FIELD *field, int frow, int fcol)
-|
+| Facility : libnform
+| Function : FIELD *link_field(FIELD *field, int frow, int fcol)
+|
| Description : Duplicates the field at the specified position. The
| new field shares its buffers with the original one,
| the attributes are independent.
| If an error occurs, errno is set to
-|
+|
| E_BAD_ARGUMENT - invalid argument
| E_SYSTEM_ERROR - system error
|
MODULE_ID("$Id: fld_max.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_max_field(FIELD *field, int maxgrow)
-|
+|
| Description : Set the maximum growth for a dynamic field. If maxgrow=0
| the field may grow to any possible size.
|
MODULE_ID("$Id: fld_move.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int move_field(FIELD *field,int frow, int fcol)
-|
+|
| Description : Moves the disconnected field to the new location in
| the forms subwindow.
|
--------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_field_opts(FIELD *field, Field_Options opts)
-|
+|
| Description : Turns on the named options for this field and turns
| off all the remaining options.
|
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : Field_Options field_opts(const FIELD *field)
-|
+|
| Description : Retrieve the fields options.
|
| Return Values : The options.
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int field_opts_on(FIELD *field, Field_Options opts)
-|
-| Description : Turns on the named options for this field and all the
+|
+| Description : Turns on the named options for this field and all the
| remaining options are unchanged.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int field_opts_off(FIELD *field, Field_Options opts)
-|
-| Description : Turns off the named options for this field and all the
+|
+| Description : Turns off the named options for this field and all the
| remaining options are unchanged.
|
| Return Values : E_OK - success
MODULE_ID("$Id: fld_pad.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_field_pad(FIELD *field, int ch)
-|
+|
| Description : Set the pad character used to fill the field. This must
| be a printable character.
|
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int field_pad(const FIELD *field)
-|
+|
| Description : Retrieve the fields pad character.
|
| Return Values : The pad character.
MODULE_ID("$Id: fld_page.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_new_page(FIELD *field, bool new_page_flag)
-|
-| Description : Marks the field as the beginning of a new page of
+|
+| Description : Marks the field as the beginning of a new page of
| the form.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : bool new_page(const FIELD *field)
-|
+|
| Description : Retrieve the info whether or not the field starts a
| new page on the form.
|
MODULE_ID("$Id: fld_stat.c,v 1.12 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_field_status(FIELD *field, bool status)
-|
+|
| Description : Set or clear the 'changed' indication flag for that
| fields primary buffer.
|
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : bool field_status(const FIELD *field)
-|
+|
| Description : Retrieve the value of the 'changed' indication flag
-| for that fields primary buffer.
+| for that fields primary buffer.
|
| Return Values : TRUE - buffer has been changed
| FALSE - buffer has not been changed
MODULE_ID("$Id: fld_type.c,v 1.16 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_field_type(FIELD *field, FIELDTYPE *type,...)
-|
+|
| Description : Associate the specified fieldtype with the field.
| Certain field types take additional arguments. Look
| at the spec of the field types !
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : FIELDTYPE *field_type(const FIELD *field)
-|
+|
| Description : Retrieve the associated fieldtype for this field.
|
| Return Values : Pointer to fieldtype of NULL if none is defined.
MODULE_ID("$Id: fld_user.c,v 1.16 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_field_userptr(FIELD *field, void *usrptr)
-|
+|
| Description : Set the pointer that is reserved in any field to store
| application relevant informations
|
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : void *field_userptr(const FIELD *field)
-|
+|
| Description : Return the pointer that is reserved in any field to
| store application relevant informations.
|
extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_IPV4(void);
extern NCURSES_EXPORT(FIELDTYPE *)
-_nc_generic_fieldtype(bool (*const field_check) (FORM*,
- FIELD *,
+_nc_generic_fieldtype(bool (*const field_check) (FORM*,
+ FIELD *,
const void *),
- bool (*const char_check) (int,
- FORM*,
- FIELD*,
+ bool (*const char_check) (int,
+ FORM*,
+ FIELD*,
const void *),
bool (*const next)(FORM*,FIELD*,const void*),
bool (*const prev)(FORM*,FIELD*,const void*),
MODULE_ID("$Id: frm_cursor.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int pos_form_cursor(FORM * form)
-|
+|
| Description : Moves the form window cursor to the location required
| by the form driver to resume form processing. This may
| be needed after the application calls a curses library
MODULE_ID("$Id: frm_data.c,v 1.15 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : bool data_behind(const FORM *form)
-|
+|
| Description : Check for off-screen data behind. This is nearly trivial
| because the beginning of a field is fixed.
|
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static char * Only_Padding(
| WINDOW *w,
| int len,
| int pad)
-|
+|
| Description : Test if 'length' cells starting at the current position
| contain a padding character.
|
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : bool data_ahead(const FORM *form)
-|
+|
| Description : Check for off-screen data ahead. This is more difficult
-| because a dynamic field has a variable end.
+| because a dynamic field has a variable end.
|
| Return Values : TRUE - there are off-screen data ahead
| FALSE - there are no off-screen data ahead
NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form;
\f
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static FIELD *Insert_Field_By_Position(
-| FIELD *new_field,
+| FIELD *new_field,
| FIELD *head )
-|
+|
| Description : Insert new_field into sorted fieldlist with head "head"
| and return new head of sorted fieldlist. Sorting
| criteria is (row,column). This is a circular list.
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static void Disconnect_Fields(FORM *form)
-|
+|
| Description : Break association between form and array of fields.
|
| Return Values : -
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static int Connect_Fields(FORM *form, FIELD **fields)
-|
+|
| Description : Set association between form and array of fields.
|
| Return Values : E_OK - no error
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static int Associate_Fields(FORM *form, FIELD **fields)
-|
-| Description : Set association between form and array of fields.
+|
+| Description : Set association between form and array of fields.
| If there are fields, position to first active field.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : FORM *new_form_sp(SCREEN* sp, FIELD** fields )
-|
+|
| Description : Create new form with given array of fields.
|
| Return Values : Pointer to form. NULL if error occurred.
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : FORM* new_form(FIELD** fields )
-|
+|
| Description : Create new form with given array of fields.
|
| Return Values : Pointer to form. NULL if error occurred.
#endif
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int free_form( FORM *form )
-|
+|
| Description : Release internal memory associated with form.
|
| Return Values : E_OK - no error
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_form_fields( FORM *form, FIELD **fields )
-|
+|
| Description : Set a new association of an array of fields to a form
|
| Return Values : E_OK - no error
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : FIELD **form_fields( const FORM *form )
-|
+|
| Description : Retrieve array of fields
|
| Return Values : Pointer to field array
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int field_count( const FORM *form )
-|
+|
| Description : Retrieve number of fields
|
| Return Values : Number of fields, -1 if none are defined
MODULE_ID("$Id: frm_opts.c,v 1.15 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_form_opts(FORM *form, Form_Options opts)
-|
+|
| Description : Turns on the named options and turns off all the
| remaining options for that form.
|
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : Form_Options form_opts(const FORM *)
-|
+|
| Description : Retrieves the current form options.
|
| Return Values : The option flags.
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int form_opts_on(FORM *form, Form_Options opts)
-|
-| Description : Turns on the named options; no other options are
+|
+| Description : Turns on the named options; no other options are
| changed.
|
-| Return Values : E_OK - success
+| Return Values : E_OK - success
| E_BAD_ARGUMENT - invalid options
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int form_opts_off(FORM *form, Form_Options opts)
-|
-| Description : Turns off the named options; no other options are
+|
+| Description : Turns off the named options; no other options are
| changed.
|
-| Return Values : E_OK - success
+| Return Values : E_OK - success
| E_BAD_ARGUMENT - invalid options
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
MODULE_ID("$Id: frm_page.c,v 1.11 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_form_page(FORM * form,int page)
-|
+|
| Description : Set the page number of the form.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int form_page(const FORM * form)
-|
+|
| Description : Return the current page of the form.
|
| Return Values : >= 0 : current page number
MODULE_ID("$Id: frm_post.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int post_form(FORM * form)
-|
+|
| Description : Writes the form into its associated subwindow.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int unpost_form(FORM * form)
-|
+|
| Description : Erase form from its associated subwindow.
|
| Return Values : E_OK - success
#define A_SIZE (sizeof(request_names)/sizeof(request_names[0]))
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : const char * form_request_name (int request);
-|
+|
| Description : Get the external name of a form request.
|
| Return Values : Pointer to name - on success
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int form_request_by_name (const char *str);
-|
+|
| Description : Search for a request with this name.
|
| Return Values : Request Id - on success
MODULE_ID("$Id: frm_scale.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int scale_form( const FORM *form, int *rows, int *cols )
-|
+|
| Description : Retrieve size of form
|
| Return Values : E_OK - no error
MODULE_ID("$Id: frm_sub.c,v 1.12 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_form_sub(FORM *form, WINDOW *win)
-|
-| Description : Set the subwindow of the form to win.
+|
+| Description : Set the subwindow of the form to win.
|
| Return Values : E_OK - success
| E_POSTED - form is posted
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : WINDOW *form_sub(const FORM *)
-|
+|
| Description : Retrieve the window of the form.
|
| Return Values : The pointer to the Subwindow.
MODULE_ID("$Id: frm_user.c,v 1.15 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_form_userptr(FORM *form, void *usrptr)
-|
+|
| Description : Set the pointer that is reserved in any form to store
| application relevant informations
|
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : void *form_userptr(const FORM *form)
-|
+|
| Description : Return the pointer that is reserved in any form to
| store application relevant informations.
|
MODULE_ID("$Id: frm_win.c,v 1.16 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int set_form_win(FORM *form,WINDOW *win)
-|
-| Description : Set the window of the form to win.
+|
+| Description : Set the window of the form to win.
|
| Return Values : E_OK - success
| E_POSTED - form is posted
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : WINDOW *form_win(const FORM *)
-|
+|
| Description : Retrieve the window of the form.
|
| Return Values : The pointer to the Window or stdscr if there is none.
enumParams;
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static void *Generic_Enum_Type(void * arg)
-|
+|
| Description : Allocate structure for enumeration type argument.
|
| Return Values : Pointer to argument structure or NULL on error
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static void *Make_Enum_Type( va_list * ap )
-|
+|
| Description : Allocate structure for enumeration type argument.
|
| Return Values : Pointer to argument structure or NULL on error
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static void *Copy_Enum_Type( const void * argp )
-|
-| Description : Copy structure for enumeration type argument.
+|
+| Description : Copy structure for enumeration type argument.
|
| Return Values : Pointer to argument structure or NULL on error.
+--------------------------------------------------------------------------*/
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static void Free_Enum_Type( void * argp )
-|
+|
| Description : Free structure for enumeration type argument.
|
| Return Values : -
#define EXACT 2
/*---------------------------------------------------------------------------
-| Facility : libnform
-| Function : static int Compare(const unsigned char * s,
+| Facility : libnform
+| Function : static int Compare(const unsigned char * s,
| const unsigned char * buf,
| bool ccase )
-|
+|
| Description : Check whether or not the text in 'buf' matches the
| text in 's', at least partial.
|
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static bool Check_Enum_Field(
| FIELD * field,
| const void * argp)
-|
+|
| Description : Validate buffer content to be a valid enumeration value
|
| Return Values : TRUE - field is valid
{(char *)0};
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static bool Next_Enum(FIELD * field,
| const void * argp)
-|
+|
| Description : Check for the next enumeration value
|
| Return Values : TRUE - next value found and loaded
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static bool Previous_Enum(
| FIELD * field,
| const void * argp)
-|
+|
| Description : Check for the previous enumeration value
|
| Return Values : TRUE - previous value found and loaded
* fieldtype they register with the forms library using this call.
*
* For that purpose we have extended the fieldtype struc by a new element
- * that gets the arguments from a single struct passed by the caller.
- *
+ * that gets the arguments from a single struct passed by the caller.
+ *
*/
#if NCURSES_INTEROP_FUNCS
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static void *Generic_This_Type( void * arg )
-|
+|
| Description : We interpret the passed arg just as a handle the
| calling language uses to keep track of its allocated
| argument structures. We can simply copy it back.
| write a field_check and a char_check function and give
| them as input to this call. A callback to allow the
| release of the allocated memory must also be provided.
-| For generic field types, we provide some more
+| For generic field types, we provide some more
| information about the field as parameters.
|
| If an error occurs, errno is set to
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static TypeArgument *GenericArgument(
| const FIELDTYPE* typ,
| int (*argiterator)(void**),
| int* err)
-|
+|
| Description : The iterator callback must browse through all fieldtype
| parameters that have an argument associated with the
| type. The iterator returns 1 if the operation to get
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : int _nc_set_generic_fieldtype(
| FIELD* field,
| FIELDTYPE* ftyp,
| int (*argiterator)(void**))
-|
+|
| Description : Assign the fieldtype to the field and use the iterator
-| mechanism to get the arguments when a check is
+| mechanism to get the arguments when a check is
| performed.
|
| Return Values : E_OK if all went well
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : WINDOW* _nc_form_cursor(
| FORM* form,
| int *pRow, int *pCol)
-|
+|
| Description : Get the current position of the form cursor position
| We also return the field window
|
integerPARM;
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static void *Generic_This_Type( void * arg )
-|
+|
| Description : Allocate structure for integer type argument.
|
| Return Values : Pointer to argument structure or NULL on error
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static void *Make_This_Type( va_list * ap )
-|
+|
| Description : Allocate structure for integer type argument.
|
| Return Values : Pointer to argument structure or NULL on error
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static void *Copy_This_Type(const void * argp)
-|
-| Description : Copy structure for integer type argument.
+|
+| Description : Copy structure for integer type argument.
|
| Return Values : Pointer to argument structure or NULL on error.
+--------------------------------------------------------------------------*/
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static void Free_This_Type(void * argp)
-|
+|
| Description : Free structure for integer type argument.
|
| Return Values : -
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static bool Check_This_Field(
| FIELD * field,
| const void * argp)
-|
+|
| Description : Validate buffer content to be a valid integer value
|
| Return Values : TRUE - field is valid
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static bool Check_This_Character(
| int c,
| const void * argp)
-|
+|
| Description : Check a character for the integer type.
|
| Return Values : TRUE - character is valid
MODULE_ID("$Id: fty_ipv4.c,v 1.10 2009/11/07 20:17:58 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static bool Check_IPV4_Field(
| FIELD * field,
| const void * argp)
-|
+|
| Description : Validate buffer content to be a valid IP number (Ver. 4)
|
| Return Values : TRUE - field is valid
}
/*---------------------------------------------------------------------------
-| Facility : libnform
+| Facility : libnform
| Function : static bool Check_IPV4_Character(
-| int c,
+| int c,
| const void *argp )
-|
+|
| Description : Check a character for unsigned type or period.
|
| Return Values : TRUE - character is valid
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_fore(MENU *menu, chtype attr)
-|
+|
| Description : Set the attribute for selectable items. In single-
| valued menus this is used to highlight the current
| item ((i.e. where the cursor is), in multi-valued
| menus this is used to highlight the selected items.
|
| Return Values : E_OK - success
-| E_BAD_ARGUMENT - an invalid value has been passed
+| E_BAD_ARGUMENT - an invalid value has been passed
+--------------------------------------------------------------------------*/
GEN_MENU_ATTR_SET_FCT(fore)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : chtype menu_fore(const MENU* menu)
-|
+|
| Description : Return the attribute used for selectable items that
| are current (single-valued menu) or selected (multi-
-| valued menu).
+| valued menu).
|
| Return Values : Attribute value
+--------------------------------------------------------------------------*/
GEN_MENU_ATTR_GET_FCT(fore)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_back(MENU *menu, chtype attr)
-|
+|
| Description : Set the attribute for selectable but not yet selected
| items.
|
-| Return Values : E_OK - success
+| Return Values : E_OK - success
| E_BAD_ARGUMENT - an invalid value has been passed
+--------------------------------------------------------------------------*/
GEN_MENU_ATTR_SET_FCT(back)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : chtype menu_back(const MENU *menu)
-|
+|
| Description : Return the attribute used for selectable but not yet
-| selected items.
+| selected items.
|
| Return Values : Attribute value
+--------------------------------------------------------------------------*/
GEN_MENU_ATTR_GET_FCT(back)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_grey(MENU *menu, chtype attr)
-|
+|
| Description : Set the attribute for unselectable items.
|
| Return Values : E_OK - success
-| E_BAD_ARGUMENT - an invalid value has been passed
+| E_BAD_ARGUMENT - an invalid value has been passed
+--------------------------------------------------------------------------*/
GEN_MENU_ATTR_SET_FCT(grey)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : chtype menu_grey(const MENU *menu)
-|
+|
| Description : Return the attribute used for non-selectable items
|
| Return Values : Attribute value
0, /* length of widest description */
1, /* length of mark */
1, /* length of one item */
- 1, /* Spacing for descriptor */
+ 1, /* Spacing for descriptor */
1, /* Spacing for columns */
1, /* Spacing for rows */
(char *)0, /* buffer used to store match chars */
0, /* Top row of menu */
(chtype)A_REVERSE, /* Attribute for selection */
(chtype)A_NORMAL, /* Attribute for nonselection */
- (chtype)A_UNDERLINE, /* Attribute for inactive */
+ (chtype)A_UNDERLINE, /* Attribute for inactive */
' ', /* Pad character */
(Menu_Hook)0, /* Menu init */
(Menu_Hook)0, /* Menu term */
(void *)0, /* userptr */
mark, /* mark */
ALL_MENU_OPTS, /* options */
- 0 /* status */
+ 0 /* status */
};
NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = {
/* *INDENT-ON* */
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : static void ComputeMaximum_NameDesc_Lenths(MENU *menu)
-|
+|
| Description : Calculates the maximum name and description lengths
| of the items connected to the menu
|
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : static void ResetConnectionInfo(MENU *, ITEM **)
-|
+|
| Description : Reset all informations in the menu and the items in
| the item array that indicates a connection
|
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : bool _nc_Connect_Items(MENU *menu, ITEM **items)
|
| Description : Connect the items in the item array to the menu.
}
}
- /* If we fall through to this point, we have to reset all items connection
+ /* If we fall through to this point, we have to reset all items connection
and inform about a reject connection */
ResetConnectionInfo(menu, items);
return (FALSE);
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void _nc_Disconnect_Items(MENU *menu)
-|
+|
| Description : Disconnect the menus item array from the menu
|
| Return Values : -
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int _nc_Calculate_Text_Width(const TEXT * item)
-|
+|
| Description : Calculate the number of columns for a TEXT.
|
| Return Values : the width
#endif
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void _nc_Calculate_Item_Length_and_Width(MENU *menu)
-|
+|
| Description : Calculate the length of an item and the width of the
| whole menu.
|
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void _nc_Link_Item(MENU *menu)
-|
+|
| Description : Statically calculate for every item its four neighbors.
| This depends on the orientation of the menu. This
| static approach simplifies navigation in the menu a lot.
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void _nc_Show_Menu(const MENU* menu)
-|
+|
| Description : Update the window that is associated with the menu
|
| Return Values : -
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void _nc_New_TopRow_and_CurrentItem(
-| MENU *menu,
-| int new_toprow,
+| MENU *menu,
+| int new_toprow,
| ITEM *new_current_item)
-|
+|
| Description : Redisplay the menu so that the given row becomes the
| top row and the given item becomes the new current
| item.
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_init(MENU *menu, void (*f)(MENU *))
-|
+|
| Description : Set user-exit which is called when menu is posted
| or just after the top row changes.
|
GEN_HOOK_SET_FUNCTION(menu, init)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void (*)(MENU *) menu_init(const MENU *menu)
-|
+|
| Description : Return address of user-exit function which is called
-| when a menu is posted or just after the top row
+| when a menu is posted or just after the top row
| changes.
|
| Return Values : Menu init function address or NULL
GEN_HOOK_GET_FUNCTION(menu, init)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_term (MENU *menu, void (*f)(MENU *))
-|
+|
| Description : Set user-exit which is called when menu is unposted
| or just before the top row changes.
|
GEN_HOOK_SET_FUNCTION(menu, term)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void (*)(MENU *) menu_term(const MENU *menu)
-|
+|
| Description : Return address of user-exit function which is called
-| when a menu is unposted or just before the top row
+| when a menu is unposted or just before the top row
| changes.
|
| Return Values : Menu finalization function address or NULL
GEN_HOOK_GET_FUNCTION(menu, term)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_item_init (MENU *menu, void (*f)(MENU *))
-|
+|
| Description : Set user-exit which is called when menu is posted
| or just after the current item changes.
|
GEN_HOOK_SET_FUNCTION(item, init)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void (*)(MENU *) item_init (const MENU *menu)
-|
+|
| Description : Return address of user-exit function which is called
-| when a menu is posted or just after the current item
+| when a menu is posted or just after the current item
| changes.
|
| Return Values : Item init function address or NULL
GEN_HOOK_GET_FUNCTION(item, init)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_item_term (MENU *menu, void (*f)(MENU *))
-|
+|
| Description : Set user-exit which is called when menu is unposted
| or just before the current item changes.
|
GEN_HOOK_SET_FUNCTION(item, term)
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void (*)(MENU *) item_init (const MENU *menu)
-|
+|
| Description : Return address of user-exit function which is called
-| when a menu is unposted or just before the current item
+| when a menu is unposted or just before the current item
| changes.
|
| Return Values : Item finalization function address or NULL
MODULE_ID("$Id: m_item_cur.c,v 1.18 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_current_item(MENU *menu, const ITEM *item)
-|
+|
| Description : Make the item the current item
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : ITEM *current_item(const MENU *menu)
-|
+|
| Description : Return the menus current item
|
| Return Values : Item pointer or NULL if failure
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int item_index(const ITEM *)
-|
+|
| Description : Return the logical index of this item.
|
| Return Values : The index or ERR if this is an invalid item pointer
MODULE_ID("$Id: m_item_nam.c,v 1.15 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : char *item_name(const ITEM *item)
-|
+|
| Description : Return name of menu item
|
| Return Values : See above; returns NULL if item is invalid
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : char *item_description(const ITEM *item)
-|
+|
| Description : Returns description of item
|
| Return Values : See above; Returns NULL if item is invalid
MODULE_ID("$Id: m_item_new.c,v 1.30 2010/01/23 21:20:11 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : bool Is_Printable_String(const char *s)
-|
+|
| Description : Checks whether or not the string contains only printable
| characters.
|
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : ITEM *new_item(char *name, char *description)
-|
+|
| Description : Create a new item with name and description. Return
| a pointer to this new item.
| N.B.: an item must(!) have a name.
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int free_item(ITEM *item)
-|
-| Description : Free the allocated storage for this item.
+|
+| Description : Free the allocated storage for this item.
| N.B.: a connected item can't be freed.
|
| Return Values : E_OK - success
| E_BAD_ARGUMENT - invalid value has been passed
-| E_CONNECTED - item is still connected to a menu
+| E_CONNECTED - item is still connected to a menu
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
free_item(ITEM * item)
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_mark( MENU *menu, const char *mark )
-|
+|
| Description : Set the mark string used to indicate the current
| item (single-valued menu) or the selected items
| (multi-valued menu).
-| The mark argument may be NULL, in which case no
+| The mark argument may be NULL, in which case no
| marker is used.
-| This might be a little bit tricky, because this may
-| affect the geometry of the menu, which we don't allow
+| This might be a little bit tricky, because this may
+| affect the geometry of the menu, which we don't allow
| if it is already posted.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : char *menu_mark(const MENU *menu)
-|
+|
| Description : Return a pointer to the marker string
|
| Return Values : The marker string pointer or NULL if no marker defined
MODULE_ID("$Id: m_item_opt.c,v 1.18 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
-| Function : int set_item_opts(ITEM *item, Item_Options opts)
-|
+| Facility : libnmenu
+| Function : int set_item_opts(ITEM *item, Item_Options opts)
+|
| Description : Set the options of the item. If there are relevant
| changes, the item is connected and the menu is posted,
| the menu will be redisplayed.
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
-| Function : int item_opts_off(ITEM *item, Item_Options opts)
-|
+| Facility : libnmenu
+| Function : int item_opts_off(ITEM *item, Item_Options opts)
+|
| Description : Switch of the options for this item.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
-| Function : int item_opts_on(ITEM *item, Item_Options opts)
-|
+| Facility : libnmenu
+| Function : int item_opts_on(ITEM *item, Item_Options opts)
+|
| Description : Switch on the options for this item.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
-| Function : Item_Options item_opts(const ITEM *item)
-|
+| Facility : libnmenu
+| Function : Item_Options item_opts(const ITEM *item)
+|
| Description : Switch of the options for this item.
|
| Return Values : Items options
MODULE_ID("$Id: m_item_top.c,v 1.11 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_top_row(MENU *menu, int row)
-|
+|
| Description : Makes the specified row the top row in the menu
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int top_row(const MENU *)
-|
+|
| Description : Return the top row of the menu
|
| Return Values : The row number or ERR if there is no row
MODULE_ID("$Id: m_item_use.c,v 1.17 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_item_userptr(ITEM *item, void *userptr)
-|
+|
| Description : Set the pointer that is reserved in any item to store
-| application relevant informations.
+| application relevant informations.
|
| Return Values : E_OK - success
+--------------------------------------------------------------------------*/
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void *item_userptr(const ITEM *item)
-|
+|
| Description : Return the pointer that is reserved in any item to store
| application relevant informations.
|
MODULE_ID("$Id: m_item_val.c,v 1.15 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_item_value(ITEM *item, int value)
-|
+|
| Description : Programmatically set the item's selection value. This is
| only allowed if the item is selectable at all and if
| it is not connected to a single-valued menu.
| If the item is connected to a posted menu, the menu
-| will be redisplayed.
+| will be redisplayed.
|
| Return Values : E_OK - success
| E_REQUEST_DENIED - not selectable or single valued menu
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : bool item_value(const ITEM *item)
-|
+|
| Description : Return the selection value of the item
|
| Return Values : TRUE - if item is selected
MODULE_ID("$Id: m_item_vis.c,v 1.16 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : bool item_visible(const ITEM *item)
-|
+|
| Description : A item is visible if it currently appears in the
| subwindow of a posted menu.
|
MODULE_ID("$Id: m_items.c,v 1.17 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_items(MENU *menu, ITEM **items)
-|
+|
| Description : Sets the item pointer array connected to menu.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : ITEM **menu_items(const MENU *menu)
-|
+|
| Description : Returns a pointer to the item pointer array of the menu
|
| Return Values : NULL on error
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int item_count(const MENU *menu)
-|
+|
| Description : Get the number of items connected to the menu. If the
-| menu pointer is NULL we return -1.
+| menu pointer is NULL we return -1.
|
| Return Values : Number of items or -1 to indicate error.
+--------------------------------------------------------------------------*/
MODULE_ID("$Id: m_new.c,v 1.21 2010/01/23 21:20:11 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : MENU* _nc_new_menu(SCREEN*, ITEM **items)
-|
+|
| Description : Creates a new menu connected to the item pointer
| array items and returns a pointer to the new menu.
| The new menu is initialized with the values from the
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : MENU *new_menu(ITEM **items)
-|
+|
| Description : Creates a new menu connected to the item pointer
| array items and returns a pointer to the new menu.
| The new menu is initialized with the values from the
#endif
/*---------------------------------------------------------------------------
-| Facility : libnmenu
-| Function : int free_menu(MENU *menu)
-|
-| Description : Disconnects menu from its associated item pointer
+| Facility : libnmenu
+| Function : int free_menu(MENU *menu)
+|
+| Description : Disconnects menu from its associated item pointer
| array and frees the storage allocated for the menu.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_pad(MENU* menu, int pad)
-|
+|
| Description : Set the character to be used to separate the item name
-| from its description. This must be a printable
+| from its description. This must be a printable
| character.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int menu_pad(const MENU *menu)
-|
+|
| Description : Return the value of the padding character
|
| Return Values : The pad character
MODULE_ID("$Id: m_pattern.c,v 1.16 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : char *menu_pattern(const MENU *menu)
-|
+|
| Description : Return the value of the pattern buffer.
|
| Return Values : NULL - if there is no pattern buffer allocated
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_pattern(MENU *menu, const char *p)
-|
+|
| Description : Set the match pattern for a menu and position to the
| first item that matches.
|
#define A_SIZE (sizeof(request_names)/sizeof(request_names[0]))
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : const char * menu_request_name (int request);
-|
+|
| Description : Get the external name of a menu request.
|
| Return Values : Pointer to name - on success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int menu_request_by_name (const char *str);
-|
+|
| Description : Search for a request with this name.
|
| Return Values : Request Id - on success
MODULE_ID("$Id: m_scale.c,v 1.10 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int scale_menu(const MENU *menu)
-|
+|
| Description : Returns the minimum window size necessary for the
-| subwindow of menu.
+| subwindow of menu.
|
| Return Values : E_OK - success
| E_BAD_ARGUMENT - invalid menu pointer
MODULE_ID("$Id: m_sub.c,v 1.12 2010/01/23 21:20:11 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_sub(MENU *menu, WINDOW *win)
-|
+|
| Description : Sets the subwindow of the menu.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : WINDOW* menu_sub(const MENU *menu)
-|
+|
| Description : Returns a pointer to the subwindow of the menu
|
| Return Values : NULL on error, otherwise a pointer to the window
MODULE_ID("$Id: m_userptr.c,v 1.17 2010/01/23 21:20:10 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_userptr(MENU *menu, void *userptr)
-|
+|
| Description : Set the pointer that is reserved in any menu to store
| application relevant informations.
|
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void *menu_userptr(const MENU *menu)
-|
+|
| Description : Return the pointer that is reserved in any menu to
| store application relevant informations.
|
MODULE_ID("$Id: m_win.c,v 1.17 2010/01/23 21:20:11 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_win(MENU *menu, WINDOW *win)
-|
+|
| Description : Sets the window of the menu.
|
| Return Values : E_OK - success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : WINDOW* menu_win(const MENU*)
-|
+|
| Description : Returns pointer to the window of the menu
|
| Return Values : NULL on error, otherwise pointer to window
unsigned short length;
} TEXT;
-typedef struct tagITEM
+typedef struct tagITEM
{
TEXT name; /* name of menu item */
- TEXT description; /* description of item, optional in display */
+ TEXT description; /* description of item, optional in display */
struct tagMENU *imenu; /* Pointer to parent menu */
- void *userptr; /* Pointer to user defined per item data */
- Item_Options opt; /* Item options */
+ void *userptr; /* Pointer to user defined per item data */
+ Item_Options opt; /* Item options */
short index; /* Item number if connected to a menu */
short y; /* y and x location of item in menu */
short x;
bool value; /* Selection value */
-
+
struct tagITEM *left; /* neighbor items */
struct tagITEM *right;
struct tagITEM *up;
typedef void (*Menu_Hook)(struct tagMENU *);
-typedef struct tagMENU
+typedef struct tagMENU
{
short height; /* Nr. of chars high */
short width; /* Nr. of chars wide */
short itemlen; /* Length of one item */
short spc_desc; /* Spacing for descriptor */
short spc_cols; /* Spacing for columns */
- short spc_rows; /* Spacing for rows */
+ short spc_rows; /* Spacing for rows */
char *pattern; /* Buffer to store match chars */
short pindex; /* Index into pattern buffer */
WINDOW *win; /* Window containing menu */
WINDOW *sub; /* Subwindow for menu display */
WINDOW *userwin; /* User's window */
WINDOW *usersub; /* User's subwindow */
- ITEM **items; /* array of items */
+ ITEM **items; /* array of items */
short nitems; /* Nr. of items in menu */
ITEM *curitem; /* Current item */
short toprow; /* Top row of menu */
chtype acs_map[128] =
{
- A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9), A(10),
- A(11), A(12), A(13), A(14), A(15), A(16), A(17), A(18), A(19),
- A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27), A(28),
- A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&', '\'', '(',
+ A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9), A(10),
+ A(11), A(12), A(13), A(14), A(15), A(16), A(17), A(18), A(19),
+ A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27), A(28),
+ A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&', '\'', '(',
')', '*',
A(0x1a), A(0x1b), A(0x18), A(0x19),
0xdb,
- '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
- '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
- 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
+ '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+ 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
A(0x04), 0xb1,
'b', 'c', 'd', 'e',
- 0xf8, 0xf1, 0xb0, A(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d, 0x2d,
- 0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3, 0xf2, 0xe3,
+ 0xf8, 0xf1, 0xb0, A(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d, 0x2d,
+ 0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3, 0xf2, 0xe3,
0xd8, 0x9c, 0xf9,
A(127)
#endif
}
-/* update the given physical line to look like the corresponding line in
+/* update the given physical line to look like the corresponding line in
curscr */
void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
/* Public Domain Curses */
-
+
#include "lppdc.h"
#include <usb/usb.h>
return c;
}
-/* discard any pending keyboard input -- this is the core
+/* discard any pending keyboard input -- this is the core
routine for flushinp() */
void PDC_flushinp(void)
COLOR_MAGENTA + 8, COLOR_YELLOW + 8, COLOR_WHITE + 8
};
-/* close the physical screen -- may restore the screen to its state
+/* close the physical screen -- may restore the screen to its state
before PDC_scr_open(); miscellaneous cleanup */
void PDC_scr_close(void)
pdc_atrtab = (unsigned char *)NULL;
}
-/* open the physical screen -- allocate SP, miscellaneous intialization,
+/* open the physical screen -- allocate SP, miscellaneous intialization,
and may save the existing screen for later restoration */
int PDC_scr_open(int argc, char **argv)
/* decompresses the data stream at src to dst, determining its length from
* the data stream itself.
- *
+ *
* returns the decompressed size, or 0 on error
*/
unsigned long ulzma(unsigned char *src, unsigned char *dst);
-/*\r
- * This file is part of the libpayload project.\r
- *\r
- * Copyright (C) 2010 coresystems GmbH\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- * 3. The name of the author may not be used to endorse or promote products\r
- * derived from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
- * SUCH DAMAGE.\r
- */\r
-\r
-#ifndef _PCI_PCI_H\r
-#define _PCI_PCI_H\r
-\r
-/* we implement at least this version */\r
-#define PCI_LIB_VERSION 0x020200\r
-\r
-#include <pci.h>\r
-\r
-#define PCI_CLASS_DEVICE REG_CLASS_DEV\r
-#define PCI_SUBSYSTEM_VENDOR_ID REG_SUBSYS_VENDOR_ID\r
-#define PCI_SUBSYSTEM_ID REG_SUBSYS_ID\r
-\r
-#define PCI_COMMAND REG_COMMAND\r
-#define PCI_COMMAND_IO REG_COMMAND_IO\r
-#define PCI_COMMAND_MEMORY REG_COMMAND_MEM\r
-#define PCI_COMMAND_MASTER REG_COMMAND_BM\r
-\r
-#define PCI_HEADER_TYPE REG_HEADER_TYPE\r
-#define PCI_HEADER_TYPE_NORMAL HEADER_TYPE_NORMAL\r
-#define PCI_HEADER_TYPE_BRIDGE HEADER_TYPE_BRIDGE\r
-#define PCI_HEADER_TYPE_CARDBUS HEADER_TYPE_CARDBUS\r
-\r
-#define PCI_BASE_ADDRESS_0 0x10\r
-#define PCI_BASE_ADDRESS_1 0x14\r
-#define PCI_BASE_ADDRESS_2 0x18\r
-#define PCI_BASE_ADDRESS_3 0x1c\r
-#define PCI_BASE_ADDRESS_4 0x20\r
-#define PCI_BASE_ADDRESS_5 0x24\r
-#define PCI_BASE_ADDRESS_SPACE 1 // mask\r
-#define PCI_BASE_ADDRESS_SPACE_IO 1\r
-#define PCI_BASE_ADDRESS_SPACE_MEM 0\r
-#define PCI_BASE_ADDRESS_IO_MASK ~0xf\r
-#define PCI_BASE_ADDRESS_MEM_MASK ~0x3\r
-\r
-#define PCI_ROM_ADDRESS 0x30\r
-#define PCI_ROM_ADDRESS1 0x38 // on bridges\r
-#define PCI_ROM_ADDRESS_MASK ~0x7ff\r
-\r
-#define PCI_VENDOR_ID_INTEL 0x8086\r
-\r
-struct pci_dev {\r
- u16 domain;\r
- u8 bus, dev, func;\r
- u16 vendor_id, device_id;\r
- struct pci_dev *next;\r
-};\r
-\r
-/*\r
- * values to match devices against.\r
- * "-1" means "don't care", everything else requires an exact match\r
- */\r
-struct pci_filter {\r
- int domain, bus, dev, func;\r
- int vendor, device;\r
- struct pci_dev *devices;\r
-};\r
-\r
-struct pci_access {\r
- struct pci_dev *devices;\r
-};\r
-\r
-u8 pci_read_byte(struct pci_dev *dev, int pos);\r
-u16 pci_read_word(struct pci_dev *dev, int pos);\r
-u32 pci_read_long(struct pci_dev *dev, int pos);\r
-\r
-int pci_write_byte(struct pci_dev *dev, int pos, u8 data);\r
-int pci_write_word(struct pci_dev *dev, int pos, u16 data);\r
-int pci_write_long(struct pci_dev *dev, int pos, u32 data);\r
-\r
-struct pci_access *pci_alloc(void);\r
-void pci_init(struct pci_access*);\r
-void pci_cleanup(struct pci_access*);\r
-char *pci_filter_parse_slot(struct pci_filter*, const char*);\r
-int pci_filter_match(struct pci_filter*, struct pci_dev*);\r
-void pci_filter_init(struct pci_access*, struct pci_filter*);\r
-void pci_scan_bus(struct pci_access*);\r
-struct pci_dev *pci_get_dev(struct pci_access*, u16, u8, u8, u8);\r
-\r
-#endif\r
+/*
+ * This file is part of the libpayload project.
+ *
+ * Copyright (C) 2010 coresystems GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _PCI_PCI_H
+#define _PCI_PCI_H
+
+/* we implement at least this version */
+#define PCI_LIB_VERSION 0x020200
+
+#include <pci.h>
+
+#define PCI_CLASS_DEVICE REG_CLASS_DEV
+#define PCI_SUBSYSTEM_VENDOR_ID REG_SUBSYS_VENDOR_ID
+#define PCI_SUBSYSTEM_ID REG_SUBSYS_ID
+
+#define PCI_COMMAND REG_COMMAND
+#define PCI_COMMAND_IO REG_COMMAND_IO
+#define PCI_COMMAND_MEMORY REG_COMMAND_MEM
+#define PCI_COMMAND_MASTER REG_COMMAND_BM
+
+#define PCI_HEADER_TYPE REG_HEADER_TYPE
+#define PCI_HEADER_TYPE_NORMAL HEADER_TYPE_NORMAL
+#define PCI_HEADER_TYPE_BRIDGE HEADER_TYPE_BRIDGE
+#define PCI_HEADER_TYPE_CARDBUS HEADER_TYPE_CARDBUS
+
+#define PCI_BASE_ADDRESS_0 0x10
+#define PCI_BASE_ADDRESS_1 0x14
+#define PCI_BASE_ADDRESS_2 0x18
+#define PCI_BASE_ADDRESS_3 0x1c
+#define PCI_BASE_ADDRESS_4 0x20
+#define PCI_BASE_ADDRESS_5 0x24
+#define PCI_BASE_ADDRESS_SPACE 1 // mask
+#define PCI_BASE_ADDRESS_SPACE_IO 1
+#define PCI_BASE_ADDRESS_SPACE_MEM 0
+#define PCI_BASE_ADDRESS_IO_MASK ~0xf
+#define PCI_BASE_ADDRESS_MEM_MASK ~0x3
+
+#define PCI_ROM_ADDRESS 0x30
+#define PCI_ROM_ADDRESS1 0x38 // on bridges
+#define PCI_ROM_ADDRESS_MASK ~0x7ff
+
+#define PCI_VENDOR_ID_INTEL 0x8086
+
+struct pci_dev {
+ u16 domain;
+ u8 bus, dev, func;
+ u16 vendor_id, device_id;
+ struct pci_dev *next;
+};
+
+/*
+ * values to match devices against.
+ * "-1" means "don't care", everything else requires an exact match
+ */
+struct pci_filter {
+ int domain, bus, dev, func;
+ int vendor, device;
+ struct pci_dev *devices;
+};
+
+struct pci_access {
+ struct pci_dev *devices;
+};
+
+u8 pci_read_byte(struct pci_dev *dev, int pos);
+u16 pci_read_word(struct pci_dev *dev, int pos);
+u32 pci_read_long(struct pci_dev *dev, int pos);
+
+int pci_write_byte(struct pci_dev *dev, int pos, u8 data);
+int pci_write_word(struct pci_dev *dev, int pos, u16 data);
+int pci_write_long(struct pci_dev *dev, int pos, u32 data);
+
+struct pci_access *pci_alloc(void);
+void pci_init(struct pci_access*);
+void pci_cleanup(struct pci_access*);
+char *pci_filter_parse_slot(struct pci_filter*, const char*);
+int pci_filter_match(struct pci_filter*, struct pci_dev*);
+void pci_filter_init(struct pci_access*, struct pci_filter*);
+void pci_scan_bus(struct pci_access*);
+struct pci_dev *pci_get_dev(struct pci_access*, u16, u8, u8, u8);
+
+#endif
/* $Id: term.h,v 1.16 2008/07/13 16:08:16 wmcbrine Exp $ */
-/* PDCurses doesn't operate with terminfo, but we need these functions for
- compatibility, to allow some things (notably, interface libraries for
- other languages) to be compiled. Anyone who tries to actually _use_
+/* PDCurses doesn't operate with terminfo, but we need these functions for
+ compatibility, to allow some things (notably, interface libraries for
+ other languages) to be compiled. Anyone who tries to actually _use_
them will be disappointed, since they only return ERR. */
#ifndef __PDCURSES_TERM_H__
int tigetflag(const char *);
int tigetnum(const char *);
char *tigetstr(const char *);
-char *tparm(const char *, long, long, long, long, long,
+char *tparm(const char *, long, long, long, long, long,
long, long, long, long);
int tputs(const char *, int, int (*)(int));
static __inline void
swapfunc(char *a, char *b, size_t n, int swaptype)
{
- if (swaptype <= 1)
+ if (swaptype <= 1)
swapcode(long, a, b, n)
else
swapcode(char, a, b, n)
}
if (swap_cnt == 0) { /* Switch to insertion sort */
for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
- for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
+ for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
pl -= es)
swap(pl, pl - es);
return;
vecswap(pb, pn - r, r);
if ((r = pb - pa) > es)
qsort(a, r / es, es, cmp);
- if ((r = pd - pc) > es) {
+ if ((r = pd - pc) > es) {
/* Iterate rather than recurse to save stack space */
a = pn - r;
n = r / es;
dev->vendor_id = val & 0xffff;
dev->device_id = val >> 16;
dev->next = 0;
-
+
hdr = pci_read_config8(PCI_DEV(bus, slot, func),
REG_HEADER_TYPE);
hdr &= 0x7F;