1 /****************************************************************/
2 /* Overlay() and overwrite() functions of the PCcurses package */
4 /****************************************************************/
5 /* This version of curses is based on ncurses, a curses version */
6 /* Originally written by Pavel Curtis at Cornell University. */
7 /* I have made substantial changes to make it run on IBM PC's, */
8 /* And therefore consider myself free to make it public domain. */
9 /* Bjorn Larsson (...mcvax!enea!infovax!bl) */
10 /****************************************************************/
11 /* 1.0: Release: 870515 */
12 /****************************************************************/
13 /* Modified to run under the MINIX operating system by Don Cope */
14 /* These changes are also released into the public domain. */
16 /****************************************************************/
21 /****************************************************************/
22 /* Overlay() overwrites 'win1' upon 'win2', with origins alig- */
23 /* Ned. Overlay is transparent; blanks from 'win1' are not */
24 /* Copied to 'win2'. */
25 /****************************************************************/
26 void overlay(win1
, win2
)
39 last_col
= min(win1
->_maxx
, win2
->_maxx
);
40 last_line
= min(win1
->_maxy
, win2
->_maxy
);
41 attrs
= win2
->_attrs
& ATR_MSK
;
42 minchng
= win2
->_minchng
;
43 maxchng
= win2
->_maxchng
;
45 for (line
= 0; line
<= last_line
; line
++) {
46 register short fc
, lc
= 0;
47 w1ptr
= win1
->_line
[line
];
48 w2ptr
= win2
->_line
[line
];
50 for (col
= 0; col
<= last_col
; col
++) {
51 if ((*w1ptr
& CHR_MSK
) != ' ') {
52 *w2ptr
= (*w1ptr
& CHR_MSK
) | attrs
;
53 if (fc
== _NO_CHANGE
) fc
= col
;
60 if (*minchng
== _NO_CHANGE
) {
63 } else if (fc
!= _NO_CHANGE
) {
64 if (fc
< *minchng
) *minchng
= fc
;
65 if (lc
> *maxchng
) *maxchng
= lc
;
72 /****************************************************************/
73 /* Overwrite() overwrites 'win1' upon 'win2', with origins */
74 /* Aligned. Overwrite is non-transparent; blanks from 'win1' */
75 /* Are copied to 'win2'. */
76 /****************************************************************/
77 void overwrite(win1
, win2
)
90 last_col
= min(win1
->_maxx
, win2
->_maxx
);
91 last_line
= min(win1
->_maxy
, win2
->_maxy
);
92 attrs
= win2
->_attrs
& ATR_MSK
;
93 minchng
= win2
->_minchng
;
94 maxchng
= win2
->_maxchng
;
96 for (line
= 0; line
<= last_line
; line
++) {
97 register short fc
, lc
= 0;
99 w1ptr
= win1
->_line
[line
];
100 w2ptr
= win2
->_line
[line
];
103 for (col
= 0; col
<= last_col
; col
++) {
104 if ((*w1ptr
& CHR_MSK
) != (*w2ptr
& CHR_MSK
)) {
105 *w2ptr
= (*w1ptr
& CHR_MSK
) | attrs
;
107 if (fc
== _NO_CHANGE
) fc
= col
;
114 if (*minchng
== _NO_CHANGE
) {
117 } else if (fc
!= _NO_CHANGE
) {
118 if (fc
< *minchng
) *minchng
= fc
;
119 if (lc
> *maxchng
) *maxchng
= lc
;