diff options
Diffstat (limited to 'usr/src/ucbcmd/plot/libplot/t4013')
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/Makefile | 53 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/arc.c | 122 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/box.c | 27 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/circle.c | 21 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/close.c | 27 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/dot.c | 20 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/erase.c | 30 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/label.c | 26 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/line.c | 22 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/linemod.c | 23 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/move.c | 22 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/open.c | 22 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/point.c | 21 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/space.c | 34 | ||||
-rw-r--r-- | usr/src/ucbcmd/plot/libplot/t4013/subr.c | 61 |
15 files changed, 531 insertions, 0 deletions
diff --git a/usr/src/ucbcmd/plot/libplot/t4013/Makefile b/usr/src/ucbcmd/plot/libplot/t4013/Makefile new file mode 100644 index 0000000000..8d49aed2c4 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/Makefile @@ -0,0 +1,53 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +LIBRARY= ../libt4013.a + +OBJECTS = arc.o box.o circle.o close.o dot.o erase.o label.o \ + line.o linemod.o move.o open.o point.o space.o subr.o + +# include library definitions +include ../../../../lib/Makefile.lib + +C99MODE= $(C99_DISABLE) + +# Specifically request the construction of a static library. +# This library is not installed in the proto area. +LIBS = $(LIBRARY) + +BUILD.AR = $(AR) $(ARFLAGS) $@ `$(LORDER) $(AROBJS) | $(TSORT)` + + +CLOBBERFILES= $(LIBRARY) + +.KEEP_STATE: + +all: $(LIBS) + +include ../../../../lib/Makefile.targ + diff --git a/usr/src/ucbcmd/plot/libplot/t4013/arc.c b/usr/src/ucbcmd/plot/libplot/t4013/arc.c new file mode 100644 index 0000000000..69bb6f5697 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/arc.c @@ -0,0 +1,122 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + +int del = 20; +step(d){ + del = d; +} +arc(x,y,x0,y0,x1,y1){ + double pc; + double sqrt(); + int flg,m,xc,yc,xs,ys,qs,qf; + float dx,dy,r; + char use; + dx = x-x0; + dy = y-y0; + r = dx*dx+dy*dy; + pc = r; + pc = pc > 0 ? sqrt(pc) : 0; + flg = pc/4; + if(flg == 0)step(1); + else if(flg < del)step(flg); + xc = xs = x0; + yc = ys = y0; + move(xs,ys); + if(x0 == x1 && y0 == y1)flg=0; + else flg=1; + qs = quad(x,y,x0,y0); + qf = quad(x,y,x1,y1); + if(abs(x-x1) < abs(y-y1)){ + use = 'x'; + if(qs == 2 || qs ==3)m = -1; + else m=1; + } + else { + use = 'y'; + if(qs > 2)m= -1; + else m= 1; + } + while(1){ + switch(use){ + case 'x': + if(qs == 2 || qs == 3)yc -= del; + else yc += del; + dy = yc-y; + pc = r-dy*dy; + xc = m*(pc > 0 ? sqrt(pc) : 0)+x; + if((x < xs && x >= xc) || ( x > xs && x <= xc) || + (y < ys && y >= yc) || ( y > ys && y <= yc) ) + { + if(++qs > 4)qs=1; + if(qs == 2 || qs == 3)m= -1; + else m=1; + flg=1; + } + cont(xc,yc); + xs = xc; + ys = yc; + if(qs == qf && flg == 1) + switch(qf){ + case 3: + case 4: + if(xs >= x1)return; + continue; + case 1: + case 2: + if(xs <= x1)return; + } + continue; + case 'y': + if(qs > 2)xc += del; + else xc -= del; + dx = xc-x; + pc = r-dx*dx; + yc = m*(pc > 0 ? sqrt(pc) : 0)+y; + if((x < xs && x >= xc) || ( x > xs && x <= xc ) || + (y < ys && y >= yc) || (y > ys && y <= yc) ) + { + if(++qs > 4)qs=1; + if(qs > 2)m = -1; + else m = 1; + flg=1; + } + cont(xc,yc); + xs = xc; + ys = yc; + if(qs == qf && flg == 1) + switch(qs){ + case 1: + case 4: + if(ys >= y1)return; + continue; + case 2: + case 3: + if(ys <= y1)return; + } + } + } +} +quad(x,y,xp,yp){ + if(x < xp) + if(y <= yp)return(1); + else return(4); + else if(x > xp) + if(y < yp)return(2); + else return(3); + else if(y < yp)return(2); + else return(4); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/box.c b/usr/src/ucbcmd/plot/libplot/t4013/box.c new file mode 100644 index 0000000000..ce721eefec --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/box.c @@ -0,0 +1,27 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + + +box(x0, y0, x1, y1) +{ + move(x0, y0); + cont(x0, y1); + cont(x1, y1); + cont(x1, y0); + cont(x0, y0); + move(x1, y1); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/circle.c b/usr/src/ucbcmd/plot/libplot/t4013/circle.c new file mode 100644 index 0000000000..45bbe8bdf5 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/circle.c @@ -0,0 +1,21 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + + +circle(x,y,r){ + arc(x,y,x+r,y,x+r,y); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/close.c b/usr/src/ucbcmd/plot/libplot/t4013/close.c new file mode 100644 index 0000000000..0d1d8256e0 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/close.c @@ -0,0 +1,27 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + + +#include <stdio.h> +closevt(){ + putch(037); + fflush(stdout); +} +closepl(){ + putch(037); + fflush(stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/dot.c b/usr/src/ucbcmd/plot/libplot/t4013/dot.c new file mode 100644 index 0000000000..a9cf01dd0a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/dot.c @@ -0,0 +1,20 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + + +dot(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/erase.c b/usr/src/ucbcmd/plot/libplot/t4013/erase.c new file mode 100644 index 0000000000..9f0a75482c --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/erase.c @@ -0,0 +1,30 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + + +extern int ohiy; +extern int ohix; +extern int oloy; +erase(){ + int i; + putch(033); + putch(014); + ohiy= -1; + ohix = -1; + oloy = -1; + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/label.c b/usr/src/ucbcmd/plot/libplot/t4013/label.c new file mode 100644 index 0000000000..a4118a9e99 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/label.c @@ -0,0 +1,26 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + + +label(s) +char *s; +{ + register i,c; + putch(037); /* alpha mode */ + for(i=0; c=s[i]; i++) + putch(c); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/line.c b/usr/src/ucbcmd/plot/libplot/t4013/line.c new file mode 100644 index 0000000000..23bc2baccf --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/line.c @@ -0,0 +1,22 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + + +line(x0,y0,x1,y1){ + move(x0,y0); + cont(x1,y1); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/linemod.c b/usr/src/ucbcmd/plot/libplot/t4013/linemod.c new file mode 100644 index 0000000000..77d60374e4 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/linemod.c @@ -0,0 +1,23 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + + +linemod(s) +char *s; +{ + /* ignored on 4013 */ +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/move.c b/usr/src/ucbcmd/plot/libplot/t4013/move.c new file mode 100644 index 0000000000..a63a3f218a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/move.c @@ -0,0 +1,22 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + + +move(xi,yi){ + putch(035); + cont(xi,yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/open.c b/usr/src/ucbcmd/plot/libplot/t4013/open.c new file mode 100644 index 0000000000..3b3a6f672c --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/open.c @@ -0,0 +1,22 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +openvt () +{ +} +openpl(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/point.c b/usr/src/ucbcmd/plot/libplot/t4013/point.c new file mode 100644 index 0000000000..1e5393d5e5 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/point.c @@ -0,0 +1,21 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +point(xi,yi){ + move(xi,yi); + cont(xi,yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/space.c b/usr/src/ucbcmd/plot/libplot/t4013/space.c new file mode 100644 index 0000000000..3bc365d8c7 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/space.c @@ -0,0 +1,34 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +extern float botx; +extern float boty; +extern float obotx; +extern float oboty; +extern float scalex; +extern float scaley; +extern int scaleflag; +space(x0,y0,x1,y1){ + botx = 0.; + boty = 0.; + obotx = x0; + oboty = y0; + if(scaleflag) + return; + scalex = 780./(x1-x0); + scaley = 780./(y1-y0); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4013/subr.c b/usr/src/ucbcmd/plot/libplot/t4013/subr.c new file mode 100644 index 0000000000..0772971b88 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4013/subr.c @@ -0,0 +1,61 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#include <stdio.h> +float obotx = 0.; +float oboty = 0.; +float botx = 0.; +float boty = 0.; +float scalex = 1.; +float scaley = 1.; +int scaleflag; + +int oloy = -1; +int ohiy = -1; +int ohix = -1; +cont(x,y){ + int hix,hiy,lox,loy; + int n; + x = (x-obotx)*scalex + botx; + y = (y-oboty)*scaley + boty; + hix=(x>>5) & 037; + hiy=(y>>5) & 037; + lox = x & 037; + loy = y & 037; + n = (abs(hix-ohix) + abs(hiy-ohiy) + 6) / 12; + if(hiy != ohiy){ + putch(hiy|040); + ohiy=hiy; + } + if(hix != ohix){ + putch(loy|0140); + putch(hix|040); + ohix=hix; + oloy=loy; + } + else if(loy != oloy){ + putch(loy|0140); + oloy=loy; + } + putch(lox|0100); + while(n--) + putch(0); +} + +putch(c){ + putc(c,stdout); +} |