char killchar(void) { PDC_LOG(("killchar() - called\n")); return _DLCHAR; /* line delete char (^U) */ }
int wvline_set(WINDOW *win, const cchar_t *wch, int n) { PDC_LOG(("wvline_set() - called\n")); return wch ? wvline(win, *wch, n) : ERR; }
bool has_colors(void) { PDC_LOG(("has_colors() - called\n")); return !(SP->mono); }
int scr_set(const char *filename) { PDC_LOG(("scr_set() - called: filename %s\n", filename)); return scr_restore(filename); }
int box(WINDOW *win, chtype verch, chtype horch) { PDC_LOG(("box() - called\n")); return wborder(win, verch, verch, horch, horch, 0, 0, 0, 0); }
int resetterm(void) { PDC_LOG(("resetterm() - called\n")); return reset_shell_mode(); }
int saveterm(void) { PDC_LOG(("saveterm() - called\n")); return def_prog_mode(); }
bool has_il(void) { PDC_LOG(("has_il() - called\n")); return TRUE; }
int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2) { int num_cols; int sline = sy1; int pline = py; PDC_LOG(("pnoutrefresh() - called\n")); if (!w || !(w->_flags & (_PAD|_SUBPAD)) || (sy2 >= LINES) || (sy2 >= COLS)) return ERR; if (py < 0) py = 0; if (px < 0) px = 0; if (sy1 < 0) sy1 = 0; if (sx1 < 0) sx1 = 0; if (sy2 < sy1 || sx2 < sx1) return ERR; num_cols = min((sx2 - sx1 + 1), (w->_maxx - px)); while (sline <= sy2) { if (pline < w->_maxy) { memcpy(curscr->_y[sline] + sx1, w->_y[pline] + px, num_cols * sizeof(chtype)); if ((curscr->_firstch[sline] == _NO_CHANGE) || (curscr->_firstch[sline] > sx1)) curscr->_firstch[sline] = sx1; if (sx2 > curscr->_lastch[sline]) curscr->_lastch[sline] = sx2; w->_firstch[pline] = _NO_CHANGE; /* updated now */ w->_lastch[pline] = _NO_CHANGE; /* updated now */ } sline++; pline++; } if (w->_clear) { w->_clear = FALSE; 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, then don't move the cursor; if so, move it to the correct place */ if (!w->_leaveit && w->_cury >= py && w->_curx >= px && w->_cury <= py + (sy2 - sy1) && w->_curx <= px + (sx2 - sx1)) { curscr->_cury = (w->_cury - py) + sy1; curscr->_curx = (w->_curx - px) + sx1; } return OK; }
int baudrate(void) { PDC_LOG(("baudrate() - called\n")); return INT_MAX; }
char erasechar(void) { PDC_LOG(("erasechar() - called\n")); return _ECHAR; /* character delete char (^H) */ }
char wordchar(void) { PDC_LOG(("wordchar() - called\n")); return _DWCHAR; /* word delete char */ }
attr_t term_attrs(void) { PDC_LOG(("term_attrs() - called\n")); return SP->termattrs; }
char *longname(void) { PDC_LOG(("longname() - called\n")); return ttytype + 9; /* skip "pdcurses|" */ }
int resetty(void) { PDC_LOG(("resetty() - called\n")); return _restore_mode(PDC_SAVE_TTY); }
WINDOW *panel_window(const PANEL *pan) { PDC_LOG(("panel_window() - called\n")); return pan->win; }
int draino(int ms) { PDC_LOG(("draino() - called\n")); return napms(ms); }
//------------------------------------------------------------------------------ int waddch( WINDOW* win, const chtype ch ) { __QCS_FCONTEXT( "waddch" ); int x, y; chtype text, attr; bool xlat; PDC_LOG(("waddch() - called: win=%p ch=%x (text=%c attr=0x%x)\n", win, ch, ch & A_CHARTEXT, ch & A_ATTRIBUTES)); if( !win ) { return ERR; } x = win->_curx; y = win->_cury; if( y > win->_maxy || x > win->_maxx || y < 0 || x < 0 ) { return ERR; } xlat = !SP->raw_out && !(ch & A_ALTCHARSET); text = ch & A_CHARTEXT; attr = ch & A_ATTRIBUTES; if( xlat && ( text < ' ' || text == 0x7f ) ) { int x2; switch( text ) { case '\t': for( x2 = ( ( x / TABSIZE ) + 1 ) * TABSIZE; x < x2; x++ ) { if( waddch( win, attr | ' ' ) == ERR ) { return ERR; } // if tab to next line, exit the loop if( !win->_curx ) { break; } } return 0; case '\n': // if lf -> crlf if( !SP->raw_out ) { x = 0; } wclrtoeol( win ); if( ++y > win->_bmarg ) { y--; if( wscrl( win, 1 ) == ERR ) { return ERR; } } break; case '\b': // don't back over left margin if( --x < 0 ) case '\r': { x = 0; } break; case 0x7f: if( waddch( win, attr | '^' ) == ERR ) { return ERR; } return waddch( win, attr | '?' ); default: // handle control chars if( waddch( win, attr | '^' ) == ERR ) { return ERR; } return waddch( win, ch + '@' ); } } else { /* If the incoming character doesn't have its own attribute, then use the current attributes for the window. If it has attributes but not a color component, OR the attributes to the current attributes for the window. If it has a color component, use the attributes solely from the incoming character. */ 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 will only print if the printing character is blank. */ if( !( attr & A_COLOR ) ) { attr |= win->_bkgd & A_ATTRIBUTES; } else { attr |= win->_bkgd & ( A_ATTRIBUTES ^ A_COLOR ); } if( text == ' ' ) { text = win->_bkgd & A_CHARTEXT; } // Add the attribute back into the character. text |= attr; /* Only change _firstch/_lastch if the character to be added is different from the character/attribute that is already in that position in the window. */ if( win->_y[ y ][ x ] != text ) { if( win->_firstch[ y ] == _NO_CHANGE ) { win->_firstch[ y ] = win->_lastch[ y ] = x; } else { if( x < win->_firstch[ y ] ) { win->_firstch[ y ] = x; } else { if( x > win->_lastch[ y ] ) { win->_lastch[ y ] = x; } } } win->_y[ y ][ x ] = text; } if( ++x >= win->_maxx ) { // wrap around test x = 0; if( ++y > win->_bmarg ) { y--; if( wscrl( win, 1 ) == ERR ) { PDC_sync( win ); return ERR; } } } } win->_curx = x; win->_cury = y; if( win->_immed ) { wrefresh( win ); } if( win->_sync ) { wsyncup( win ); } return 0; }
int fixterm(void) { PDC_LOG(("fixterm() - called\n")); return reset_prog_mode(); }
int clrtobot(void) { PDC_LOG(("clrtobot() - called\n")); return wclrtobot(stdscr); }
int scr_init(const char *filename) { PDC_LOG(("scr_init() - called: filename %s\n", filename)); return OK; }
int erase(void) { PDC_LOG(("erase() - called\n")); return werase(stdscr); }
WINDOW *getwin(FILE *filep) { WINDOW *win; char marker[4]; int i, nlines, ncols; PDC_LOG(("getwin() - called\n")); if ( !(win = malloc(sizeof(WINDOW))) ) return (WINDOW *)NULL; /* check for the marker, and load the WINDOW struct */ if (!filep || !fread(marker, 4, 1, filep) || strncmp(marker, "PDC", 3) || marker[3] != DUMPVER || !fread(win, sizeof(WINDOW), 1, filep)) { free(win); return (WINDOW *)NULL; } nlines = win->_maxy; ncols = win->_maxx; /* allocate the line pointer array */ if ( !(win->_y = malloc(nlines * sizeof(chtype *))) ) { free(win); return (WINDOW *)NULL; } /* allocate the minchng and maxchng arrays */ if ( !(win->_firstch = malloc(nlines * sizeof(int))) ) { free(win->_y); free(win); return (WINDOW *)NULL; } if ( !(win->_lastch = malloc(nlines * sizeof(int))) ) { free(win->_firstch); free(win->_y); free(win); return (WINDOW *)NULL; } /* allocate the lines */ if ( !(win = PDC_makelines(win)) ) return (WINDOW *)NULL; /* read them */ for (i = 0; i < nlines; i++) { if (!fread(win->_y[i], ncols * sizeof(chtype), 1, filep)) { delwin(win); return (WINDOW *)NULL; } } touchwin(win); return win; }
int clear(void) { PDC_LOG(("clear() - called\n")); return wclear(stdscr); }
int vline(chtype ch, int n) { PDC_LOG(("vline() - called\n")); return wvline(stdscr, ch, n); }
int clrtoeol(void) { PDC_LOG(("clrtoeol() - called\n")); return wclrtoeol(stdscr); }
int vline_set(const cchar_t *wch, int n) { PDC_LOG(("vline_set() - called\n")); return wvline_set(stdscr, wch, n); }
int draino_async(int ms, void (*callback)(void*)) { PDC_LOG(("draino_async() - called\n")); return napms_async(ms, callback); }
bool can_change_color(void) { PDC_LOG(("can_change_color() - called\n")); return PDC_can_change_color(); }
void PDC_reset_shell_mode(void) { PDC_LOG(("PDC_reset_shell_mode() - called.\n")); }