|
|
1.1 root 1: # include "curses.ext"
2: /* @(#) erase.c: 1.1 10/15/83 (1.2 4/7/82) */
3:
4: /*
5: * This routine erases everything on the _window.
6: *
7: * 1/27/81 (Berkeley) @(#)erase.c 1.2
8: */
9: werase(win)
10: reg WINDOW *win; {
11:
12: reg int y;
13: reg chtype *sp, *end, *start, *maxx;
14: reg int minx;
15:
16: # ifdef DEBUG
17: if(outf) fprintf(outf, "WERASE(%0.2o), _maxx %d\n", win, win->_maxx);
18: # endif
19: for (y = 0; y < win->_maxy; y++) {
20: minx = _NOCHANGE;
21: maxx = NULL;
22: start = win->_y[y];
23: end = &start[win->_maxx];
24: for (sp = start; sp < end; sp++) {
25: #ifdef DEBUG
26: if (y == 23) if(outf) fprintf(outf,
27: "sp %x, *sp %c %o\n", sp, *sp, *sp);
28: #endif
29: if (*sp != ' ') {
30: maxx = sp;
31: if (minx == _NOCHANGE)
32: minx = sp - start;
33: *sp = ' ';
34: }
35: }
36: if (minx != _NOCHANGE) {
37: if (win->_firstch[y] > minx
38: || win->_firstch[y] == _NOCHANGE)
39: win->_firstch[y] = minx;
40: if (win->_lastch[y] < maxx - win->_y[y])
41: win->_lastch[y] = maxx - win->_y[y];
42: }
43: # ifdef DEBUG
44: if(outf) fprintf(outf, "WERASE: minx %d maxx %d _firstch[%d] %d, start %x, end %x\n",
45: minx, maxx ? maxx-start : NULL, y, win->_firstch[y], start, end);
46: # endif
47: }
48: win->_curx = win->_cury = 0;
49: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.