newpad(int l, int c) { WINDOW *win; NCURSES_CH_T *ptr; int i; T((T_CALLED("newpad(%d, %d)"), l, c)); if (l <= 0 || c <= 0) returnWin(0); if ((win = _nc_makenew(l, c, 0, 0, _ISPAD)) == NULL) returnWin(0); for (i = 0; i < l; i++) { if_USE_SCROLL_HINTS(win->_line[i].oldindex = _NEWINDEX); if ((win->_line[i].text = typeCalloc(NCURSES_CH_T, ((size_t) c))) == 0) { (void) _nc_freewin(win); returnWin(0); } for (ptr = win->_line[i].text; ptr < win->_line[i].text + c; ptr++) SetChar(*ptr, BLANK_TEXT, BLANK_ATTR); } returnWin(win); }
WINDOW *derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) { #if 0 WINDOW *win = NULL; int i; int flags = _SUBWIN; /* Make sure window fits inside the original one. */ if (begy < 0 || begx < 0 || orig == 0 || num_lines < 0 || num_columns < 0) return NULL; if (begy + num_lines > orig->_maxy + 1 || begx + num_columns > orig->_maxx + 1) return NULL; if (num_lines == 0) num_lines = orig->_maxy + 1 - begy; if (num_columns == 0) num_columns = orig->_maxx + 1 - begx; if (orig->_flags & _ISPAD) flags |= _ISPAD; // FIXME if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy, orig->_begx + begx, flags)) == 0) return NULL; win->_pary = begy; win->_parx = begx; WINDOW_ATTRS(win) = WINDOW_ATTRS(orig); win->_nc_bkgd = orig->_nc_bkgd; for (i = 0; i < num_lines; i++) win->_line[i].text = &orig->_line[begy++].text[begx]; win->_parent = orig; return win; #else return NULL; #endif }