2 * This file is part of the libpayload project.
4 * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
5 * Copyright (C) 2008 Ulf Jordan <jordan@chalmers.se>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * This is a tiny implementation of the (n)curses library intended to be
33 * used in embedded/firmware/BIOS code where no libc or operating system
34 * environment is available and code size is very important.
37 * - Small object code.
39 * - Doesn't require a libc (no glibc/uclibc/dietlibc/klibc/newlib).
40 * - Works without any other external libraries or header files.
41 * - Works without an underlying operating system.
42 * - Doesn't use files, signals, syscalls, ttys, library calls, etc.
43 * - Doesn't do any dynamic memory allocation (no malloc() and friends).
44 * - All data structures are statically allocated.
45 * - Supports standard VGA console (80x25) and serial port console.
46 * - This includes character output and keyboard input over serial.
47 * - Supports beep() through a minimal PC speaker driver.
50 * - Only implements a small subset of the (n)curses functions.
51 * - Only implements very few sanity checks (for smaller code).
52 * - Thus: Don't do obviously stupid things in your code.
53 * - Doesn't implement the 'form', 'panel', and 'menu' extensions.
54 * - Only implements C bindings (no C++, Ada95, or others).
55 * - Doesn't include wide character support.
60 #undef _XOPEN_SOURCE_EXTENDED
61 #define _XOPEN_SOURCE_EXTENDED 1
65 /* Statically allocate all structures (no malloc())! */
66 static WINDOW window_list[MAX_WINDOWS];
67 static int window_count = 1;
70 static struct ldat ldat_list[MAX_WINDOWS][SCREEN_Y];
71 static int ldat_count = 0;
73 /* One item bigger than SCREEN_X to reverse place for a NUL byte. */
74 static NCURSES_CH_T linebuf_list[SCREEN_Y * MAX_WINDOWS][SCREEN_X + 1];
75 static int linebuf_count = 0;
78 int COLORS; /* Currently unused? */
92 /* See terminfo(5). */
93 chtype fallback_acs_map[128] =
95 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
96 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
97 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
98 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
99 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
100 ' ', ' ', ' ', '>', '<', '^', 'v', ' ',
101 '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
102 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
103 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
104 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
105 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
106 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
107 '+', ':', ' ', ' ', ' ', ' ', '\\', '#',
108 '#', '#', '+', '+', '+', '+', '+', '~',
109 '-', '-', '-', '_', '+', '+', '+', '+',
110 '|', '<', '>', '*', '!', 'f', 'o', ' ',
113 /* See acsc of vt100. */
114 chtype serial_acs_map[128] =
116 0, 0, 0, 0, 0, 0, 0, 0,
117 0, 0, 0, 0, 0, 0, 0, 0,
118 0, 0, 0, 0, 0, 0, 0, 0,
119 0, 0, 0, 0, 0, 0, 0, 0,
120 0, 0, 0, 0, 0, 0, 0, 0,
121 0, 0, 0, 0, 0, 0, 0, 0,
122 0, 0, 0, 0, 0, 0, 0, 0,
123 0, 0, 0, 0, 0, 0, 0, 0,
124 0, 0, 0, 0, 0, 0, 0, 0,
125 0, 0, 0, 0, 0, 0, 0, 0,
126 0, 0, 0, 0, 0, 0, 0, 0,
127 0, 0, 0, 0, 0, 0, 0, 0,
128 '`', 'a', 0, 0, 0, 0, 'f', 'g',
129 0, 0, 'j', 'k', 'l', 'm', 'n', 'o',
130 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
131 'x', 'y', 'z', '{', '|', '}', '~', 0,
134 /* See acsc of linux. */
135 chtype console_acs_map[128] =
137 0, 0, 0, 0, 0, 0, 0, 0,
138 0, 0, 0, 0, 0, 0, 0, 0,
139 0, 0, 0, 0, 0, 0, 0, 0,
140 0, 0, 0, 0, 0, 0, 0, 0,
141 0, 0, 0, 0, 0, 0, 0, 0,
142 0, 0, 0, '\020', '\021', '\030', '\031', 0,
143 '\333', 0, 0, 0, 0, 0, 0, 0,
144 0, 0, 0, 0, 0, 0, 0, 0,
145 0, 0, 0, 0, 0, 0, 0, 0,
146 0, 0, 0, 0, 0, 0, 0, 0,
147 0, 0, 0, 0, 0, 0, 0, 0,
148 0, 0, 0, 0, 0, 0, 0, 0,
149 '\004', '\261', 0, 0, 0, 0, '\370', '\361',
150 '\260', '\316', '\331', '\277', '\332', '\300', '\305', '~',
151 '\304', '\304', '\304', '_', '\303', '\264', '\301', '\302',
152 '\263', '\363', '\362', '\343', '\330', '\234', '\376', 0,
155 // FIXME: Ugly (and insecure!) hack!
156 char sprintf_tmp[1024];
159 int curses_flags = (F_ENABLE_CONSOLE | F_ENABLE_SERIAL);
161 /* Return bit mask for clearing color pair number if given ch has color */
162 #define COLOR_MASK(ch) (~(attr_t)((ch) & A_COLOR ? A_COLOR : 0))
164 /* Compute a rendition of the given char correct for the current context. */
165 static inline NCURSES_CH_T render_char(WINDOW *win, NCURSES_CH_T ch)
171 /* Make render_char() visible while still allowing us to inline it below. */
172 NCURSES_CH_T _nc_render(WINDOW *win, NCURSES_CH_T ch)
174 return render_char(win, ch);
178 * Implementations of most functions marked 'implemented' in include/curses.h:
181 // int baudrate(void) {}
184 /* TODO: Flash the screen if beeping fails? */
185 speaker_tone(1760, 500); /* 1760 == note A6 */
188 // bool can_change_color(void) {}
189 int cbreak(void) { /* TODO */ return 0; }
190 /* D */ int clearok(WINDOW *win, bool flag) { win->_clear = flag; return OK; }
191 // int color_content(short color, short *r, short *g, short *b) {}
192 // int curs_set(int) {}
193 // int def_prog_mode(void) {}
194 // int def_shell_mode(void) {}
195 // int delay_output(int) {}
196 // void delscreen(SCREEN *) {}
197 int delwin(WINDOW *win)
199 /* TODO: Don't try to delete stdscr. */
200 /* TODO: Don't delete parent windows before subwindows. */
202 // if (win->_flags & _SUBWIN)
203 // touchwin(win->_parent);
204 // else if (curscr != 0)
207 // return _nc_freewin(win);
210 WINDOW *derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx)
216 /* Make sure window fits inside the original one. */
217 if (begy < 0 || begx < 0 || orig == 0 || num_lines < 0
221 if (begy + num_lines > orig->_maxy + 1
222 || begx + num_columns > orig->_maxx + 1)
226 num_lines = orig->_maxy + 1 - begy;
228 if (num_columns == 0)
229 num_columns = orig->_maxx + 1 - begx;
231 if (orig->_flags & _ISPAD)
235 //// if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy,
236 //// orig->_begx + begx, flags)) == 0)
241 WINDOW_ATTRS(win) = WINDOW_ATTRS(orig);
242 win->_nc_bkgd = orig->_nc_bkgd;
244 for (i = 0; i < num_lines; i++)
245 win->_line[i].text = &orig->_line[begy++].text[begx];
251 int doupdate(void) { /* TODO */ return(*(int *)0); }
252 // WINDOW * dupwin (WINDOW *) {}
253 /* D */ int echo(void) { SP->_echo = TRUE; return OK; }
261 // _nc_screen_wrap();
262 // _nc_mvcur_wrap(); /* wrap up cursor addressing */
263 // return reset_shell_mode();
266 // char erasechar (void) {}
267 // void filter (void) {}
268 // int flash(void) {}
269 int flushinp(void) { /* TODO */ return 0; }
270 // WINDOW *getwin (FILE *) {}
271 bool has_colors (void) { /* TODO */ return(*(bool *)0); }
272 // bool has_ic (void) {}
273 // bool has_il (void) {}
274 // void idcok (WINDOW *, bool) {}
275 // int idlok (WINDOW *, bool) {}
276 void immedok(WINDOW *win, bool flag) { win->_immed = flag; }
277 /** Note: Must _not_ be called twice! */
278 WINDOW *initscr(void)
282 // newterm(name, stdout, stdin);
285 for (i = 0; i < 128; i++)
286 acs_map[i] = (chtype) i | A_ALTCHARSET;
288 if (curses_flags & F_ENABLE_SERIAL) {
292 if (curses_flags & F_ENABLE_CONSOLE) {
293 /* Clear the screen and kill the cursor */
295 video_console_clear();
296 video_console_cursor_enable(0);
301 stdscr = newwin(SCREEN_Y, SCREEN_X + 1, 0, 0);
302 // TODO: curscr, newscr?
304 for (y = 0; y < stdscr->_maxy; y++) {
305 for (x = 0; x < stdscr->_maxx; x++) {
306 stdscr->_line[y].text[x].chars[0] = ' ';
307 stdscr->_line[y].text[x].attr = A_NORMAL;
313 // int intrflush (WINDOW *,bool) {}
314 /* D */ bool isendwin(void) { return ((SP == NULL) ? FALSE : SP->_endwin); }
315 // bool is_linetouched (WINDOW *,int) {}
316 // bool is_wintouched (WINDOW *) {}
317 // NCURSES_CONST char * keyname (int) {}
318 int keypad (WINDOW *win, bool flag) { /* TODO */ return 0; }
319 // char killchar (void) {}
320 /* D */ int leaveok(WINDOW *win, bool flag) { win->_leaveok = flag; return OK; }
321 // char *longname (void) {}
322 // int meta (WINDOW *,bool) {}
323 // int mvcur (int,int,int,int) {}
324 // int mvderwin (WINDOW *, int, int) {}
325 int mvprintw(int y, int x, const char *fmt, ...)
330 if (move(y, x) == ERR)
334 code = vwprintw(stdscr, fmt, argp);
339 // int mvscanw (int,int, NCURSES_CONST char *,...) {}
340 // int mvwin (WINDOW *,int,int) {}
341 int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...)
346 if (wmove(win, y, x) == ERR)
350 code = vwprintw(win, fmt, argp);
355 // int mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) {}
356 // int napms (int) {}
357 // WINDOW *newpad (int,int) {}
358 // SCREEN *newterm (NCURSES_CONST char *,FILE *,FILE *) {}
359 WINDOW *newwin(int num_lines, int num_columns, int begy, int begx)
363 /* Use next statically allocated window. */
364 // TODO: Error handling.
366 WINDOW *win = &window_list[window_count++];
368 // bool is_pad = (flags & _ISPAD);
374 win->_maxy = num_lines - 1;
375 win->_maxx = num_columns - 1;
378 // win->_yoffset = SP->_topstolen;
380 win->_line = ldat_list[ldat_count++];
382 /* FIXME: Is this right? Should the window attributes be normal? */
383 win->_color = PAIR_NUMBER(0);
384 win->_attrs = A_NORMAL;
386 for (i = 0; i < num_lines; i++)
388 (NCURSES_CH_T *)&linebuf_list[linebuf_count++];
392 /* D */ int nl(void) { SP->_nl = TRUE; return OK; }
393 /* D */ int noecho(void) { SP->_echo = FALSE; return OK; }
394 /* D */ int nonl(void) { SP->_nl = FALSE; return OK; }
395 // void noqiflush (void) {}
396 // int noraw (void) {}
397 /* D */ int notimeout (WINDOW *win, bool f) { win->_notimeout = f; return OK; }
398 // int overlay (const WINDOW*,WINDOW *) {}
399 // int overwrite (const WINDOW*,WINDOW *) {}
400 // int pair_content (short,short*,short*) {}
401 // int pechochar (WINDOW *, const chtype) {}
402 // int pnoutrefresh (WINDOW*,int,int,int,int,int,int) {}
403 // int prefresh (WINDOW *,int,int,int,int,int,int) {}
404 int printw(const char *fmt, ...)
410 code = vwprintw(stdscr, fmt, argp);
415 // int putwin (WINDOW *, FILE *) {}
416 // void qiflush (void) {}
418 // int resetty (void) {}
419 // int reset_prog_mode (void) {}
420 // int reset_shell_mode (void) {}
421 // int ripoffline (int, int (*)(WINDOW *, int)) {}
422 // int savetty (void) {}
423 // int scanw (NCURSES_CONST char *,...) {}
424 // int scr_dump (const char *) {}
425 // int scr_init (const char *) {}
426 /* D */ int scrollok(WINDOW *win, bool flag) { win->_scroll = flag; return OK; }
427 // int scr_restore (const char *) {}
428 // int scr_set (const char *) {}
429 // SCREEN *set_term (SCREEN *) {}
430 // int slk_attroff (const chtype) {}
431 // int slk_attron (const chtype) {}
432 // int slk_attrset (const chtype) {}
433 // attr_t slk_attr (void) {}
434 // int slk_attr_set (const attr_t,short,void*) {}
435 // int slk_clear (void) {}
436 // int slk_color (short) {}
437 // int slk_init (int) {}
438 /* D */ char *slk_label(int n)
441 // if (SP == NULL || SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt)
443 return SP->_slk->ent[n - 1].ent_text;
445 // int slk_noutrefresh (void) {}
446 // int slk_refresh (void) {}
447 // int slk_restore (void) {}
448 // int slk_set (int,const char *,int) {}
449 // int slk_touch (void) {}
451 // WINDOW *subpad (WINDOW *, int, int, int, int) {}
452 WINDOW *subwin(WINDOW *w, int l, int c, int y, int x)
454 return derwin(w, l, c, y - w->_begy, x - w->_begx);
456 // int syncok (WINDOW *, bool) {}
457 // chtype termattrs (void) {}
458 // char *termname (void) {}
459 // int typeahead (int) {}
460 int ungetch(int ch) { /* TODO */ return ERR; }
461 // void use_env (bool) {}
462 // int vidattr (chtype) {}
463 // int vidputs (chtype, int (*)(int)) {}
464 int vwprintw(WINDOW *win, const char *fmt, va_list argp)
466 vsprintf((char *)&sprintf_tmp, fmt, argp);
468 /* TODO: Error handling? */
469 return waddstr(win, (char *)&sprintf_tmp);
471 // int vwscanw (WINDOW *, NCURSES_CONST char *,va_list) {}
472 // int waddch (WINDOW *, const chtype) {}
473 int waddch(WINDOW *win, const chtype ch)
477 // SetChar2(wch, ch);
479 win->_line[win->_cury].text[win->_curx].chars[0] =
480 ((ch) & (chtype)A_CHARTEXT);
482 win->_line[win->_cury].text[win->_curx].attr = WINDOW_ATTRS(win);
483 win->_line[win->_cury].text[win->_curx].attr |=
484 ((ch) & (chtype)A_ATTRIBUTES);
485 win->_curx++; // FIXME
487 // if (win && (waddch_nosync(win, wch) != ERR)) {
488 // _nc_synchook(win);
494 // int waddchnstr (WINDOW *,const chtype *,int) {}
495 int waddnstr(WINDOW *win, const char *astr, int n)
498 const char *str = astr;
506 while ((n-- > 0) && (*str != '\0')) {
507 // while (*str != '\0') {
508 win->_line[win->_cury].text[win->_curx].chars[0] = *str++;
509 win->_line[win->_cury].text[win->_curx].attr = WINDOW_ATTRS(win)
511 win->_curx++; // FIXME
514 // SetChar(ch, UChar(*str++), A_NORMAL);
515 // if (_nc_waddch_nosync(win, ch) == ERR) {
522 int wattr_on(WINDOW *win, attr_t at, void *opts GCC_UNUSED)
525 win->_color = PAIR_NUMBER(at);
526 // toggle_attr_on(WINDOW_ATTRS(win), at);
529 int wattr_off(WINDOW *win, attr_t at, void *opts GCC_UNUSED)
533 // toggle_attr_off(WINDOW_ATTRS(win), at);
536 // int wbkgd (WINDOW *, chtype) {}
537 void wbkgdset(WINDOW *win, chtype ch) { /* TODO */ }
539 int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs,
540 chtype tl, chtype tr, chtype bl, chtype br)
544 for(y = 0; y <= win->_maxy; y++) {
547 mvwaddch(win, y, 0, tl);
549 for(x = 1; x < win->_maxx; x++)
550 mvwaddch(win, y, x, ts);
552 mvwaddch(win, y, win->_maxx, tr);
554 else if (y == win->_maxy) {
555 mvwaddch(win, y, 0, bl);
557 for(x = 1; x < win->_maxx; x++)
558 mvwaddch(win, y, x, bs);
560 mvwaddch(win, y, win->_maxx, br);
563 mvwaddch(win, y, 0, ls);
564 mvwaddch(win, y, win->_maxx, rs);
571 // int wchgat (WINDOW *, int, attr_t, short, const void *) {}
572 /* D */ int wclear(WINDOW *win)
574 if (werase(win) == ERR)
579 // int wclrtobot (WINDOW *) {}
580 int wclrtoeol(WINDOW *win) { /* TODO */ return(*(int *)0); }
581 int wcolor_set(WINDOW *win, short color_pair_number, void *opts)
583 if (!opts && (color_pair_number >= 0)
584 && (color_pair_number < COLOR_PAIRS)) {
585 SET_WINDOW_PAIR(win, color_pair_number);
586 if_EXT_COLORS(win->_color = color_pair_number);
591 // void wcursyncup (WINDOW *) {}
592 // int wdelch (WINDOW *) {}
593 // int wechochar (WINDOW *, const chtype) {}
594 int werase(WINDOW *win)
597 for (y = 0; y <= win->_maxy; y++) {
598 for (x = 0; x <= win->_maxx; x++) {
599 win->_line[y].text[x].chars[0] = ' ';
600 win->_line[y].text[x].attr = WINDOW_ATTRS(win);
605 // int wgetnstr (WINDOW *,char *,int) {}
606 int whline(WINDOW *win, chtype ch, int n)
608 NCURSES_SIZE_T start, end;
609 struct ldat *line = &(win->_line[win->_cury]);
614 if (end > win->_maxx)
617 CHANGED_RANGE(line, start, end);
621 //// SetChar2(wch, ACS_HLINE);
623 //// SetChar2(wch, ch);
625 wch.chars[0] = ((ch) & (chtype)A_CHARTEXT);
626 wch.attr = ((ch) & (chtype)A_ATTRIBUTES);
627 wch = _nc_render(win, wch);
629 while (end >= start) {
630 line->text[end] = wch;
634 //// _nc_synchook(win);
638 /* D */ chtype winch(WINDOW *win)
641 // return (CharOf(win->_line[win->_cury].text[win->_curx]) |
642 // AttrOf(win->_line[win->_cury].text[win->_curx]));
645 // int winchnstr (WINDOW *, chtype *, int) {}
646 // int winnstr (WINDOW *, char *, int) {}
647 // int winsch (WINDOW *, chtype) {}
648 // int winsdelln (WINDOW *,int) {}
649 // int winsnstr (WINDOW *, const char *,int) {}
650 /* D */ int wmove(WINDOW *win, int y, int x)
652 if (!LEGALYX(win, y, x))
654 win->_curx = (NCURSES_SIZE_T) x;
655 win->_cury = (NCURSES_SIZE_T) y;
656 win->_flags &= ~_WRAPPED;
657 win->_flags |= _HASMOVED;
661 int wnoutrefresh(WINDOW *win)
664 int serial_is_bold = 0;
665 int serial_is_altcharset = 0;
672 serial_end_altcharset();
674 for (y = 0; y <= win->_maxy; y++) {
676 /* Position the serial cursor */
678 if (curses_flags & F_ENABLE_SERIAL)
679 serial_set_cursor(win->_begy + y, win->_begx);
681 for (x = 0; x <= win->_maxx; x++) {
682 attr_t attr = win->_line[y].text[x].attr;
685 ((int)color_pairs[PAIR_NUMBER(attr)]) << 8;
687 if (curses_flags & F_ENABLE_SERIAL) {
688 ch = win->_line[y].text[x].chars[0];
691 if (!serial_is_bold) {
697 if (serial_is_bold) {
704 if (attr & A_ALTCHARSET) {
705 if (serial_acs_map[ch & 0x7f]) {
706 ch = serial_acs_map[ch & 0x7f];
709 ch = fallback_acs_map[ch & 0x7f];
711 if (need_altcharset && !serial_is_altcharset) {
712 serial_start_altcharset();
713 serial_is_altcharset = 1;
715 if (!need_altcharset && serial_is_altcharset) {
716 serial_end_altcharset();
717 serial_is_altcharset = 0;
723 if (curses_flags & F_ENABLE_CONSOLE) {
724 ch = win->_line[y].text[x].chars[0];
726 /* Handle some of the attributes. */
731 if (attr & A_REVERSE) {
732 unsigned char tmp = (c >> 8) & 0xf;
733 c = (c >> 4) & 0xf00;
736 if (attr & A_ALTCHARSET) {
737 if (console_acs_map[ch & 0x7f])
738 ch = console_acs_map[ch & 0x7f];
740 ch = fallback_acs_map[ch & 0x7f];
744 * FIXME: Somewhere along the line, the
745 * character value is getting sign-extented.
746 * For now grab just the 8 bit character,
747 * but this will break wide characters!
749 c |= (chtype) (ch & 0xff);
750 video_console_putc(win->_begy + y, win->_begx + x, c);
757 int wprintw(WINDOW *win, const char *fmt, ...)
763 code = vwprintw(win, fmt, argp);
768 // int wredrawln (WINDOW *,int,int) {}
769 int wrefresh(WINDOW *win)
772 return wnoutrefresh(win);
778 curscr->_clear = TRUE;
779 // code = doupdate();
780 } else if ((code = wnoutrefresh(win)) == OK) {
782 newscr->_clear = TRUE;
783 // code = doupdate();
785 * Reset the clearok() flag in case it was set for the special
786 * case in hardscroll.c (if we don't reset it here, we'll get 2
787 * refreshes because the flag is copied from stdscr to newscr).
788 * Resetting the flag shouldn't do any harm, anyway.
795 // int wscanw (WINDOW *, NCURSES_CONST char *,...) {}
796 int wscrl(WINDOW *win, int n)
802 // _nc_scroll_window(win, n, win->_regtop, win->_regbottom, win->_nc_bkgd);
803 // _nc_synchook(win);
807 int wsetscrreg(WINDOW *win, int top, int bottom)
809 if (top >= 0 && top <= win->_maxy && bottom >= 0 &&
810 bottom <= win->_maxy && bottom > top) {
811 win->_regtop = (NCURSES_SIZE_T) top;
812 win->_regbottom = (NCURSES_SIZE_T) bottom;
817 // void wsyncdown (WINDOW *) {}
818 // void wsyncup (WINDOW *) {}
819 /* D */ void wtimeout(WINDOW *win, int delay) { win->_delay = delay; }
820 /* D */ int wtouchln(WINDOW *win, int y, int n, int changed)
824 // if ((n < 0) || (y < 0) || (y > win->_maxy))
827 for (i = y; i < y + n; i++) {
830 win->_line[i].firstchar = changed ? 0 : _NOCHANGE;
831 win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE;
835 // int wvline (WINDOW *,chtype,int) {}
836 // int tigetflag (NCURSES_CONST char *) {}
837 // int tigetnum (NCURSES_CONST char *) {}
838 // char *tigetstr (NCURSES_CONST char *) {}
839 // int putp (const char *) {}
840 // #if NCURSES_TPARM_VARARGS
841 // char *tparm (NCURSES_CONST char *, ...) {}
843 // char *tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long) {}
844 // char *tparm_varargs (NCURSES_CONST char *, ...) {}