1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
24
25
26 /*
27 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
29 */
30
31 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
32 /*LINTLIBRARY*/
33
34 #include <stdlib.h>
35 #include <stdio.h>
36 #include "con.h"
37
38 float obotx = 0.0;
39 float oboty = 0.0;
40 float botx = 0.0;
41 float boty = 0.0;
42 float scalex = 1.0;
43 float scaley = 1.0;
44 int scaleflag = 0;
45 int oloy = -1;
46 int ohiy = -1;
47 int ohix = -1;
48 int oextra = -1;
49
50
51 void
putch(char c)52 putch(char c)
53 {
54 (void) putc(c, stdout);
55 }
56
57 void
cont(short x,short y)58 cont(short x, short y)
59 {
60 short hix, hiy, lox, loy, extra;
61 short n;
62 x = (short)((x - obotx) * scalex + botx);
63 y = (short)((y - oboty) * scaley + boty);
64 hix = (x>>7) & 037;
65 hiy = (y>>7) & 037;
66 lox = (x>>2) & 037;
67 loy = (y>>2) & 037;
68 extra = x & 03 + (y<<2) & 014;
69 n = (abs(hix - ohix) + abs(hiy - ohiy) + 6) / 12;
70 if (hiy != ohiy) {
71 putch(hiy|040);
72 ohiy = hiy;
73 }
74 if (hix != ohix) {
75 if (extra != oextra) {
76 putch(extra|0140);
77 oextra = extra;
78 }
79 putch(loy|0140);
80 putch(hix|040);
81 ohix = hix;
82 oloy = loy;
83 } else {
84 if (extra != oextra) {
85 putch(extra|0140);
86 putch(loy|0140);
87 oextra = extra;
88 oloy = loy;
89 } else if (loy != oloy) {
90 putch(loy|0140);
91 oloy = loy;
92 }
93 }
94 putch(lox|0100);
95 while (n--)
96 putch(0);
97 }
98