]>
git.saurik.com Git - apple/shell_cmds.git/blob - window/wwframe.c
13f0dfaf27fe961e1fd50632ca0812d75bf5218c
1 /* $NetBSD: wwframe.c,v 1.5 1997/11/21 08:37:22 lukem Exp $ */
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * Edward Wang at The University of California, Berkeley.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 #include <sys/cdefs.h>
42 static char sccsid
[] = "@(#)wwframe.c 8.1 (Berkeley) 6/6/93";
44 __RCSID("$NetBSD: wwframe.c,v 1.5 1997/11/21 08:37:22 lukem Exp $");
51 #define frameok(w, r, c) (w1 = wwindex[wwsmap[r][c]], \
52 w1->ww_fmap || w1->ww_order > (w)->ww_order)
71 b2
= c
< 0 || frameok(w
, r
, c
);
73 for (; c
< w
->ww_i
.r
; c
++) {
74 if (c
+ 1 >= wwncol
) {
78 a3
= w
->ww_index
== wwsmap
[r
+ 1][c
+ 1];
79 b3
= frameok(w
, r
, c
+ 1);
88 wwframec(wframe
, r
, c
, code
|WWF_TOP
);
95 if ((a1
|| a2
) && b1
&& b2
)
96 wwframec(wframe
, r
, c
, WWF_L
|WWF_TOP
);
99 if (w
->ww_w
.b
< wwnrow
) {
105 b2
= c
< 0 || frameok(w
, r
, c
);
107 for (; c
< w
->ww_i
.r
; c
++) {
108 if (c
+ 1 >= wwncol
) {
112 a3
= w
->ww_index
== wwsmap
[r
- 1][c
+ 1];
113 b3
= frameok(w
, r
, c
+ 1);
117 if ((a1
|| a2
) && b1
)
119 if ((a2
|| a3
) && b3
)
122 wwframec(wframe
, r
, c
, code
);
129 if ((a1
|| a2
) && b1
&& b2
)
130 wwframec(wframe
, r
, c
, WWF_L
);
139 b2
= r
< 0 || frameok(w
, r
, c
);
141 for (; r
< w
->ww_i
.b
; r
++) {
142 if (r
+ 1 >= wwnrow
) {
146 a3
= w
->ww_index
== wwsmap
[r
+ 1][c
+ 1];
147 b3
= frameok(w
, r
+ 1, c
);
151 if ((a1
|| a2
) && b1
)
153 if ((a2
|| a3
) && b3
)
156 wwframec(wframe
, r
, c
, code
);
163 if ((a1
|| a2
) && b1
&& b2
)
164 wwframec(wframe
, r
, c
, WWF_U
);
167 if (w
->ww_w
.r
< wwncol
) {
173 b2
= r
< 0 || frameok(w
, r
, c
);
175 for (; r
< w
->ww_i
.b
; r
++) {
176 if (r
+ 1 >= wwnrow
) {
180 a3
= w
->ww_index
== wwsmap
[r
+ 1][c
- 1];
181 b3
= frameok(w
, r
+ 1, c
);
185 if ((a1
|| a2
) && b1
)
187 if ((a2
|| a3
) && b3
)
190 wwframec(wframe
, r
, c
, code
);
197 if ((a1
|| a2
) && b1
&& b2
)
198 wwframec(wframe
, r
, c
, WWF_U
);
203 wwframec(f
, r
, c
, code
)
211 if (r
< f
->ww_i
.t
|| r
>= f
->ww_i
.b
|| c
< f
->ww_i
.l
|| c
>= f
->ww_i
.r
)
214 smap
= &wwsmap
[r
][c
];
220 if (w
->ww_order
> f
->ww_order
) {
221 if (w
!= &wwnobody
&& w
->ww_win
[r
][c
] == 0)
227 if (f
->ww_fmap
!= 0) {
230 fmap
= &f
->ww_fmap
[r
][c
];
239 char *win
= &f
->ww_win
[r
][c
];
241 if (*win
== WWM_GLS
&& *smap
== f
->ww_index
)
245 if (oldcode
!= code
&& (code
& WWF_LABEL
) == 0) {
248 frame
= tt
.tt_frame
[code
& WWF_MASK
];
249 f
->ww_buf
[r
][c
].c_w
= frame
;
250 if (wwsmap
[r
][c
] == f
->ww_index
) {
251 wwtouched
[r
] |= WWU_TOUCHED
;
252 wwns
[r
][c
].c_w
= frame
;