diff options
author | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
---|---|---|
committer | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
commit | 7c478bd95313f5f23a4c958a745db2134aa03244 (patch) | |
tree | c871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/ucbcmd/plot/libplot | |
download | illumos-gate-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz |
OpenSolaris Launch
Diffstat (limited to 'usr/src/ucbcmd/plot/libplot')
214 files changed, 8490 insertions, 0 deletions
diff --git a/usr/src/ucbcmd/plot/libplot/Makefile b/usr/src/ucbcmd/plot/libplot/Makefile new file mode 100644 index 0000000000..4e81560182 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/Makefile @@ -0,0 +1,49 @@ +# +# 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 +# +# +#ident "%Z%%M% %I% %E% SMI" +# +# Copyright (c) 1989 by Sun Microsystems, Inc. +# +# include global definitions +include ../../../Makefile.master + +SUBDIRS= aed bitgraph dumb gigi hp2648 hp7221 imagen plot \ + t300 t300s t4013 t4014 t450 + +all:= TARGET= all +clean:= TARGET= clean +clobber:= TARGET= clobber +install:= TARGET= install +lint:= TARGET= lint + +.KEEP_STATE: +all clean clobber lint: $(SUBDIRS) + +install: + +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(TARGET) + + +FRC: + diff --git a/usr/src/ucbcmd/plot/libplot/aed/Makefile b/usr/src/ucbcmd/plot/libplot/aed/Makefile new file mode 100644 index 0000000000..42e1f4b9e1 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/Makefile @@ -0,0 +1,54 @@ +# +# 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= ../libaed.a + +OBJECTS = arc.o box.o circle.o close.o cont.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)` + +# TXTS allows the AT&T makefile to be bootstrapped into the NSE. + +CLOBBERFILES= $(LIBRARY) + +.KEEP_STATE: + +all: $(LIBS) + +include ../../../../lib/Makefile.targ + diff --git a/usr/src/ucbcmd/plot/libplot/aed/aed.h b/usr/src/ucbcmd/plot/libplot/aed/aed.h new file mode 100644 index 0000000000..fc1a312ae2 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/aed.h @@ -0,0 +1,36 @@ +/* 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. + */ + +/* + * Displays plot files on an AED512 graphics terminal. + */ + +#include <stdio.h> +#include <sgtty.h> + +extern char dbuf[BUFSIZ]; /* Used to buffer display characters */ +extern struct sgttyb sgttyb; /* Used to save terminal control bits */ +extern curx, cury; /* Current screen position */ +extern int xbot, ybot; /* Coordinates of screen lower-left corner */ +extern int scale; /* The number of pixels per 2**12 units + * of world coordinates. + */ + +/* The following variables describe the screen. */ + +#define GRXMAX 511 /* Maximum x-coordinate of screen */ +#define GRYMAX 482 /* Maximum y-coordinate of screen */ diff --git a/usr/src/ucbcmd/plot/libplot/aed/arc.c b/usr/src/ucbcmd/plot/libplot/aed/arc.c new file mode 100644 index 0000000000..c8d300492b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/arc.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) 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. + */ + + +arc(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/box.c b/usr/src/ucbcmd/plot/libplot/aed/box.c new file mode 100644 index 0000000000..dce4c8281b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/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) 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. + */ + + +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/aed/circle.c b/usr/src/ucbcmd/plot/libplot/aed/circle.c new file mode 100644 index 0000000000..a622681905 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/circle.c @@ -0,0 +1,41 @@ +/* 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 "aed.h" + +/*--------------------------------------------------------- + * Circle draws a circle. + * + * Results: None. + * + * Side Effects: + * A circle of radius r is drawn at (x,y). + *--------------------------------------------------------- + */ +circle(x, y, r) +int x, y, r; +{ + char buf[3]; + setcolor("01"); + putc('Q', stdout); + outxy20(x, y); + putc('O', stdout); + chex((r*scale)>>12, buf, 2); + fputs(buf, stdout); + (void) fflush(stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/close.c b/usr/src/ucbcmd/plot/libplot/aed/close.c new file mode 100644 index 0000000000..468d4a3177 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/close.c @@ -0,0 +1,36 @@ +/* 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 "aed.h" + +/*--------------------------------------------------------- + * Closepl does whatever is necessary to reset the characteristics + * of the AED512 after the program is finished. + * + * Results: None. + * + * Side Effects: + * The graphics display modes are reset. + *--------------------------------------------------------- + */ +closepl() +{ + fputs("Q00204\6", stdout); + (void) fflush(stdout); + (void) stty(fileno(stdout), &sgttyb); +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/cont.c b/usr/src/ucbcmd/plot/libplot/aed/cont.c new file mode 100644 index 0000000000..0d37692198 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/cont.c @@ -0,0 +1,32 @@ +/* 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 "aed.h" + +/*--------------------------------------------------------- + * Cont plots a line between (curx, cury) and (x, y). + * + * Results: None. + * Side Effects: As above. + *--------------------------------------------------------- + */ +cont(x, y) +int x, y; +{ + line(curx, cury, x, y); +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/dot.c b/usr/src/ucbcmd/plot/libplot/aed/dot.c new file mode 100644 index 0000000000..a0d3dcca35 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/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) 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. + */ + + +dot(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/erase.c b/usr/src/ucbcmd/plot/libplot/aed/erase.c new file mode 100644 index 0000000000..bdcd5172f6 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/erase.c @@ -0,0 +1,36 @@ +/* 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 "aed.h" + +/*--------------------------------------------------------- + * This routine erases the screen. + * + * Results: None. + * Side Effects: The screen is cleared. + *--------------------------------------------------------- + */ +erase() +{ + setcolor("FF"); + putc('\14', stdout); + putc('\33', stdout); + putc('Q', stdout); + outxy20(curx, cury); + (void) fflush(stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/label.c b/usr/src/ucbcmd/plot/libplot/aed/label.c new file mode 100644 index 0000000000..78b55bfecc --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/label.c @@ -0,0 +1,43 @@ +/* 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 "aed.h" + +/*--------------------------------------------------------- + * This routine places a label starting at the current + * position. + * + * Results: None. + * + * Side Effects: + * The string indicated by s starting at (curx, cury). + * The current position is updated accordingly. + *--------------------------------------------------------- + */ +label(s) +char *s; +{ + setcolor("02"); + putc('Q', stdout); + outxy20(curx + (4096/scale), cury + (4096/scale)); + putc('\6', stdout); + fputs(s, stdout); + putc('\33', stdout); + (void) fflush(stdout); + curx += ((6*4096*strlen(s)) + 4000)/scale; +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/line.c b/usr/src/ucbcmd/plot/libplot/aed/line.c new file mode 100644 index 0000000000..f1dbe93bf2 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/line.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. + */ + +#include "aed.h" + +/*--------------------------------------------------------- + * Line draws a line between two points. + * + * Results: None. + * + * Side Effects: + * A line is drawn on the screen between (x1, y1) and (x2, y2). + *--------------------------------------------------------- + */ +line(x1, y1, x2, y2) +int x1, y1, x2, y2; +{ + setcolor("01"); + putc('Q', stdout); + outxy20(x1, y1); + putc('A', stdout); + outxy20(x2, y2); + (void) fflush(stdout); + curx = x2; + cury = y2; +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/linemod.c b/usr/src/ucbcmd/plot/libplot/aed/linemod.c new file mode 100644 index 0000000000..b081ceaa17 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/linemod.c @@ -0,0 +1,45 @@ +/* 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 "aed.h" + +/*--------------------------------------------------------- + * Linemod sets the current line drawing style. + * + * Results: None. + * + * Side Effects: + * The AED line style is set based on string s which + * must be one of "dotted", "solid", "longdashed", "shortdashed", + * or "dotdashed". If s isn't recognized, then "solid" is used. + *--------------------------------------------------------- + */ +linemod(s) +char *s; +{ + if (strcmp(s, "dotted") == 0) + fputs("1AAFF", stdout); + else if (strcmp(s, "longdashed") == 0) + fputs("1F055", stdout); + else if (strcmp(s, "shortdashed") == 0) + fputs("1F0FF", stdout); + else if (strcmp(s, "dotdashed") == 0) + fputs("1E4FF", stdout); + else fputs("1FFFF", stdout); + (void) fflush(stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/move.c b/usr/src/ucbcmd/plot/libplot/aed/move.c new file mode 100644 index 0000000000..393d6f153c --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/move.c @@ -0,0 +1,33 @@ +/* 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 "aed.h" + +/*--------------------------------------------------------- + * This routine moves the current point to (x,y). + * + * Results: None. + * Side Effects: As above. + *--------------------------------------------------------- + */ +move(x, y) +int x, y; +{ + curx = x; + cury = y; +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/open.c b/usr/src/ucbcmd/plot/libplot/aed/open.c new file mode 100644 index 0000000000..6bbdc8befc --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/open.c @@ -0,0 +1,88 @@ +/* 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. + */ + + +/* + * Displays plot files on a AED512 graphics terminal. + */ + +#include "aed.h" + +char dbuf[BUFSIZ]; /* Used to buffer display characters */ +struct sgttyb sgttyb; /* Used to save terminal control bits */ +int curx, cury; /* Current screen position */ +int xbot, ybot; /* Coordinates of screen lower-left corner */ +int scale; /* The number of pixels per 2**12 units + * of world coordinates. + */ + +/* + * The following is the color map, containing reg, green, and blue + * values for color locations 0 and 1. + */ + +static int colors[] = {200, 200, 200, 0, 0, 125, 125, 0, 0, 125, 0, 0}; + +/*--------------------------------------------------------- + * Openpl initializes the graphics display and clears its screen. + * + * Results: None. + * + * Side Effects: + * The display is re-initialized and the file is remembered for + * use in all subsequent calls to this module. The display's + * color map is reset. The display is put into raw mode, but + * the previous mode bits are saved. + * + * Errors: None. + *--------------------------------------------------------- + */ +openpl() +{ + int flags, *p, i; + char dum[4]; + + /* First, grab up the display modes, then reset them to put it + * into cooked mode. Also, lock the terminal. + */ + + (void) gtty(fileno(stdout), &sgttyb); + flags = sgttyb.sg_flags; + sgttyb.sg_flags = (sgttyb.sg_flags & ~(RAW)) | EVENP | ODDP; + (void) stty(fileno(stdout), &sgttyb); + sgttyb.sg_flags = flags; + + /* Save the file pointer around for later use, then output an + * initialization string to the display. The initialization + * string resets the terminal, sets formats, clears the display, + * initializes the read and write masks, and sets the color map. + */ + + setbuf(stdout, dbuf); + fputs("\33\33G1HHHN[00LFFCFFMFFFFFFFF", stdout); + fputs("K0004", stdout); + p = colors; + for (i=0; i<12; i++) + { + chex(*p++, dum, 2); + fputs(dum, stdout); + } + fputs("^15060AL", stdout); + scale = 1<<12; + curx = cury = xbot = ybot = 0; + (void) fflush(stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/point.c b/usr/src/ucbcmd/plot/libplot/aed/point.c new file mode 100644 index 0000000000..7b8fdb2e30 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/point.c @@ -0,0 +1,41 @@ +/* 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 "aed.h" + +/*--------------------------------------------------------- + * This routine plots a single point. + * + * Results: None. + * + * Side Effects: + * A single point is displayed on the screen. + * The point is made the current point. + *--------------------------------------------------------- + */ +point(x, y) +int x, y; +{ + setcolor("01"); + putc('Q', stdout); + outxy20(x, y); + fputs("O01", stdout); + (void) fflush(stdout); + curx = x; + cury = y; +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/space.c b/usr/src/ucbcmd/plot/libplot/aed/space.c new file mode 100644 index 0000000000..1bbc37b7e5 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/space.c @@ -0,0 +1,46 @@ +/* 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 "aed.h" + +/*--------------------------------------------------------- + * Space sets up the world-to-screen transformation so + * that the rectangular area described by (x0, y0) and + * (x1, y1) will all be on-screen. + * + * Results: None. + * + * Side Effects: + * Our own variables scale, xbot, and ybot are changed. + *--------------------------------------------------------- + */ +space(x0, y0, x1, y1) +int x0, y0, x1, y1; +{ + int xscale, yscale, xsize, ysize; + xscale = (GRXMAX<<12)/(x1-x0); + yscale = (GRYMAX<<12)/(y1-y0); + if (xscale > yscale) scale = yscale; + else scale = xscale; + scale = (scale*9)/10 - 1; + if (scale<1) scale = 1; + xsize = (2048*GRXMAX)/scale + 1; + xbot = (x1+x0)/2 - xsize; + ysize = (2048*GRYMAX)/scale + 1; + ybot = (y1+y0)/2 - ysize; +} diff --git a/usr/src/ucbcmd/plot/libplot/aed/subr.c b/usr/src/ucbcmd/plot/libplot/aed/subr.c new file mode 100644 index 0000000000..57ea924424 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/aed/subr.c @@ -0,0 +1,105 @@ +/* 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 "aed.h" + +/* + * The following table is used to convert numbers to hex. We cannot use + * standard C library conversion because it generates lower case letters + * which are bad news to the AED512. + */ + +static char hex[] = "0123456789ABCDEF"; + +/*--------------------------------------------------------- + * This is a local routine that converts an integer to a string + * of hexadecimal characters. + * + * Results: None. + * + * Side Effects: + * The string contains the value of the low-order nchars 4-bit chunks + * of val, as represented in hexadecimal. String is zero-filled. + *--------------------------------------------------------- + */ +chex(val, string, nchars) +int val; /* Integer value to be converted. */ +char *string; /* Pointer to area for converted result. */ +int nchars; /* Number of characters to be converted. */ +{ + string = &(string[nchars]); + *string = '\0'; + for (; nchars>0 ; nchars--) + { + *(--string) = hex[val & 017]; + val >>= 4; + } +} + +/*--------------------------------------------------------- + * This local routine outputs an x-y coordinate pair in the standard + * format required by the AED display. + * + * Results: None. + * + * Side Effects: + * Characters are output to the AED512 in the standard way required + * for values indicated by "xy20" in the user manual. + * + * Errors: None. + *--------------------------------------------------------- + */ +outxy20(x, y) +int x, y; /* The coordinates to be output. Note: + * these are world coordinates, not screen + * ones. We scale in this routine. + */ +{ + char s1[4], s2[4], s3[4]; + x = ((x - xbot) * scale)>>12; + y = ((y - ybot) * scale)>>12; + chex(((y>>8)&03) | ((x>>6)&014), s1, 1); + chex(x&0377, s2, 2); + chex(y&0377, s3, 2); + fprintf(stdout, "%s%s%s", s1, s2, s3); +} + +/*--------------------------------------------------------- + * This routine sets the display's current color. + * + * Results: None. + * + * Side Effects: + * The current color in the display is set to pcolor, if it + * isn't that already. + *--------------------------------------------------------- + */ +setcolor(pcolor) +char *pcolor; /* Pointer to a string giving the desired + * color in hexadecimal. + */ +{ + static char curcolor[] = "xx"; + if ((pcolor[0] != curcolor[0]) || (pcolor[1] != curcolor[1])) + { + curcolor[0] = pcolor[0]; + curcolor[1] = pcolor[1]; + putc('L', stdout); + fputs(curcolor, stdout); + } +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/Makefile b/usr/src/ucbcmd/plot/libplot/bitgraph/Makefile new file mode 100644 index 0000000000..0da2659fe9 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/Makefile @@ -0,0 +1,54 @@ +# +# 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= ../libplotbg.a + +OBJECTS = arc.o box.o circle.o close.o cont.o dot.o erase.o label.o \ + line.o linemod.o move.o open.o point.o space.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)` + +# TXTS allows the AT&T makefile to be bootstrapped into the NSE. + +CLOBBERFILES= $(LIBRARY) + +.KEEP_STATE: + +all: $(LIBS) + +include ../../../../lib/Makefile.targ + diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/arc.c b/usr/src/ucbcmd/plot/libplot/bitgraph/arc.c new file mode 100644 index 0000000000..6ba92aaddd --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/arc.c @@ -0,0 +1,103 @@ +/* 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 "bg.h" + +/* should include test for equality? */ +#define side(x,y) (a*(x)+b*(y)+c > 0.0 ? 1 : -1) + +/* The beginning and ending points must be distinct. */ +arc(xc,yc,xbeg,ybeg,xend,yend) +int xc,yc,xbeg,ybeg,xend,yend; +{ + double r, radius, costheta, sintheta; + double a, b, c, x, y, tempX; + int right_side; + + int screen_xc = scaleX(xc); + int screen_yc = scaleY(yc); + + /* It is more convienient to beg and end relative to center. */ + int screen_xbeg = scaleX(xbeg) - screen_xc; + int screen_ybeg = scaleY(ybeg) - screen_yc; + + int screen_xend = scaleX(xend) - screen_xc; + int screen_yend = scaleY(yend) - screen_yc; + + /* probably should check that arc is truely circular */ + r = sqrt( (double) (screen_xbeg*screen_xbeg + screen_ybeg*screen_ybeg) ); + + /* + This method is reasonably efficient, clean, and clever. + The easy part is generating the next point on the arc. This is + done by rotating the points by the angle theta. Theta is chosen + so that no rotation will cause more than one pixel of a move. + This corresponds to a triangle having x side of r and y side of 1. + The rotation is done (way) below inside the loop. + + Note: all calculations are done in screen coordinates. + */ + if (r <= 1.0) { + /* radius is mapped to length < 1*/ + point(xc,yc); + return; + } + + radius = sqrt(r*r + 1.0); + sintheta = 1.0/radius; + costheta = r/radius; + + /* + The hard part of drawing an arc is figuring out when to stop. + This method works by drawing the line from the beginning point + to the ending point. This splits the plane in half, with the + arc that we wish to draw on one side of the line. If we evaluate + side(x,y) = a*x + b*y + c, then all of the points on one side of the + line will result in side being positive, and all the points on the + other side of the line will result in side being negative. + + We want to draw the arc in a counter-clockwise direction, so we + must find out what the sign of "side" is for a point which is to the + "right" of a line drawn from "beg" to "end". A point which must lie + on the right is [xbeg + (yend-ybeg), ybeg - (xend-xbeg)]. (This + point is perpendicular to the line at "beg"). + + Thus, we compute side of the above point, and then compare the + sign of side for each new point with the sign of the above point. + When they are different, we terminate the loop. + */ + + a = (double) (screen_yend - screen_ybeg); + b = (double) (screen_xend - screen_xbeg); + c = (double) (screen_yend*screen_xbeg - screen_xend*screen_ybeg); + right_side = side(screen_xbeg + (screen_yend-screen_ybeg), + screen_ybeg - (screen_xend-screen_xbeg) ); + + x = screen_xbeg; + y = screen_ybeg; + move(xbeg, ybeg); + do { + currentx = screen_xc + (int) (x + 0.5); + currenty = screen_yc + (int) (y + 0.5); + putchar( ESC ); + printf(":%d;%dd", currentx, currenty); + tempX = x; + x = x*costheta - y*sintheta; + y = tempX*sintheta + y*costheta; + } while( side(x,y) == right_side ); +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/bg.h b/usr/src/ucbcmd/plot/libplot/bitgraph/bg.h new file mode 100644 index 0000000000..1cfbe5ce23 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/bg.h @@ -0,0 +1,38 @@ +/* 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. + */ + +/* + * Displays plot files on a bbn bitgraph terminal. + */ + +#include <stdio.h> +#include <math.h> + +#define ESC 033 +#define PI 3.141592659 + +/* The graphics address range is 0..XMAX, 0..YMAX. */ +#define XMAX 768 +#define YMAX 1024 +#define scaleX(xi) ((int) ((xi - lowx)*scale +0.5)) +#define scaleY(yi) ((int) ((yi - lowy)*scale +0.5)) + +extern int currentx; +extern int currenty; +extern double lowx; +extern double lowy; +extern double scale; diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/box.c b/usr/src/ucbcmd/plot/libplot/bitgraph/box.c new file mode 100644 index 0000000000..ce721eefec --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/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/bitgraph/circle.c b/usr/src/ucbcmd/plot/libplot/bitgraph/circle.c new file mode 100644 index 0000000000..3fe8b150e9 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/circle.c @@ -0,0 +1,25 @@ +/* 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 (xc,yc,r) +int xc,yc,r; +{ + arc(xc,yc, xc+r,yc, xc-r,yc); + arc(xc,yc, xc-r,yc, xc+r,yc); +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/close.c b/usr/src/ucbcmd/plot/libplot/bitgraph/close.c new file mode 100644 index 0000000000..e38aa6d949 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/close.c @@ -0,0 +1,32 @@ +/* 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 <signal.h> +#include "bg.h" + +closepl() +{ + /* recieve interupts */ + signal(SIGINT, SIG_IGN); + + /* exit graphics mode */ + putchar( ESC ); + printf("[H"); + exit(0); +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/cont.c b/usr/src/ucbcmd/plot/libplot/bitgraph/cont.c new file mode 100644 index 0000000000..21e8dd0a93 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/cont.c @@ -0,0 +1,29 @@ +/* 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 "bg.h" + +cont(xi,yi) +int xi,yi; +{ + currentx = scaleX(xi); + currenty = scaleY(yi); + putchar( ESC ); + printf(":%d;%dd", currentx, currenty); +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/dot.c b/usr/src/ucbcmd/plot/libplot/bitgraph/dot.c new file mode 100644 index 0000000000..6aa953f3a3 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/dot.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. + */ + + + +dot(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/erase.c b/usr/src/ucbcmd/plot/libplot/bitgraph/erase.c new file mode 100644 index 0000000000..f250b14ac4 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/erase.c @@ -0,0 +1,28 @@ +/* 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 "bg.h" + +erase() +{ + putchar( ESC ); + printf("[H"); + putchar( ESC ); + printf("[J"); +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/label.c b/usr/src/ucbcmd/plot/libplot/bitgraph/label.c new file mode 100644 index 0000000000..bcf807b09f --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/label.c @@ -0,0 +1,24 @@ +/* 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; +{ + printf("%s", s); +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/line.c b/usr/src/ucbcmd/plot/libplot/bitgraph/line.c new file mode 100644 index 0000000000..ee9771b65e --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/line.c @@ -0,0 +1,33 @@ +/* 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 "bg.h" + +line(x0,y0,x1,y1) +int x0,y0,x1,y1; +{ + if(scaleX(x0)==currentx && scaleY(y0)==currenty) + cont(x1,y1); + else if(scaleX(x1)==currentx && scaleY(y1)==currenty) + cont(x0,y0); + else{ + move(x0,y0); + cont(x1,y1); + } +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/linemod.c b/usr/src/ucbcmd/plot/libplot/bitgraph/linemod.c new file mode 100644 index 0000000000..11f3e9e517 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/linemod.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. + */ + + + +linemod(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/move.c b/usr/src/ucbcmd/plot/libplot/bitgraph/move.c new file mode 100644 index 0000000000..7fb50e4584 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/move.c @@ -0,0 +1,29 @@ +/* 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 "bg.h" + +move(xi,yi) +int xi,yi; +{ + currentx = scaleX(xi); + currenty = scaleY(yi); + putchar( ESC ); + printf(":%d;%dm", currentx, currenty); +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/open.c b/usr/src/ucbcmd/plot/libplot/bitgraph/open.c new file mode 100644 index 0000000000..9735e7a3cc --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/open.c @@ -0,0 +1,43 @@ +/* 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. + */ + + + +/* + * Displays plot files on a BBN bitgraph terminal. + */ + +#include <signal.h> +#include "bg.h" + +int currentx = 0; +int currenty = 0; +double lowx = 0.0; +double lowy = 0.0; +double scale = 1.0; + +openpl() +{ + void closepl(); + + /* catch interupts */ + signal(SIGINT, closepl); + currentx = 0; + currenty = 0; + + space(0, 0, XMAX, YMAX); +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/point.c b/usr/src/ucbcmd/plot/libplot/bitgraph/point.c new file mode 100644 index 0000000000..a177c3bffd --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/point.c @@ -0,0 +1,25 @@ +/* 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. + */ + + + +point(xi, yi) +int xi, yi; +{ + move(xi, yi); + label("."); +} diff --git a/usr/src/ucbcmd/plot/libplot/bitgraph/space.c b/usr/src/ucbcmd/plot/libplot/bitgraph/space.c new file mode 100644 index 0000000000..e98efec98b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/bitgraph/space.c @@ -0,0 +1,31 @@ +/* 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 "bg.h" + +space(x0,y0,x1,y1) +int x0,y0,x1,y1; +{ + double scalex, scaley; + lowx = x0; + lowy = y0; + scalex = XMAX/(double)(x1-lowx); + scaley = YMAX/(double)(y1-lowy); + scale = scalex < scaley ? scalex : scaley; +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/Makefile b/usr/src/ucbcmd/plot/libplot/dumb/Makefile new file mode 100644 index 0000000000..ca99ef4be1 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/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= ../libdumb.a + +OBJECTS = arc.o box.o circle.o close.o cont.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/dumb/arc.c b/usr/src/ucbcmd/plot/libplot/dumb/arc.c new file mode 100644 index 0000000000..7bd038a3e2 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/arc.c @@ -0,0 +1,24 @@ +/* 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 "dumb.h" + +arc(xc,yc,xbeg,ybeg,xend,yend) +int xc,yc,xbeg,ybeg,xend,yend; +{ +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/box.c b/usr/src/ucbcmd/plot/libplot/dumb/box.c new file mode 100644 index 0000000000..ce721eefec --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/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/dumb/circle.c b/usr/src/ucbcmd/plot/libplot/dumb/circle.c new file mode 100644 index 0000000000..6dab0dce38 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/circle.c @@ -0,0 +1,19 @@ +/* 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(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/close.c b/usr/src/ucbcmd/plot/libplot/dumb/close.c new file mode 100644 index 0000000000..979b8dc369 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/close.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) 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 <signal.h> +#include "dumb.h" + +closepl() +{ + int i, j; + + for(j=0; j<LINES; j++){ + for(i=0; i<COLS; i++){ + printf("%c", screenmat[i][j]); + } + printf("\n"); + } + signal(SIGINT, SIG_IGN); + exit(0); +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/cont.c b/usr/src/ucbcmd/plot/libplot/dumb/cont.c new file mode 100644 index 0000000000..3233e5b49f --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/cont.c @@ -0,0 +1,29 @@ +/* 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 "dumb.h" + +cont(x, y) + int x,y; +{ + int x1, y1; + x1 = x; + y1 = y; + scale(x1, y1); + dda_line('*', currentx, currenty, x, y); +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/dot.c b/usr/src/ucbcmd/plot/libplot/dumb/dot.c new file mode 100644 index 0000000000..a9cf01dd0a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/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/dumb/dumb.h b/usr/src/ucbcmd/plot/libplot/dumb/dumb.h new file mode 100644 index 0000000000..acf77ba64d --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/dumb.h @@ -0,0 +1,39 @@ +/* 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. + */ + +/* + * This accepts plot file formats and produces the appropriate plots + * for dumb terminals. It can also be used for printing terminals and + * lineprinter listings, although there is no way to specify number of + * lines and columns different from your terminal. This would be easy + * to change, and is left as an exercise for the reader. + */ + +#include <math.h> + +#define scale(x,y) y = LINES-1-(LINES*y/rangeY +minY); x = COLS*x/rangeX + minX + +extern int minX, rangeX; /* min and range of x */ +extern int minY, rangeY; /* min and range of y */ +extern int currentx, currenty; +extern int COLS, LINES; + +/* A very large screen! (probably should use malloc) */ +#define MAXCOLS 132 +#define MAXLINES 90 + +extern char screenmat[MAXCOLS][MAXLINES]; diff --git a/usr/src/ucbcmd/plot/libplot/dumb/erase.c b/usr/src/ucbcmd/plot/libplot/dumb/erase.c new file mode 100644 index 0000000000..dae078fe39 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/erase.c @@ -0,0 +1,28 @@ +/* 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 "dumb.h" + +erase() +{ + register int i, j; + + for(i=0;i<COLS;i++) + for(j=0;j<LINES;j++) + screenmat[i][j] = ' '; +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/label.c b/usr/src/ucbcmd/plot/libplot/dumb/label.c new file mode 100644 index 0000000000..db28a34284 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/label.c @@ -0,0 +1,31 @@ +/* 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 "dumb.h" + +label(string) + char *string; +{ + while(*string != '\0' && currentx < COLS){ + screenmat[currentx][currenty] = *string++; + currentx++; + } + if(currentx == COLS) + currentx = currentx-1; + +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/line.c b/usr/src/ucbcmd/plot/libplot/dumb/line.c new file mode 100644 index 0000000000..01ae1418eb --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/line.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) 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 "dumb.h" + +line(x0, y0, x1, y1) + int x0, y0, x1, y1; +{ + int x,y; + + scale(x0, y0); + x = x1; + y = y1; + scale(x, y); + currentx = x0; + currenty = y0; + screenmat[currentx][currenty] = '*'; + dda_line('*', x0, y0, x1, y1); +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/linemod.c b/usr/src/ucbcmd/plot/libplot/dumb/linemod.c new file mode 100644 index 0000000000..47ceef55d3 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/linemod.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. + */ + + +linemod(s) +char *s; +{ +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/move.c b/usr/src/ucbcmd/plot/libplot/dumb/move.c new file mode 100644 index 0000000000..2e6ea7ad32 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/move.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 "dumb.h" + +move(x,y) +int x,y; +{ + scale(x, y); + currentx = x; + currenty = y; +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/open.c b/usr/src/ucbcmd/plot/libplot/dumb/open.c new file mode 100644 index 0000000000..26dad93202 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/open.c @@ -0,0 +1,67 @@ +/* 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. + */ + + +/* + * This accepts plot file formats and produces the appropriate plots + * for dumb terminals. It can also be used for printing terminals and + * lineprinter listings, although there is no way to specify number of + * lines and columns different from your terminal. This would be easy + * to change, and is left as an exercise for the reader. + */ + +#include <signal.h> +#include "dumb.h" + +int minX, rangeX; /* min and range of x */ +int minY, rangeY; /* min and range of y */ +int currentx,currenty; +int COLS,LINES; + +/* A very large screen! (probably should use malloc) */ +char screenmat[MAXCOLS][MAXLINES]; + +openpl() +{ + void closepl(); + int i, j; + char *term, *getenv(); + char bp[1024]; + + term = getenv("TERM"); + tgetent(bp, term); + + COLS = tgetnum("co"); + if (COLS > MAXCOLS) + COLS = MAXCOLS; + if (COLS < 0) + COLS = 48; /* lower bound on # of cols? */ + COLS--; /* prevent auto wrap */ + + LINES = tgetnum("li"); + if (LINES > MAXLINES) + LINES = MAXLINES; + if (LINES < 0) + LINES = 20; /* lower bound on # of lines? */ + + for(i=0; i<COLS; i++) + for(j=0; j<LINES; j++) + screenmat[i][j] = ' '; + + signal(SIGINT, closepl); + currentx = currenty = 0; +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/point.c b/usr/src/ucbcmd/plot/libplot/dumb/point.c new file mode 100644 index 0000000000..c6e72da637 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/point.c @@ -0,0 +1,28 @@ +/* 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 "dumb.h" + +point(x, y) + int x,y; +{ + scale(x, y); + currentx = x; + currenty = y; + screenmat[currentx][currenty] = '*'; +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/space.c b/usr/src/ucbcmd/plot/libplot/dumb/space.c new file mode 100644 index 0000000000..dad2cff44b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/space.c @@ -0,0 +1,28 @@ +/* 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 "dumb.h" + +space(x0, y0, x1, y1) + int x0, y0, x1, y1; +{ + minX = x0; + rangeX = x1 -x0; + minY = y0; + rangeY = y1 - y0; +} diff --git a/usr/src/ucbcmd/plot/libplot/dumb/subr.c b/usr/src/ucbcmd/plot/libplot/dumb/subr.c new file mode 100644 index 0000000000..102c483878 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/dumb/subr.c @@ -0,0 +1,57 @@ +/* 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 "dumb.h" + +/* Does not plot first point -- assumed that it is already plotted */ +dda_line(ch, x0, y0, x1, y1) + char ch; + int x0, y0; /* already transformed to screen coords */ + int x1, y1; /* untransformed */ +{ + int length, i; + double deltaX, deltaY; + double x, y; + double floor(); + int abs(); + + scale(x1, y1); + + length = abs(x1 - x0); + if (abs(y1 -y0) > length) + length = abs(y1 - y0); + + if (length == 0) + return; + + deltaX = (double) (x1 - x0)/(double) length; + deltaY = (double) (y1 - y0)/(double) length; + + x = (double) x0 + 0.5; + y = (double) y0 + 0.5; + + for (i=0; i < length; ++i) { + x += deltaX; + y += deltaY; + x0 = floor(x); + y0 = floor(y); + currentx = x0; + currenty = y0; + screenmat[currentx][currenty] = ch; + } +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/Makefile b/usr/src/ucbcmd/plot/libplot/gigi/Makefile new file mode 100644 index 0000000000..e423dee541 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/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= ../libgigi.a + +OBJECTS = arc.o box.o circle.o close.o cont.o dot.o erase.o label.o \ + line.o linemod.o move.o open.o point.o space.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/gigi/arc.c b/usr/src/ucbcmd/plot/libplot/gigi/arc.c new file mode 100644 index 0000000000..edaec6a548 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/arc.c @@ -0,0 +1,57 @@ +/* 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 "gigi.h" + +/* + * gigi requires knowing the anlge of arc. To do this, the triangle formula + * c^2 = a^2 + b^2 - 2*a*b*cos(angle) + * is used where "a" and "b" are the radius of the circle and "c" is the + * distance between the beginning point and the end point. + * + * This gives us "angle" or angle - 180. To find out which, draw a line from + * beg to center. This splits the plane in half. All points on one side of the + * plane will have the same sign when plugged into the equation for the line. + * Pick a point on the "right side" of the line (see program below). If "end" + * has the same sign as this point does, then they are both on the same side + * of the line and so angle is < 180. Otherwise, angle > 180. + */ + +#define side(x,y) (a*(x)+b*(y)+c > 0.0 ? 1 : -1) + +arc(xcent,ycent,xbeg,ybeg,xend,yend) +int xcent,ycent,xbeg,ybeg,xend,yend; +{ + double radius2, c2; + double a,b,c; + int angle; + + /* Probably should check that this is really a circular arc. */ + radius2 = (xcent-xbeg)*(xcent-xbeg) + (ycent-ybeg)*(ycent-ybeg); + c2 = (xend-xbeg)*(xend-xbeg) + (yend-ybeg)*(yend-ybeg); + angle = (int) ( 180.0/PI * acos(1.0 - c2/(2.0*radius2)) + 0.5 ); + + a = (double) (ycent - ybeg); + b = (double) (xcent - xbeg); + c = (double) (ycent*xbeg - xcent*ybeg); + if (side(xbeg + (ycent-ybeg), ybeg - (xcent-xbeg)) != side(xend,yend)) + angle += 180; + + move(xcent, ycent); + printf("C(A%d c)[%d,%d]", angle, xbeg, ybeg); +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/box.c b/usr/src/ucbcmd/plot/libplot/gigi/box.c new file mode 100644 index 0000000000..ce721eefec --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/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/gigi/circle.c b/usr/src/ucbcmd/plot/libplot/gigi/circle.c new file mode 100644 index 0000000000..f3442861ab --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/circle.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. + */ + + +#include "gigi.h" + +circle (xc,yc,r) +int xc,yc,r; +{ + if(r < 1){ + point(xc, yc); + return; + } + move(xc, yc); + printf("C[%d]", r); +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/close.c b/usr/src/ucbcmd/plot/libplot/gigi/close.c new file mode 100644 index 0000000000..9373a4729d --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/close.c @@ -0,0 +1,32 @@ +/* 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 <signal.h> +#include "gigi.h" + +closepl() +{ + /* recieve interupts */ + signal(SIGINT, SIG_IGN); + + /* exit graphics mode */ + putchar( ESC ); + putchar('\\'); + + exit(0); +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/cont.c b/usr/src/ucbcmd/plot/libplot/gigi/cont.c new file mode 100644 index 0000000000..8005fd1f97 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/cont.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 "gigi.h" + +cont(xi,yi) +int xi,yi; +{ + currentx = xsc(xi); + currenty = ysc(yi); + printf("V[%d,%d]",currentx, currenty); +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/dot.c b/usr/src/ucbcmd/plot/libplot/gigi/dot.c new file mode 100644 index 0000000000..a9cf01dd0a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/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/gigi/erase.c b/usr/src/ucbcmd/plot/libplot/gigi/erase.c new file mode 100644 index 0000000000..d50da21696 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/erase.c @@ -0,0 +1,24 @@ +/* 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 "gigi.h" + +erase() +{ + printf("S(E)"); +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/gigi.h b/usr/src/ucbcmd/plot/libplot/gigi/gigi.h new file mode 100644 index 0000000000..d23c6065b7 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/gigi.h @@ -0,0 +1,42 @@ +/* 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. + */ + +/* + * Displays plot files on a gigi "graphics" terminal. + */ + +#include <stdio.h> +#include <math.h> + +#define ESC 033 +#define PI 3.141592659 + +/* + * The graphics address range is 0..XMAX, YMAX..0 where (0, YMAX) is the + * lower left corner. + */ +#define XMAX 767 +#define YMAX 479 +#define xsc(xi) ((int) ((xi -lowx)*scalex +0.5)) +#define ysc(yi) ((int) (YMAX - (yi - lowy)*scaley +0.5)) + +extern int currentx; +extern int currenty; +extern double lowx; +extern double lowy; +extern double scalex; +extern double scaley; diff --git a/usr/src/ucbcmd/plot/libplot/gigi/label.c b/usr/src/ucbcmd/plot/libplot/gigi/label.c new file mode 100644 index 0000000000..e5f0a28a8d --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/label.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. + */ + + +#include "gigi.h" + +label(s) +char *s; +{ + printf("T(S0 H2 D0 I0) \""); + for(;*s!='\0';s++) { + putchar(*s); + if (*s == '"') putchar('"'); + } + putchar('"'); +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/line.c b/usr/src/ucbcmd/plot/libplot/gigi/line.c new file mode 100644 index 0000000000..61aca3c623 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/line.c @@ -0,0 +1,32 @@ +/* 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 "gigi.h" + +line(x0,y0,x1,y1) +int x0,y0,x1,y1; +{ + if(xsc(x0)==currentx && ysc(y0)==currenty) + cont(x1,y1); + else if(xsc(x1)==currentx && ysc(y1)==currenty) + cont(x0,y0); + else{ + move(x0,y0); + cont(x1,y1); + } +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/linemod.c b/usr/src/ucbcmd/plot/libplot/gigi/linemod.c new file mode 100644 index 0000000000..dc7b011937 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/linemod.c @@ -0,0 +1,79 @@ +/* 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 "gigi.h" + +linemod( line ) +char *line; +{ + /* + * Note that the bit patterns could be compacted using the + * repeat field conventions. They aren't for clarity. + * Examples of almost identical packed patterns are in the + * comments. + * If linemod is changed really often, a ~15% savings + * could be achieved. + */ + if ( *(line) == 's' ) { + if ( *(++line) == 'o' ) { + /* + * solid mode 1 + */ + printf( "W(P1)" ); + return; + } + else if ( *(line) == 'h' ) { + /* + * shortdashed mode 4 + * printf( "W(P000111)" ); + */ + printf( "W(P00011100)" ); + return; + } + } + else if ( *(line) == 'd' ) { + if ( *(++line) == 'o' && *(++line) == 't' ) { + if ( *(++line) == 't' ) { + /* + * dotted mode 2 + * printf( "W(P00001)" ); + */ + printf( "W(P10000000)" ); + return; + } + else if ( *(line) == 'd' ) { + /* + * dotdashed mode 3 + * printf( "W(P0110010)" ); + */ + printf( "W(P10001100)" ); + return; + } + } + } + else if ( *(line) == 'l' ) { + /* + * longdashed mode 5 + * printf( "W(P11100)" ); + */ + printf( "W(P11111100)" ); + return; + } + printf( "W(P1)" ); /* default to solid */ + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/move.c b/usr/src/ucbcmd/plot/libplot/gigi/move.c new file mode 100644 index 0000000000..d575ff6aa0 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/move.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 "gigi.h" + +move(xi,yi) +int xi,yi; +{ + currentx = xsc(xi); + currenty = ysc(yi); + printf("P[%d,%d]",currentx, currenty); +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/open.c b/usr/src/ucbcmd/plot/libplot/gigi/open.c new file mode 100644 index 0000000000..7f23b8479e --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/open.c @@ -0,0 +1,48 @@ +/* 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. + */ + + +/* + * Displays plot files on a gigi "graphics" terminal. + */ + +#include <signal.h> +#include "gigi.h" + +int currentx = 0; +int currenty = 0; +double lowx = 0.0; +double lowy = 0.0; +double scalex = 1.0; +double scaley = 1.0; + +openpl() +{ + void closepl(); + + /* catch interupts */ + signal(SIGINT, closepl); + currentx = 0; + currenty = 0; + /* enter grapics mode */ + putchar(ESC); putchar('P'); putchar('p'); + + /* set some parameters */ + printf("S(I0 T0 [0,0])"); + + space(0, 0, XMAX, YMAX); +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/point.c b/usr/src/ucbcmd/plot/libplot/gigi/point.c new file mode 100644 index 0000000000..f9579ce205 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/point.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 "gigi.h" + +point(xi,yi) +int xi,yi; +{ + if(xsc(xi)!=currentx || ysc(yi)!=currenty) + move(xi,yi); + printf("V[]"); +} diff --git a/usr/src/ucbcmd/plot/libplot/gigi/space.c b/usr/src/ucbcmd/plot/libplot/gigi/space.c new file mode 100644 index 0000000000..ea3ed79b6b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/gigi/space.c @@ -0,0 +1,28 @@ +/* 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 "gigi.h" + +space(x0,y0,x1,y1) +int x0,y0,x1,y1; +{ + lowx = x0; + lowy = y0; + scalex = XMAX/(x1-lowx); + scaley = YMAX/(y1-lowy); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/Makefile b/usr/src/ucbcmd/plot/libplot/hp2648/Makefile new file mode 100644 index 0000000000..44f64ec2a8 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/Makefile @@ -0,0 +1,54 @@ +# +# 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= ../libhp2648.a + +OBJECTS = arc.o box.o circle.o close.o cont.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 +#include ../../../Makefile.ucbtarg + diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/arc.c b/usr/src/ucbcmd/plot/libplot/hp2648/arc.c new file mode 100644 index 0000000000..6380a8ae49 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/arc.c @@ -0,0 +1,63 @@ +/* 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 "hp2648.h" + +arc(xcent,ycent,xbeg,ybeg,xend,yend) +int xcent,ycent,xbeg,ybeg,xend,yend; +{ + double costheta,sintheta,x,y,xn,r; + double x1,y1,x2,y2; + int xi,yi,crosspflag,crossp; + + r = (xcent-xbeg)*(xcent-xbeg)+(ycent-ybeg)*(ycent-ybeg); + r = pow(r,0.5); + if(r<1){ + point(xcent,ycent); + return; + } + sintheta = 1.0/r; + costheta = pow(1-sintheta*sintheta,0.5); + xi = x = xbeg-xcent; + yi = y = ybeg-ycent; + x1 = xcent; + y1 = ycent; + x2 = xend; + y2 = yend; + crosspflag = 0; + do { + crossp = cross_product(x1,y1,x2,y2,x,y); + if(crossp >0 && crosspflag == 0) crosspflag = 1; + point(xcent+xi,ycent+yi); + xn = x; + xi = x = x*costheta + y*sintheta; + yi = y = y*costheta - xn*sintheta; + } while( crosspflag == 0 || crossp >0); +} + +cross_product(x1,y1,x2,y2,x3,y3) +double x1,x2,x3,y1,y2,y3; +{ + double z,a,b; + a = (y3-y2)*(x2-x1); + b = (x3-x2)*(y2-y1); + z = a-b; + if(z<0) return(-1); + if(z>0) return(1); + return(0); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/box.c b/usr/src/ucbcmd/plot/libplot/hp2648/box.c new file mode 100644 index 0000000000..ce721eefec --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/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/hp2648/circle.c b/usr/src/ucbcmd/plot/libplot/hp2648/circle.c new file mode 100644 index 0000000000..692e3302fc --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/circle.c @@ -0,0 +1,41 @@ +/* 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 "hp2648.h" + +circle (xc,yc,r) +int xc,yc,r; +{ + double costheta,sintheta,x,y,xn; + int xi,yi; + + if(r<1){ + point(xc,yc); + return; + } + sintheta = 1.0/r; + costheta = pow(1-sintheta*sintheta,0.5); + xi = x = r; + yi = y = 0; + do { + point(xc+xi,yc+yi); + xn = x; + xi = x = x*costheta + y*sintheta; + yi = y = y*costheta - xn*sintheta; + } while( ! (yi==0 && xi >= r-1)); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/close.c b/usr/src/ucbcmd/plot/libplot/hp2648/close.c new file mode 100644 index 0000000000..f364793348 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/close.c @@ -0,0 +1,29 @@ +/* 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 "hp2648.h" + +closepl() +{ + putchar('Z'); + fflush(stdout); + if ( shakehands == TRUE ) { + stty(fildes, &sarg); + close(fildes); + } +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/cont.c b/usr/src/ucbcmd/plot/libplot/hp2648/cont.c new file mode 100644 index 0000000000..84ca2d0000 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/cont.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) 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 "hp2648.h" + +cont(xi,yi) +int xi,yi; +{ + char xb1,xb2,yb1,yb2; + itoa(xsc(xi),&xb1,&xb2); + itoa(ysc(yi),&yb1,&yb2); + buffready(4); + putchar(xb2); + putchar(xb1); + putchar(yb2); + putchar(yb1); + currentx = xsc(xi); + currenty = ysc(yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/dot.c b/usr/src/ucbcmd/plot/libplot/hp2648/dot.c new file mode 100644 index 0000000000..a9cf01dd0a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/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/hp2648/erase.c b/usr/src/ucbcmd/plot/libplot/hp2648/erase.c new file mode 100644 index 0000000000..15aeb53aad --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/erase.c @@ -0,0 +1,32 @@ +/* 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 "hp2648.h" + +erase() +{ + buffready(8); + putchar(ESC); + putchar(GRAPHIC); + putchar(DISPLAY); + putchar('a'); + putchar(ESC); + putchar(GRAPHIC); + putchar(PLOT); + putchar(BINARY); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/hp2648.h b/usr/src/ucbcmd/plot/libplot/hp2648/hp2648.h new file mode 100644 index 0000000000..70278d20c5 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/hp2648.h @@ -0,0 +1,55 @@ +/* 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. + */ + +/* + * Displays plot files on an hp2648a graphics terminals. I have heard + * that all hp plotting devices use the same control sequences, so this + * might work for all hp devices capable of plotting. + */ + +#include <stdio.h> + +#define TERMINAL "/dev/tty" + +#define ENQ 05 +#define ACK 06 +#define ESC 033 +#define GRAPHIC '*' +#define MODE 'm' +#define PLOT 'p' +#define DISPLAY 'd' +#define PENUP 'a' +#define BINARY 'i' +#define ASCII 'f' +#define CR '\n' + +#define TRUE 1 +#define FALSE 0 + +#define xsc(xi) ((int) (xi - lowx) * scalex + 0.5) +#define ysc(yi) ((int) (yi - lowy) * scaley + 0.5) + +extern int shakehands; +extern int currentx; +extern int currenty; +extern int buffcount; +extern int fildes; +extern float lowx; +extern float lowy; +extern float scalex; +extern float scaley; +extern struct sgttyb sarg; diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/label.c b/usr/src/ucbcmd/plot/libplot/hp2648/label.c new file mode 100644 index 0000000000..fec2cbd916 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/label.c @@ -0,0 +1,40 @@ +/* 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 "hp2648.h" + +label(s) +char *s; +{ + handshake(); + putchar(ESC); + putchar(GRAPHIC); + putchar('l'); + for(;*s!='\0';s++) + putchar(*s); + putchar(ESC); + putchar(GRAPHIC); + putchar('d'); + putchar('T'); + handshake(); + putchar(ESC); + putchar(GRAPHIC); + putchar(PLOT); + putchar(BINARY); + buffcount = 4; +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/line.c b/usr/src/ucbcmd/plot/libplot/hp2648/line.c new file mode 100644 index 0000000000..c9ae574e8f --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/line.c @@ -0,0 +1,32 @@ +/* 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 "hp2648.h" + +line(x0,y0,x1,y1) +int x0,y0,x1,y1; +{ + if(xsc(x0)==currentx && ysc(y0)==currenty) + cont(x1,y1); + else if(xsc(x1)==currentx && ysc(y1)==currenty) + cont(x0,y0); + else{ + move(x0,y0); + cont(x1,y1); + } +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/linemod.c b/usr/src/ucbcmd/plot/libplot/hp2648/linemod.c new file mode 100644 index 0000000000..8ab4fcd1d9 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/linemod.c @@ -0,0 +1,86 @@ +/* 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 "hp2648.h" + +linemod( line ) +char *line; +{ + putchar('Z'); + handshake(); + putchar(ESC); + putchar(GRAPHIC); + putchar(MODE); + if ( *(line) == 's' ) { + if ( *(++line) == 'o' ) { + /* + * solid mode 1 + */ + putchar( '1' ); + putchar( 'b' ); + goto done; + } + else if ( *(line) == 'h' ) { + /* + * shortdashed mode 4 + */ + putchar( '6' ); + putchar( 'b' ); + goto done; + } + } + else if ( *(line) == 'd' ) { + if ( *(++line) == 'o' && *(++line) == 't' ) { + if ( *(++line) == 't' ) { + /* + * dotted mode 2 + */ + putchar( '7' ); + putchar( 'b' ); + goto done; + } + else if ( *(line) == 'd' ) { + /* + * dotdashed mode 3 + */ + putchar( '8' ); + putchar( 'b' ); + goto done; + } + } + } + else if ( *(line) == 'l' ) { + /* + * longdashed mode 5 + */ + putchar( '5' ); + putchar( 'b' ); + goto done; + } + putchar( '1' ); /* default to solid */ + putchar( 'b' ); /* default to solid */ +done: + putchar( 'Z' ); + handshake(); + putchar(ESC); + putchar(GRAPHIC); + putchar(PLOT); + putchar(BINARY); + buffcount = 4; + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/move.c b/usr/src/ucbcmd/plot/libplot/hp2648/move.c new file mode 100644 index 0000000000..25864e3f00 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/move.c @@ -0,0 +1,35 @@ +/* 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 "hp2648.h" + +move(xi,yi) +int xi,yi; +{ + char xb1,xb2,yb1,yb2; + itoa(xsc(xi),&xb1,&xb2); + itoa(ysc(yi),&yb1,&yb2); + buffready(5); + putchar(PENUP); + putchar(xb2); + putchar(xb1); + putchar(yb2); + putchar(yb1); + currentx = xsc(xi); + currenty = ysc(yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/open.c b/usr/src/ucbcmd/plot/libplot/hp2648/open.c new file mode 100644 index 0000000000..51aa8a8c92 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/open.c @@ -0,0 +1,59 @@ +/* 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 <sgtty.h> +#include "hp2648.h" + +int shakehands; +int currentx; +int currenty; +int buffcount; +int fildes; +float lowx; +float lowy; +float scalex; +float scaley; +struct sgttyb sarg; + +openpl() +{ + if ( isatty(fileno( stdout )) ) { + shakehands = TRUE; + fildes = open(TERMINAL, 0); + gtty(fildes, &sarg); + sarg.sg_flags = sarg.sg_flags | RAW; + stty(fildes, &sarg); + sarg.sg_flags = sarg.sg_flags & ~RAW; + } + else { + shakehands = FALSE; + } + buffcount = 0; + currentx = 0; + currenty = 0; + buffready(8); + putchar(ESC); + putchar(GRAPHIC); + putchar(DISPLAY); + putchar('c'); + putchar(ESC); + putchar(GRAPHIC); + putchar(PLOT); + putchar(BINARY); + space(0,0,720,360); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/point.c b/usr/src/ucbcmd/plot/libplot/hp2648/point.c new file mode 100644 index 0000000000..7cca9c5de5 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/point.c @@ -0,0 +1,28 @@ +/* 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 "hp2648.h" + +point(xi,yi) +int xi,yi; +{ + if(xsc(xi)!=currentx || ysc(yi)!=currenty) + move(xi,yi); + buffready(1); + putchar('d'); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/space.c b/usr/src/ucbcmd/plot/libplot/hp2648/space.c new file mode 100644 index 0000000000..9524781d6a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/space.c @@ -0,0 +1,28 @@ +/* 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 "hp2648.h" + +space(x0,y0,x1,y1) +int x0,y0,x1,y1; +{ + lowx = x0; + lowy = y0; + scalex = 720.0/(x1-lowx); + scaley = 360.0/(y1-lowy); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp2648/subr.c b/usr/src/ucbcmd/plot/libplot/hp2648/subr.c new file mode 100644 index 0000000000..3fecfb3922 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp2648/subr.c @@ -0,0 +1,65 @@ +/* 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 <sgtty.h> +#include "hp2648.h" + +handshake() +{ + int i; + char ch; + + if( shakehands != TRUE ) + return; + ch = ' '; + putchar(ENQ); + fflush(stdout); + while(1){ + i = read(fildes, &ch, 1); + if(i < 0) + continue; + if(ch == ACK) + break; + putchar('Z'); + fflush(stdout); + stty(fildes, &sarg); + exit(0); + } +} + +buffready(n) +int n; +{ + buffcount = buffcount + n; + if(buffcount >= 80){ + handshake(); + putchar(ESC); + putchar(GRAPHIC); + putchar(PLOT); + putchar(BINARY); + buffcount = n+4; + } +} + +itoa(num,byte1,byte2) +int num; +char *byte1,*byte2; +{ + *byte1 = (num & 037) | 040; + *byte2 = ((num>>5) & 037) | 040; +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/Makefile b/usr/src/ucbcmd/plot/libplot/hp7221/Makefile new file mode 100644 index 0000000000..87a031bc8b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/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= ../libhp7221.a + +OBJECTS = arc.o box.o circle.o close.o cont.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/hp7221/arc.c b/usr/src/ucbcmd/plot/libplot/hp7221/arc.c new file mode 100644 index 0000000000..1ad9cb2c46 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/arc.c @@ -0,0 +1,59 @@ +/* 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 "hp7221.h" + +/* + * 7221 requires knowing the anlge of arc. To do this, the triangle formula + * c^2 = a^2 + b^2 - 2*a*b*cos(angle) + * is used where "a" and "b" are the radius of the circle and "c" is the + * distance between the beginning point and the end point. + * + * This gives us "angle" or angle - 180. To find out which, draw a line from + * beg to center. This splits the plane in half. All points on one side of the + * plane will have the same sign when plugged into the equation for the line. + * Pick a point on the "right side" of the line (see program below). If "end" + * has the same sign as this point does, then they are both on the same side + * of the line and so angle is < 180. Otherwise, angle > 180. + */ + +#define side(x,y) (a*(x)+b*(y)+c > 0.0 ? 1 : -1) + +arc(xcent,ycent,xbeg,ybeg,xend,yend) +int xcent,ycent,xbeg,ybeg,xend,yend; +{ + double radius2, c2; + double a,b,c; + int angle; + + /* Probably should check that this is really a circular arc. */ + radius2 = (xcent-xbeg)*(xcent-xbeg) + (ycent-ybeg)*(ycent-ybeg); + c2 = (xend-xbeg)*(xend-xbeg) + (yend-ybeg)*(yend-ybeg); + angle = (int) ( 180.0/PI * acos(1.0 - c2/(2.0*radius2)) + 0.5 ); + + a = (double) (ycent - ybeg); + b = (double) (xcent - xbeg); + c = (double) (ycent*xbeg - xcent*ybeg); + if (side(xbeg + (ycent-ybeg), ybeg - (xcent-xbeg)) != side(xend,yend)) + angle += 180; + + move(xcent, ycent); + /* Not quite implemented... + printf("C(A%d c)[%d,%d]", angle, xbeg, ybeg); + */ +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/box.c b/usr/src/ucbcmd/plot/libplot/hp7221/box.c new file mode 100644 index 0000000000..ce721eefec --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/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/hp7221/circle.c b/usr/src/ucbcmd/plot/libplot/hp7221/circle.c new file mode 100644 index 0000000000..18630d286e --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/circle.c @@ -0,0 +1,31 @@ +/* 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 "hp7221.h" + +circle (xc,yc,r) + int xc,yc,r; +{ + if( r < 1 ) { + point( xc, yc ); + return; + } + move( xc, yc ); + putchar( 't' ); + putMBN( scaleX(r) ); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/close.c b/usr/src/ucbcmd/plot/libplot/hp7221/close.c new file mode 100644 index 0000000000..4e7aa04437 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/close.c @@ -0,0 +1,28 @@ +/* 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 <signal.h> +#include "hp7221.h" + +closepl() +{ + /* receive interupts */ + signal(SIGINT, SIG_IGN); + printf( "v@}" ); /* Put pen away. */ + fflush( stdout ); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/cont.c b/usr/src/ucbcmd/plot/libplot/hp7221/cont.c new file mode 100644 index 0000000000..240655ae9f --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/cont.c @@ -0,0 +1,28 @@ +/* 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 "hp7221.h" + +cont(xi,yi) +int xi,yi; +{ + currentx = scaleX(xi); + currenty = scaleY(yi); + putchar( 'q' ); + putMBP( currentx, currenty ); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/dot.c b/usr/src/ucbcmd/plot/libplot/hp7221/dot.c new file mode 100644 index 0000000000..a9cf01dd0a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/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/hp7221/erase.c b/usr/src/ucbcmd/plot/libplot/hp7221/erase.c new file mode 100644 index 0000000000..f255de3efd --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/erase.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. + */ + + +erase(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/hp7221.h b/usr/src/ucbcmd/plot/libplot/hp7221/hp7221.h new file mode 100644 index 0000000000..ca4274dd5f --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/hp7221.h @@ -0,0 +1,44 @@ +/* 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. + */ + +/* + * Displays plot files on an HP7221 plotter. + * Cloned from bgplot.c and gigiplot.c by Jim Kleckner + * Thu Jun 30 13:35:04 PDT 1983 + * Requires a handshaking program such as hp7221cat to get + * the plotter open and ready. + */ + +#include <stdio.h> +#include <math.h> + +#define ESC 033 +#define PI 3.141592659 +#define ENDOFSTRING 03 + +/* The graphics address range is 0..XMAX, 0..YMAX. */ +#define XMAX 1800 +#define YMAX 1800 + +#define scaleX(xi) ((int) ((xi - lowx)*scale +0.5)) +#define scaleY(yi) ((int) ((yi - lowy)*scale +0.5)) + +extern int currentx; +extern int currenty; +extern double lowx; +extern double lowy; +extern double scale; diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/label.c b/usr/src/ucbcmd/plot/libplot/hp7221/label.c new file mode 100644 index 0000000000..19434255a7 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/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. + */ + + +#include "hp7221.h" + +label(s) +char *s; +{ + printf("~'%s", s); + putchar( ENDOFSTRING ); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/line.c b/usr/src/ucbcmd/plot/libplot/hp7221/line.c new file mode 100644 index 0000000000..75f35abc4c --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/line.c @@ -0,0 +1,32 @@ +/* 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 "hp7221.h" + +line(x0,y0,x1,y1) +int x0,y0,x1,y1; +{ + if(scaleX(x0)==currentx && scaleY(y0)==currenty) + cont(x1,y1); + else if(scaleX(x1)==currentx && scaleY(y1)==currenty) + cont(x0,y0); + else{ + move(x0,y0); + cont(x1,y1); + } +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/linemod.c b/usr/src/ucbcmd/plot/libplot/hp7221/linemod.c new file mode 100644 index 0000000000..f950e8d4ef --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/linemod.c @@ -0,0 +1,78 @@ +/* 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 "hp7221.h" + +linemod( line ) +char *line; +{ + /* + * Note that the bit patterns could be compacted using the + * repeat field conventions. They aren't for clarity. + * Examples of almost identical packed patterns are in the + * comments. + * If linemod is changed really often, a ~15% savings + * could be achieved. + */ + if ( *(line) == 's' ) { + if ( *(++line) == 'o' ) { + /* + * solid mode 1 + */ + printf( "vA" ); + return; + } + else if ( *(line) == 'h' ) { + /* + * shortdashed mode 4 + */ + printf( "vD" ); + return; + } + } + else if ( *(line) == 'd' ) { + if ( *(++line) == 'o' && *(++line) == 't' ) { + if ( *(++line) == 't' ) { + /* + * dotted mode 2 + * printf( "W(P00001)" ); + */ + printf( "vB" ); + return; + } + else if ( *(line) == 'd' ) { + /* + * dotdashed mode 3 + * printf( "W(P0110010)" ); + */ + printf( "vC" ); + return; + } + } + } + else if ( *(line) == 'l' ) { + /* + * longdashed mode 5 + * printf( "W(P11100)" ); + */ + printf( "vE" ); + return; + } + printf( "vA" ); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/move.c b/usr/src/ucbcmd/plot/libplot/hp7221/move.c new file mode 100644 index 0000000000..9cd6d103e3 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/move.c @@ -0,0 +1,28 @@ +/* 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 "hp7221.h" + +move(xi,yi) +int xi,yi; +{ + currentx = scaleX(xi); + currenty = scaleY(yi); + putchar( 'p' ); + putMBP( currentx, currenty ); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/open.c b/usr/src/ucbcmd/plot/libplot/hp7221/open.c new file mode 100644 index 0000000000..a64280367f --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/open.c @@ -0,0 +1,52 @@ +/* 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. + */ + + +/* + * Displays plot files on an HP7221 plotter. + * Cloned from bgplot.c and gigiplot.c by Jim Kleckner + * Thu Jun 30 13:35:04 PDT 1983 + * Requires a handshaking program such as hp7221cat to get + * the plotter open and ready. + */ + +#include <signal.h> +#include "hp7221.h" + +int currentx = 0; +int currenty = 0; +double lowx = 0.0; +double lowy = 0.0; +double scale = 1.0; + +openpl() +{ + void closepl(); + + /* catch interupts */ + signal(SIGINT, closepl); + currentx = 0; + currenty = 0; + printf( "~VR~W" ); + putMBP( 800, 2000 ); + putMBP( 7600, 9600 ); + printf( "~S" ); + putMBP( XMAX, YMAX ); + printf( "vA~*z" ); + + space(0,0,XMAX,YMAX); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/point.c b/usr/src/ucbcmd/plot/libplot/hp7221/point.c new file mode 100644 index 0000000000..c5a4d12a15 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/point.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 "hp7221.h" + +point(xi,yi) +int xi,yi; +{ + if(scaleX(xi)!=currentx || scaleY(yi)!=currenty) + move(xi,yi); + cont(xi, yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/space.c b/usr/src/ucbcmd/plot/libplot/hp7221/space.c new file mode 100644 index 0000000000..9792bbcc1b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/space.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. + */ + + +#include "hp7221.h" + +space(x0,y0,x1,y1) +int x0,y0,x1,y1; +{ + double scalex, scaley; + lowx = x0; + lowy = y0; + scalex = XMAX/(double)(x1-lowx); + scaley = YMAX/(double)(y1-lowy); + scale = scalex < scaley ? scalex : scaley; +} diff --git a/usr/src/ucbcmd/plot/libplot/hp7221/subr.c b/usr/src/ucbcmd/plot/libplot/hp7221/subr.c new file mode 100644 index 0000000000..74f3d407fb --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/hp7221/subr.c @@ -0,0 +1,83 @@ +/* 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 "hp7221.h" + +putMBP( x, y ) + int x, y; +{ + int chr; + + chr = ( x >> 10 ) & 017; + chr|= 0140; + putchar( chr ); + chr = ( x >> 4 ) & 077; + if ( chr < 32 ) { + chr += 64; + } + putchar( chr ); + chr = ( y >> 12 ) & 03; + chr|= ( x << 2 ) & 071; + if ( chr < 32 ) { + chr += 64; + } + putchar( chr ); + chr = ( y >> 6 ) & 077; + if ( chr < 32 ) { + chr += 64; + } + putchar( chr ); + chr = ( y ) & 077; + if ( chr < 32 ) { + chr += 64; + } + putchar( chr ); + return; +} + +putMBN( i ) + int i; +{ + int chr; + + chr = ( i>>12 ) & 07; + chr|= 0140; + putchar( chr ); + chr = ( i>>6 ) & 077; + if ( chr < 32 ) { + chr += 64; + } + putchar( chr ); + chr = i & 077; + if ( chr < 32 ) { + chr += 64; + } + putchar( chr ); + return; +} + +putSBN( i ) + int i; +{ + i &= 077; + if ( i < 32 ) { + i += 64; + } + putchar( i ); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/Makefile b/usr/src/ucbcmd/plot/libplot/imagen/Makefile new file mode 100644 index 0000000000..a82b75d914 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/Makefile @@ -0,0 +1,57 @@ +# +# 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" +# + +DEFRES = 240 + +LIBRARY= ../libimagen.a + +OBJECTS = arc.o box.o charset.o circle.o close.o cont.o dot.o erase.o label.o \ + line.o linemod.o move.o open.o point.o scale.o space.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) + +CPPFLAGS += -DDEFRES=$(DEFRES) + +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/imagen/arc.c b/usr/src/ucbcmd/plot/libplot/imagen/arc.c new file mode 100644 index 0000000000..35e2d3f440 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/arc.c @@ -0,0 +1,127 @@ +/* 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 = sqrt(pc); + 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*sqrt(pc)+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*sqrt(pc)+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); +} +abs(a){ + if(a < 0)return(-a); + return(a); +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/box.c b/usr/src/ucbcmd/plot/libplot/imagen/box.c new file mode 100644 index 0000000000..ce721eefec --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/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/imagen/charset.c b/usr/src/ucbcmd/plot/libplot/imagen/charset.c new file mode 100644 index 0000000000..5beefed61a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/charset.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. + */ + + +#include "imp.h" +char *imP_charset = "cour07"; +int imPcsize = 12; diff --git a/usr/src/ucbcmd/plot/libplot/imagen/circle.c b/usr/src/ucbcmd/plot/libplot/imagen/circle.c new file mode 100644 index 0000000000..45bbe8bdf5 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/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/imagen/close.c b/usr/src/ucbcmd/plot/libplot/imagen/close.c new file mode 100644 index 0000000000..d5c38e003b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/close.c @@ -0,0 +1,25 @@ +/* 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 "imp.h" +#include "imPcodes.h" + +closepl(){ + putch(imP_ENDPAGE); + fflush(stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/cont.c b/usr/src/ucbcmd/plot/libplot/imagen/cont.c new file mode 100644 index 0000000000..f1d0c783d1 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/cont.c @@ -0,0 +1,25 @@ +/* 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> +#include "imp.h" + +cont(x,y){ + line(imPx, imPy, x, y); + +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/dot.c b/usr/src/ucbcmd/plot/libplot/imagen/dot.c new file mode 100644 index 0000000000..a9cf01dd0a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/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/imagen/erase.c b/usr/src/ucbcmd/plot/libplot/imagen/erase.c new file mode 100644 index 0000000000..7e6403fe48 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/erase.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. + */ + + +#include "imPcodes.h" +#include "imp.h" +erase(){ + int i; + putch(imP_ENDPAGE); + imPx = imPy = 0; + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/imPcodes.h b/usr/src/ucbcmd/plot/libplot/imagen/imPcodes.h new file mode 100644 index 0000000000..ad67875602 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/imPcodes.h @@ -0,0 +1,67 @@ +/* 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) 1985 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#define imP_SP 128 +#define imP_SP1 129 +#define imP_OLD_MMOVE 130 +#define imP_MPLUS 131 +#define imP_MMINUS 132 +#define imP_MMOVE 133 +#define imP_SMOVE 134 + +#define imP_SET_ABS_H 135 +#define imP_SET_REL_H 136 +#define imP_SET_ABS_V 137 +#define imP_SET_REL_V 138 + +#define imP_SRULE 192 +#define imP_BRULE 193 + +#define imP_SET_HPOS 195 +#define imP_SET_VPOS 196 +#define imP_CRLF 197 +#define imP_SGLY 198 +#define imP_BGLY 199 +#define imP_DELG 200 +#define imP_DELC 201 +#define imP_DELF 202 + +#define imP_SET_HV_SYSTEM 205 +#define imP_SET_ADV_DIRS 206 +#define imP_SET_FAMILY 207 +#define imP_SET_IL 208 +#define imP_SET_BOL 209 +#define imP_SET_SP 210 +#define imP_PUSH 211 +#define imP_POP 212 +#define imP_PAGE 213 +#define imP_SET_PUSH_MASK 214 +#define imP_ENDPAGE 219 + +#define imP_CREATE_FAMILY_TABLE 221 +#define imP_CREATE_MAP 222 + +#define imP_CREATE_PATH 230 +#define imP_SET_TEXTURE 231 +#define imP_SET_PEN 232 +#define imP_FILL_PATH 233 +#define imP_DRAW_PATH 234 +#define imP_BITMAP 235 +#define imP_SET_MAGN 236 + +#define imP_EOF 255 + diff --git a/usr/src/ucbcmd/plot/libplot/imagen/imp.h b/usr/src/ucbcmd/plot/libplot/imagen/imp.h new file mode 100644 index 0000000000..af8a814dba --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/imp.h @@ -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) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. + * All Rights Reserved. + */ + +/* + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#include <stdio.h> +extern float obotx; +extern float boty; +extern float botx; +extern float oboty; +extern float scalex; +extern float scaley; +int imPx, imPy; +extern int imPcsize; +extern char *imP_charset; diff --git a/usr/src/ucbcmd/plot/libplot/imagen/label.c b/usr/src/ucbcmd/plot/libplot/imagen/label.c new file mode 100644 index 0000000000..a25b4711ae --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/label.c @@ -0,0 +1,35 @@ +/* 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 "imPcodes.h" +#include "imp.h" +extern imPcsize; +label(s) +char *s; +{ + register i,c; + putch(imP_SET_ABS_H); + putwd((int)((imPx-obotx)*scalex+botx)-imPcsize/2); + putch(imP_SET_ABS_V); + putwd((int)((imPy-oboty)*scaley+boty-(imPcsize/1.6))); + for(i=0; c=s[i]; i++) + { + imPx += imPcsize/scalex; + putch((c == ' ')?imP_SP:c); + } +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/line.c b/usr/src/ucbcmd/plot/libplot/imagen/line.c new file mode 100644 index 0000000000..0a90fa6a57 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/line.c @@ -0,0 +1,48 @@ +/* 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 "imp.h" +#include "imPcodes.h" +float obotx = 0.; +float oboty = 0.; +float botx = 2.; +float boty = 2.; +float scalex = 1.; +float scaley = 1.; +line(x0,y0,x1,y1) +{ + putch(imP_CREATE_PATH); + putwd(2); /* two coordinates follow */ + putwd((int)((x0-obotx)*scalex+botx)); + putwd((int)((y0-oboty)*scaley+boty)); + putwd((int)((x1-obotx)*scalex+botx)); + putwd((int)((y1-oboty)*scaley+boty)); + putch(imP_DRAW_PATH); + putch(15); /* "black" lines */ + imPx = x1; + imPy = y1; +} +putch(c) +{ + putc(c, stdout); +} +putwd(w) +{ + putch(w>>8); + putch(w); +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/linemod.c b/usr/src/ucbcmd/plot/libplot/imagen/linemod.c new file mode 100644 index 0000000000..9ba7b31ef9 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/linemod.c @@ -0,0 +1,50 @@ +/* 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 "imp.h" + +/* + * Hack to set font. + */ +linemod(s) +char *s; +{ + register char *tit; + register char *nam; + int siz = 0; + nam = s; + for(tit = "charset="; *tit; ) + if (*tit++ != *nam++) + return; + s = nam; + while(*nam) + switch(*nam++) { + case ',': + case '\n': + *--nam = 0; + } + siz = atoi(++nam); + if (siz == 0) { + while (*--nam >= '0' && *nam <= '9') + ; + siz = (atoi(++nam)*4)/3; + } + if (siz == 0) + siz = imPcsize; + setfont(s, siz); +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/move.c b/usr/src/ucbcmd/plot/libplot/imagen/move.c new file mode 100644 index 0000000000..ea954ebd18 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/move.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. + */ + + +#include "imp.h" +move(xi,yi){ + imPx = xi; + imPy = yi; +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/open.c b/usr/src/ucbcmd/plot/libplot/imagen/open.c new file mode 100644 index 0000000000..4f51b9636c --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/open.c @@ -0,0 +1,49 @@ +/* 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 "imPcodes.h" +#include "imp.h" + +openpl(){ + + putch(imP_SET_HV_SYSTEM); + putch((3<<3)|5); + putch(imP_SET_FAMILY); + putch(2); + setfont(imP_charset,imPcsize); + putch(imP_SET_IL); + putwd(imPcsize+3); + putch(imP_SET_SP); + putwd(imPcsize); + putch(imP_SET_PEN); + putch(2); + putch(imP_SET_ABS_H); + putwd(0); + putch(imP_SET_ABS_V); + putwd(0); +} +setfont(c, sz) char *c; int sz; +{ + imPcsize = sz; + putch(imP_CREATE_FAMILY_TABLE); + putch(2); + putch(1); + putch(0); + fprintf(stdout, c); + putch(0); +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/point.c b/usr/src/ucbcmd/plot/libplot/imagen/point.c new file mode 100644 index 0000000000..21e7bde131 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/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) 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. + */ + + +point(xi,yi){ + line(xi,yi,xi,yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/scale.c b/usr/src/ucbcmd/plot/libplot/imagen/scale.c new file mode 100644 index 0000000000..5311f551fe --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/scale.c @@ -0,0 +1,40 @@ +/* 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 float scalex; +extern float scaley; +extern int scaleflag; +scale(i,x,y) +char i; +float x,y; +{ + switch(i) { + default: + return; + case 'c': + x *= 2.54; + y *= 2.54; + case 'i': + x /= 200; + y /= 200; + case 'u': + scalex = 1/x; + scaley = 1/y; + } + scaleflag = 1; +} diff --git a/usr/src/ucbcmd/plot/libplot/imagen/space.c b/usr/src/ucbcmd/plot/libplot/imagen/space.c new file mode 100644 index 0000000000..cf600c906a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/imagen/space.c @@ -0,0 +1,38 @@ +/* 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 float botx; +extern float boty; +extern float obotx; +extern float oboty; +extern float scalex; +extern float scaley; + +int PlotRes = DEFRES; + +int scaleflag; +space(x0,y0,x1,y1){ + botx = 2.; + boty = 2.; + obotx = x0; + oboty = y0; + if(scaleflag) + return; + scalex = (8.0 * PlotRes)/(x1-x0); + scaley = (8.0 * PlotRes)/(y1-y0); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/Makefile b/usr/src/ucbcmd/plot/libplot/plot/Makefile new file mode 100644 index 0000000000..50ee27fc43 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/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= ../libplot.a + +OBJECTS = arc.o box.o circle.o close.o cont.o dot.o erase.o label.o \ + line.o linmod.o move.o open.o point.o putsi.o space.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/plot/arc.c b/usr/src/ucbcmd/plot/libplot/plot/arc.c new file mode 100644 index 0000000000..91ef25c467 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/arc.c @@ -0,0 +1,28 @@ +/* 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> +arc(xi,yi,x0,y0,x1,y1){ + putc('a',stdout); + putsi(xi); + putsi(yi); + putsi(x0); + putsi(y0); + putsi(x1); + putsi(y1); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/box.c b/usr/src/ucbcmd/plot/libplot/plot/box.c new file mode 100644 index 0000000000..ce721eefec --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/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/plot/circle.c b/usr/src/ucbcmd/plot/libplot/plot/circle.c new file mode 100644 index 0000000000..f32522b9c8 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/circle.c @@ -0,0 +1,25 @@ +/* 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> +circle(x,y,r){ + putc('c',stdout); + putsi(x); + putsi(y); + putsi(r); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/close.c b/usr/src/ucbcmd/plot/libplot/plot/close.c new file mode 100644 index 0000000000..fd34f94b2b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/close.c @@ -0,0 +1,25 @@ +/* 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(){ + fflush(stdout); +} +closepl(){ + fflush(stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/cont.c b/usr/src/ucbcmd/plot/libplot/plot/cont.c new file mode 100644 index 0000000000..970e6d5803 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/cont.c @@ -0,0 +1,24 @@ +/* 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> +cont(xi,yi){ + putc('n',stdout); + putsi(xi); + putsi(yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/dot.c b/usr/src/ucbcmd/plot/libplot/plot/dot.c new file mode 100644 index 0000000000..8fb1610972 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/dot.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. + */ + + +#include <stdio.h> +dot(xi,yi,dx,n,pat) +int pat[]; +{ + int i; + putc('d',stdout); + putsi(xi); + putsi(yi); + putsi(dx); + putsi(n); + for(i=0; i<n; i++)putsi(pat[i]); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/erase.c b/usr/src/ucbcmd/plot/libplot/plot/erase.c new file mode 100644 index 0000000000..059fe9aae1 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/erase.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. + */ + + +#include <stdio.h> +erase(){ + putc('e',stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/label.c b/usr/src/ucbcmd/plot/libplot/plot/label.c new file mode 100644 index 0000000000..cd345bf74d --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/label.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> +label(s) +char *s; +{ + int i; + putc('t',stdout); + for(i=0;s[i];)putc(s[i++],stdout); + putc('\n',stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/line.c b/usr/src/ucbcmd/plot/libplot/plot/line.c new file mode 100644 index 0000000000..7885631956 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/line.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. + */ + + +#include <stdio.h> +line(x0,y0,x1,y1){ + putc('l',stdout); + putsi(x0); + putsi(y0); + putsi(x1); + putsi(y1); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/linmod.c b/usr/src/ucbcmd/plot/libplot/plot/linmod.c new file mode 100644 index 0000000000..e5906e292e --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/linmod.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> +linemod(s) +char *s; +{ + int i; + putc('f',stdout); + for(i=0;s[i];)putc(s[i++],stdout); + putc('\n',stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/move.c b/usr/src/ucbcmd/plot/libplot/plot/move.c new file mode 100644 index 0000000000..06f3456f4d --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/move.c @@ -0,0 +1,24 @@ +/* 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> +move(xi,yi){ + putc('m',stdout); + putsi(xi); + putsi(yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/open.c b/usr/src/ucbcmd/plot/libplot/plot/open.c new file mode 100644 index 0000000000..fbfa68f015 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/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) 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. + */ + + +openvt(){ +} +openpl(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/point.c b/usr/src/ucbcmd/plot/libplot/plot/point.c new file mode 100644 index 0000000000..2d515b7f25 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/point.c @@ -0,0 +1,24 @@ +/* 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> +point(xi,yi){ + putc('p',stdout); + putsi(xi); + putsi(yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/putsi.c b/usr/src/ucbcmd/plot/libplot/plot/putsi.c new file mode 100644 index 0000000000..04364105ab --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/putsi.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. + */ + + +#include <stdio.h> +putsi(a){ + putc((char)a,stdout); + putc((char)(a>>8),stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/plot/space.c b/usr/src/ucbcmd/plot/libplot/plot/space.c new file mode 100644 index 0000000000..ca4f8693e9 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/plot/space.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. + */ + + +#include <stdio.h> +space(x0,y0,x1,y1){ + putc('s',stdout); + putsi(x0); + putsi(y0); + putsi(x1); + putsi(y1); +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/Makefile b/usr/src/ucbcmd/plot/libplot/t300/Makefile new file mode 100644 index 0000000000..47acf8ffe0 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/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= ../libt300.a + +OBJECTS = arc.o box.o circle.o close.o dot.o erase.o label.o \ + line.o linmod.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/t300/arc.c b/usr/src/ucbcmd/plot/libplot/t300/arc.c new file mode 100644 index 0000000000..a4d5e23fde --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/arc.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. + */ + + +arc(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/box.c b/usr/src/ucbcmd/plot/libplot/t300/box.c new file mode 100644 index 0000000000..ce721eefec --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/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/t300/circle.c b/usr/src/ucbcmd/plot/libplot/t300/circle.c new file mode 100644 index 0000000000..bb9a06ff21 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/circle.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. + */ + + +circle(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/close.c b/usr/src/ucbcmd/plot/libplot/t300/close.c new file mode 100644 index 0000000000..cfbbcbf520 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/close.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. + */ + + +#include <stdio.h> +closevt(){ + closepl(); +} +closepl(){ + fflush(stdout); + reset(); +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/con.h b/usr/src/ucbcmd/plot/libplot/t300/con.h new file mode 100644 index 0000000000..0476248c6f --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/con.h @@ -0,0 +1,37 @@ +/* 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. + */ + +#include <sgtty.h> +/* gsi plotting output routines */ +# define DOWN 012 +# define UP 013 +# define LEFT 010 +# define RIGHT 040 +# define BEL 007 +# define ESC 033 +# define ACK 006 +# define CR 015 +# define FF 014 +# define VERTRESP 48 +# define HORZRESP 60. +# define VERTRES 8. +# define HORZRES 6. +/* down is line feed, up is reverse line feed, + left is backspace, right is space. 48 points per inch + vertically, 60 horizontally */ + +extern int xnow, ynow; +extern int OUTF; +extern struct sgttyb ITTY, PTTY; +extern float HEIGHT, WIDTH, OFFSET; +extern int xscale, xoffset, yscale; +extern float botx, boty, obotx, oboty, scalex,scaley; + diff --git a/usr/src/ucbcmd/plot/libplot/t300/dot.c b/usr/src/ucbcmd/plot/libplot/t300/dot.c new file mode 100644 index 0000000000..a9cf01dd0a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/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/t300/erase.c b/usr/src/ucbcmd/plot/libplot/t300/erase.c new file mode 100644 index 0000000000..44fbab553e --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/erase.c @@ -0,0 +1,25 @@ +/* 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 "con.h" +erase(){ + int i; + for(i=0; i<11*(VERTRESP/VERTRES); i++) + spew(DOWN); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/label.c b/usr/src/ucbcmd/plot/libplot/t300/label.c new file mode 100644 index 0000000000..4bd61984a6 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/label.c @@ -0,0 +1,29 @@ +/* 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 "con.h" +label(s) +char *s; +{ + int i,c; + while((c = *s++) != '\0'){ + xnow += 6; + spew(c); + } + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/line.c b/usr/src/ucbcmd/plot/libplot/t300/line.c new file mode 100644 index 0000000000..9cca61858e --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/line.c @@ -0,0 +1,63 @@ +/* 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 "con.h" +line(x0,y0,x1,y1){ + iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1))); + return; +} +cont(x0,y0){ + iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0))); + return; +} +iline(cx0,cy0,cx1,cy1){ + int maxp,tt,j,np; + char chx,chy; + float xd,yd; + float dist2(),sqrt(); + movep(cx0,cy0); + maxp = sqrt(dist2(cx0,cy0,cx1,cy1))/2.; + xd = cx1-cx0; + yd = cy1-cy0; + if(xd >= 0)chx = RIGHT; + else chx = LEFT; + if(yd >= 0)chy = UP; + else chy = DOWN; + if(maxp==0){ + xd=0; + yd=0; + } + else{ + xd /= maxp; + yd /= maxp; + } + inplot(); + for (tt=0; tt<=maxp; tt++){ + j= cx0+xd*tt-xnow; + xnow += j; + j = abval(j); + while(j-- > 0)spew(chx); + j = cy0+yd*tt-ynow; + ynow += j; + j = abval(j); + while(j-- > 0)spew(chy); + spew ('.'); + } + outplot(); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/linmod.c b/usr/src/ucbcmd/plot/libplot/t300/linmod.c new file mode 100644 index 0000000000..46a98ef7ff --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/linmod.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. + */ + + +linemod(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/move.c b/usr/src/ucbcmd/plot/libplot/t300/move.c new file mode 100644 index 0000000000..0c67496c4c --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/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){ + movep(xconv(xsc(xi)),yconv(ysc(yi))); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/open.c b/usr/src/ucbcmd/plot/libplot/t300/open.c new file mode 100644 index 0000000000..ce326d4dea --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/open.c @@ -0,0 +1,65 @@ +/* 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 <sgtty.h> +/* gsi plotting output routines */ +# define DOWN 012 +# define UP 013 +# define LEFT 010 +# define RIGHT 040 +# define BEL 007 +# define ACK 006 +# define CR 015 +# define FF 014 +# define VERTRESP 48 +# define HORZRESP 60. +# define HORZRES 6. +# define VERTRES 8. +/* down is line feed, up is reverse oyne feed, + left is bwckspace, right is space. 48 points per inch + vertically, 60 horizontally */ + +int xnow, ynow; +int OUTF; +struct sgttyb ITTY, PTTY; +float HEIGHT = 6.0, WIDTH = 6.0, OFFSET = 0.0; +int xscale, xoffset, yscale; +float botx = 0., boty = 0., obotx = 0., oboty = 0.; +float scalex = 1., scaley = 1.; + +openpl () +{ + int reset(); + xnow = ynow = 0; + OUTF = 1; + printf("\r"); + gtty(OUTF, &ITTY); + signal (2, reset); + PTTY = ITTY; + PTTY.sg_flags &= ~CRMOD; /* don't map lf */ + /* initialize constants */ + xscale = 4096./(HORZRESP * WIDTH); + yscale = 4096 /(VERTRESP * HEIGHT); + xoffset = OFFSET * HORZRESP; + return; +} + +openvt(){ +openpl(); +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/point.c b/usr/src/ucbcmd/plot/libplot/t300/point.c new file mode 100644 index 0000000000..f0d9baab1b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/point.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. + */ + + +point(xi,yi){ + move(xi,yi); + label("."); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/space.c b/usr/src/ucbcmd/plot/libplot/t300/space.c new file mode 100644 index 0000000000..d8df66c6ce --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/space.c @@ -0,0 +1,29 @@ +/* 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 "con.h" +float deltx = 4095.; +float delty = 4095.; +space(x0,y0,x1,y1){ + botx = -2047.; + boty = -2047.; + obotx = x0; + oboty = y0; + scalex = deltx/(x1-x0); + scaley = delty/(y1-y0); +} diff --git a/usr/src/ucbcmd/plot/libplot/t300/subr.c b/usr/src/ucbcmd/plot/libplot/t300/subr.c new file mode 100644 index 0000000000..27b5591d8b --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300/subr.c @@ -0,0 +1,130 @@ +/* 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> +#include "con.h" +abval(q) +{ + return (q>=0 ? q : -q); +} + +xconv (xp) +{ + /* x position input is -2047 to +2047, output must be 0 to PAGSIZ*HORZRES */ + xp += 2048; + /* the computation is newx = xp*(PAGSIZ*HORZRES)/4096 */ + return (xoffset + xp /xscale); +} + +yconv (yp) +{ + /* see description of xconv */ + yp += 2048; + return (yp / yscale); +} + +inplot() +{ + stty(OUTF, &PTTY); + spew (ACK); +} + +outplot() +{ + spew(ESC); + spew(ACK); + fflush(stdout); + stty(OUTF, &ITTY); +} + +spew(ch) +{ + if(ch == UP)putc(ESC,stdout); + putc(ch, stdout); +} + +tobotleft () +{ + move(-2048,-2048); +} +reset() +{ + outplot(); + exit(0); +} + +float +dist2 (x1, y1, x2, y2) +{ + float t,v; + t = x2-x1; + v = y1-y2; + return (t*t+v*v); +} + +swap (pa, pb) +int *pa, *pb; +{ + int t; + t = *pa; + *pa = *pb; + *pb = t; +} +movep (xg, yg) +{ + int i,ch; + if((xg == xnow) && (yg == ynow))return; + /* if we need to go to left margin, just CR */ + if (xg < xnow/2) + { + spew(CR); + xnow = 0; + } + i = (xg-xnow)/HORZRES; + if(xnow < xg)ch = RIGHT; + else ch = LEFT; + xnow += i*HORZRES; + i = abval(i); + while(i--)spew(ch); + i = abval(xg-xnow); + inplot(); + while(i--) spew(ch); + outplot(); + i=(yg-ynow)/VERTRES; + if(ynow < yg)ch = UP; + else ch = DOWN; + ynow += i*VERTRES; + i = abval(i); + while(i--)spew(ch); + i=abval(yg-ynow); + inplot(); + while(i--)spew(ch); + outplot(); + xnow = xg; ynow = yg; +} + +xsc(xi){ + int xa; + xa = (xi - obotx) * scalex + botx; + return(xa); +} +ysc(yi){ + int ya; + ya = (yi - oboty) *scaley +boty; + return(ya); +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/Makefile b/usr/src/ucbcmd/plot/libplot/t300s/Makefile new file mode 100644 index 0000000000..d7eaf02d04 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/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= ../libt300s.a + +OBJECTS = arc.o box.o circle.o close.o dot.o erase.o label.o \ + line.o linmod.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/t300s/arc.c b/usr/src/ucbcmd/plot/libplot/t300s/arc.c new file mode 100644 index 0000000000..a4d5e23fde --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/arc.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. + */ + + +arc(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/box.c b/usr/src/ucbcmd/plot/libplot/t300s/box.c new file mode 100644 index 0000000000..fe42272269 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/box.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. + */ + +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/t300s/circle.c b/usr/src/ucbcmd/plot/libplot/t300s/circle.c new file mode 100644 index 0000000000..bb9a06ff21 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/circle.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. + */ + + +circle(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/close.c b/usr/src/ucbcmd/plot/libplot/t300s/close.c new file mode 100644 index 0000000000..cfbbcbf520 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/close.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. + */ + + +#include <stdio.h> +closevt(){ + closepl(); +} +closepl(){ + fflush(stdout); + reset(); +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/con.h b/usr/src/ucbcmd/plot/libplot/t300s/con.h new file mode 100644 index 0000000000..75ed00c49e --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/con.h @@ -0,0 +1,46 @@ +/* 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. + */ + +# +#include <sgtty.h> +/* gsi plotting output routines */ +# define DOUBLE 010 +#define ADDR 0100 +#define COM 060 +#define PENUP 04 +#define MAXX 070 +#define MAXY 07 +#define SPACES 7 +# define DOWN 012 +# define UP 013 +# define LEFT 010 +# define RIGHT 040 +# define BEL 007 +# define ESC 033 +# define ACK 006 +# define INPLOT 'P' +# define CR 015 +# define FF 014 +# define VERTRESP 48 +# define HORZRESP 60. +# define VERTRES 8. +# define HORZRES 6. +/* down is line feed, up is reverse line feed, + left is backspace, right is space. 48 points per inch + vertically, 60 horizontally */ + +extern int xnow, ynow; +extern int OUTF; +extern struct sgttyb ITTY, PTTY; +extern float HEIGHT, WIDTH, OFFSET; +extern int xscale, xoffset, yscale; +extern float botx, boty, obotx, oboty, scalex,scaley; + diff --git a/usr/src/ucbcmd/plot/libplot/t300s/dot.c b/usr/src/ucbcmd/plot/libplot/t300s/dot.c new file mode 100644 index 0000000000..a9cf01dd0a --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/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/t300s/erase.c b/usr/src/ucbcmd/plot/libplot/t300s/erase.c new file mode 100644 index 0000000000..44fbab553e --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/erase.c @@ -0,0 +1,25 @@ +/* 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 "con.h" +erase(){ + int i; + for(i=0; i<11*(VERTRESP/VERTRES); i++) + spew(DOWN); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/label.c b/usr/src/ucbcmd/plot/libplot/t300s/label.c new file mode 100644 index 0000000000..325e4c06dd --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/label.c @@ -0,0 +1,29 @@ +/* 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 "con.h" +label(s) +char *s; +{ + int i,c; + while((c = *s++) != '\0'){ + xnow += HORZRES; + spew(c); + } + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/line.c b/usr/src/ucbcmd/plot/libplot/t300s/line.c new file mode 100644 index 0000000000..5a6179c3aa --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/line.c @@ -0,0 +1,59 @@ +/* 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 "con.h" +line(x0,y0,x1,y1){ + iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1))); + return; +} +cont(x0,y0){ + iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0))); + return; +} +iline(cx0,cy0,cx1,cy1){ + int maxp,tt,j,np; + char chx,chy,command; + float xd,yd; + float dist2(),sqrt(); + movep(cx0,cy0); + maxp = sqrt(dist2(cx0,cy0,cx1,cy1))/2.; + xd = cx1-cx0; + yd = cy1-cy0; + command = COM|((xd<0)<<1)|(yd<0); + if(maxp == 0){ + xd=0; + yd=0; + } + else { + xd /= maxp; + yd /= maxp; + } + inplot(); + spew(command); + for (tt=0; tt<=maxp; tt++){ + chx= cx0+xd*tt-xnow; + xnow += chx; + chx = abval(chx); + chy = cy0+yd*tt-ynow; + ynow += chy; + chy = abval(chy); + spew(ADDR|chx<<3|chy); + } + outplot(); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/linmod.c b/usr/src/ucbcmd/plot/libplot/t300s/linmod.c new file mode 100644 index 0000000000..46a98ef7ff --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/linmod.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. + */ + + +linemod(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/move.c b/usr/src/ucbcmd/plot/libplot/t300s/move.c new file mode 100644 index 0000000000..0c67496c4c --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/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){ + movep(xconv(xsc(xi)),yconv(ysc(yi))); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/open.c b/usr/src/ucbcmd/plot/libplot/t300s/open.c new file mode 100644 index 0000000000..ce326d4dea --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/open.c @@ -0,0 +1,65 @@ +/* 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 <sgtty.h> +/* gsi plotting output routines */ +# define DOWN 012 +# define UP 013 +# define LEFT 010 +# define RIGHT 040 +# define BEL 007 +# define ACK 006 +# define CR 015 +# define FF 014 +# define VERTRESP 48 +# define HORZRESP 60. +# define HORZRES 6. +# define VERTRES 8. +/* down is line feed, up is reverse oyne feed, + left is bwckspace, right is space. 48 points per inch + vertically, 60 horizontally */ + +int xnow, ynow; +int OUTF; +struct sgttyb ITTY, PTTY; +float HEIGHT = 6.0, WIDTH = 6.0, OFFSET = 0.0; +int xscale, xoffset, yscale; +float botx = 0., boty = 0., obotx = 0., oboty = 0.; +float scalex = 1., scaley = 1.; + +openpl () +{ + int reset(); + xnow = ynow = 0; + OUTF = 1; + printf("\r"); + gtty(OUTF, &ITTY); + signal (2, reset); + PTTY = ITTY; + PTTY.sg_flags &= ~CRMOD; /* don't map lf */ + /* initialize constants */ + xscale = 4096./(HORZRESP * WIDTH); + yscale = 4096 /(VERTRESP * HEIGHT); + xoffset = OFFSET * HORZRESP; + return; +} + +openvt(){ +openpl(); +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/point.c b/usr/src/ucbcmd/plot/libplot/t300s/point.c new file mode 100644 index 0000000000..65188fd162 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/point.c @@ -0,0 +1,24 @@ +/* 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 "con.h" +point(xi,yi){ + move(xi,yi); + label("."); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/space.c b/usr/src/ucbcmd/plot/libplot/t300s/space.c new file mode 100644 index 0000000000..78c1836578 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/space.c @@ -0,0 +1,28 @@ +/* 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 "con.h" +float deltx = 4095.; +float delty = 4095.; +space(x0,y0,x1,y1){ + botx = -2047.; + boty = -2047.; + obotx = x0; + oboty = y0; + scalex = deltx/(x1-x0); + scaley = delty/(y1-y0); +} diff --git a/usr/src/ucbcmd/plot/libplot/t300s/subr.c b/usr/src/ucbcmd/plot/libplot/t300s/subr.c new file mode 100644 index 0000000000..2d54112f1c --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t300s/subr.c @@ -0,0 +1,174 @@ +/* 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> +#include "con.h" +abval(q) +{ + return (q>=0 ? q : -q); +} + +xconv (xp) +{ + /* x position input is -2047 to +2047, output must be 0 to PAGSIZ*HORZRES */ + xp += 2048; + /* the computation is newx = xp*(PAGSIZ*HORZRES)/4096 */ + return (xoffset + xp /xscale); +} + +yconv (yp) +{ + /* see description of xconv */ + yp += 2048; + return (yp / yscale); +} + +inplot() +{ + stty(OUTF, &PTTY); + spew(ESC); + spew (INPLOT); +} + +outplot() +{ + spew(ESC); + spew(ACK); + spew(ESC); + spew(ACK); + fflush(stdout); + stty (OUTF, &ITTY); +} + +spew(ch) +{ + putc(ch, stdout); +} + +tobotleft () +{ + move(-2048,-2048); +} +reset() +{ + outplot(); + exit(0); +} + +float +dist2 (x1, y1, x2, y2) +{ + float t,v; + t = x2-x1; + v = y1-y2; + return (t*t+v*v); +} + +swap (pa, pb) +int *pa, *pb; +{ + int t; + t = *pa; + *pa = *pb; + *pb = t; +} + +#define DOUBLE 010 +#define ADDR 0100 +#define COM 060 +#define MAXX 070 +#define MAXY 07 +extern xnow,ynow; +#define SPACES 7 +movep(ix,iy){ + int dx,dy,remx,remy,pts,i; + int xd,yd; + int addr,command; + char c; + if(xnow == ix && ynow == iy)return; + inplot(); + dx = ix-xnow; + dy = iy-ynow; + command = COM|PENUP|((dx<0)<<1)|(dy<0); + dx = abval(dx); + dy = abval(dy); + xd = dx/(SPACES*2); + yd = dy/(SPACES*2); + pts = xd<yd?xd:yd; + if((i=pts)>0){ + c=command|DOUBLE; + addr=ADDR; + if(xd>0)addr|=MAXX; + if(yd>0)addr|=MAXY; + spew(c); + while(i--){ + spew(addr); + } + } + if(xd!=yd){ + if(xd>pts){ + i=xd-pts; + addr=ADDR|MAXX; + } + else{ + i=yd-pts; + addr=ADDR|MAXY; + } + c=command|DOUBLE; + spew(c); + while(i--){ + spew(addr); + } + } + remx=dx-xd*SPACES*2; + remy=dy-yd*SPACES*2; + addr=ADDR; + i = 0; + if(remx>7){ + i=1; + addr|=MAXX; + remx -= 7; + } + if(remy>7){ + i=1; + addr|=MAXY; + remy -= 7; + } + while(i--){ + spew(command); + spew(addr); + } + if(remx>0||remy>0){ + spew(command); + spew(ADDR|remx<<3|remy); + } + xnow=ix; + ynow=iy; + outplot(); + return; +} +xsc(xi){ + int xa; + xa = (xi - obotx) * scalex + botx; + return(xa); +} +ysc(yi){ + int ya; + ya = (yi - oboty) *scaley +boty; + return(ya); +} 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); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/Makefile b/usr/src/ucbcmd/plot/libplot/t4014/Makefile new file mode 100644 index 0000000000..ad24feb0b4 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/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= ../libt4014.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/t4014/arc.c b/usr/src/ucbcmd/plot/libplot/t4014/arc.c new file mode 100644 index 0000000000..a5ceb326d7 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/arc.c @@ -0,0 +1,141 @@ +/* + * 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 (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. + */ + +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 = sqrt(pc); + 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*sqrt(pc)+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*sqrt(pc)+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); +} +abs(a){ + if(a < 0)return(-a); + return(a); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/box.c b/usr/src/ucbcmd/plot/libplot/t4014/box.c new file mode 100644 index 0000000000..190476f237 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/box.c @@ -0,0 +1,41 @@ +/* + * 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 (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. + */ + +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/t4014/circle.c b/usr/src/ucbcmd/plot/libplot/t4014/circle.c new file mode 100644 index 0000000000..78e902fc43 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/circle.c @@ -0,0 +1,35 @@ +/* + * 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 (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. + */ + +circle(x,y,r){ + arc(x,y,x+r,y,x+r,y); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/close.c b/usr/src/ucbcmd/plot/libplot/t4014/close.c new file mode 100644 index 0000000000..4ae674b853 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/close.c @@ -0,0 +1,41 @@ +/* + * 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 (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. + */ + +#include <stdio.h> +closevt(){ + putch(037); + fflush(stdout); +} +closepl(){ + putch(037); + fflush(stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/dot.c b/usr/src/ucbcmd/plot/libplot/t4014/dot.c new file mode 100644 index 0000000000..06dde59777 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/dot.c @@ -0,0 +1,34 @@ +/* + * 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 (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. + */ + +dot(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/erase.c b/usr/src/ucbcmd/plot/libplot/t4014/erase.c new file mode 100644 index 0000000000..dabf6915e6 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/erase.c @@ -0,0 +1,47 @@ +/* + * 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 (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. + */ + +extern int ohiy; +extern int ohix; +extern int oloy; +extern int oextra; +erase(){ + int i; + putch(033); + putch(014); + ohiy= -1; + ohix = -1; + oextra = -1; + oloy = -1; + sleep(2); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/label.c b/usr/src/ucbcmd/plot/libplot/t4014/label.c new file mode 100644 index 0000000000..5534beb542 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/label.c @@ -0,0 +1,60 @@ +/* + * 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 (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. + */ + +#define N 0104 +#define E 0101 +#define NE 0105 +#define S 0110 +#define W 0102 +#define SW 0112 +/* arrange by incremental plotting that an initial + * character such as +, X, *, etc will fall + * right on the point, and undo it so that further + * labels will fall properly in place + */ +char lbl_mv[] = { + 036,040,S,S,S,S,S,S,SW,SW,SW,SW,SW,SW,SW,SW,SW,SW,037,0 +}; +char lbl_umv[] = { + 036,040,N,N,N,N,N,N,NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,037,0 +}; +label(s) +char *s; +{ + register i,c; + for(i=0; c=lbl_mv[i]; i++) + putch(c); + for(i=0; c=s[i]; i++) + putch(c); + for(i=0; c=lbl_umv[i]; i++) + putch(c); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/line.c b/usr/src/ucbcmd/plot/libplot/t4014/line.c new file mode 100644 index 0000000000..eed81a69b3 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/line.c @@ -0,0 +1,36 @@ +/* + * 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 (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. + */ + +line(x0,y0,x1,y1){ + move(x0,y0); + cont(x1,y1); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/linemod.c b/usr/src/ucbcmd/plot/libplot/t4014/linemod.c new file mode 100644 index 0000000000..c1b0fcca89 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/linemod.c @@ -0,0 +1,51 @@ +/* + * 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 (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. + */ + +linemod(s) +char *s; +{ + char c; + putch(033); + switch(s[0]){ + case 'l': + c = 'd'; + break; + case 'd': + if(s[3] != 'd')c='a'; + else c='b'; + break; + case 's': + if(s[5] != '\0')c='c'; + else c='`'; + } + putch(c); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/move.c b/usr/src/ucbcmd/plot/libplot/t4014/move.c new file mode 100644 index 0000000000..a9213ff592 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/move.c @@ -0,0 +1,36 @@ +/* + * 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 (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. + */ + +move(xi,yi){ + putch(035); + cont(xi,yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/open.c b/usr/src/ucbcmd/plot/libplot/t4014/open.c new file mode 100644 index 0000000000..3e8d5db7e9 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/open.c @@ -0,0 +1,37 @@ +/* + * 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 (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. + */ + +openvt () +{ +} +openpl(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/point.c b/usr/src/ucbcmd/plot/libplot/t4014/point.c new file mode 100644 index 0000000000..fd0d3df99e --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/point.c @@ -0,0 +1,36 @@ +/* + * 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 (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. + */ + +point(xi,yi){ + move(xi,yi); + cont(xi,yi); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/space.c b/usr/src/ucbcmd/plot/libplot/t4014/space.c new file mode 100644 index 0000000000..812e3e5708 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/space.c @@ -0,0 +1,49 @@ +/* + * 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 (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. + */ + +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 = 3120./(x1-x0); + scaley = 3120./(y1-y0); +} diff --git a/usr/src/ucbcmd/plot/libplot/t4014/subr.c b/usr/src/ucbcmd/plot/libplot/t4014/subr.c new file mode 100644 index 0000000000..d5782701f4 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t4014/subr.c @@ -0,0 +1,90 @@ +/* + * 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 (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. + */ + +#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; +int oextra = -1; +cont(x,y){ + int hix,hiy,lox,loy,extra; + int n; + x = (x-obotx)*scalex + botx; + y = (y-oboty)*scaley + boty; + hix=(x>>7) & 037; + hiy=(y>>7) & 037; + lox = (x>>2)&037; + loy=(y>>2)&037; + extra=(x & 03) | ((y & 03) << 2); + n = (abs(hix-ohix) + abs(hiy-ohiy) + 6) / 12; + if(hiy != ohiy){ + putch(hiy|040); + ohiy=hiy; + } + if(hix != ohix){ + if(extra != oextra){ + putch(extra|0140); + oextra=extra; + } + putch(loy|0140); + putch(hix|040); + ohix=hix; + oloy=loy; + } + else{ + if(extra != oextra){ + putch(extra|0140); + putch(loy|0140); + oextra=extra; + oloy=loy; + } + else if(loy != oloy){ + putch(loy|0140); + oloy=loy; + } + } + putch(lox|0100); + while(n--) + putch(0); +} + +putch(c){ + putc(c,stdout); +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/Makefile b/usr/src/ucbcmd/plot/libplot/t450/Makefile new file mode 100644 index 0000000000..070b869669 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/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= ../libt450.a + +OBJECTS = arc.o box.o circle.o close.o dot.o erase.o label.o \ + line.o linmod.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/t450/arc.c b/usr/src/ucbcmd/plot/libplot/t450/arc.c new file mode 100644 index 0000000000..8be09951b5 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/arc.c @@ -0,0 +1,34 @@ +/* + * 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 (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. + */ + +arc(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/box.c b/usr/src/ucbcmd/plot/libplot/t450/box.c new file mode 100644 index 0000000000..190476f237 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/box.c @@ -0,0 +1,41 @@ +/* + * 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 (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. + */ + +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/t450/circle.c b/usr/src/ucbcmd/plot/libplot/t450/circle.c new file mode 100644 index 0000000000..d29326de64 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/circle.c @@ -0,0 +1,34 @@ +/* + * 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 (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. + */ + +circle(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/close.c b/usr/src/ucbcmd/plot/libplot/t450/close.c new file mode 100644 index 0000000000..ef9737b830 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/close.c @@ -0,0 +1,40 @@ +/* + * 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 (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. + */ + +#include <stdio.h> +closevt(){ + closepl(); +} +closepl(){ + fflush(stdout); + reset(); +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/con.h b/usr/src/ucbcmd/plot/libplot/t450/con.h new file mode 100644 index 0000000000..72506e3942 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/con.h @@ -0,0 +1,60 @@ +/* + * 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 (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. + */ + +#include <sgtty.h> +/* gsi plotting output routines */ +# define DOWN 012 +# define UP 013 +# define LEFT 010 +# define RIGHT 040 +# define BEL 007 +# define ESC 033 +# define ACK 006 +#define PLOTIN 063 +#define PLOTOUT 064 +# define CR 015 +# define FF 014 +# define VERTRESP 48 +# define HORZRESP 60. +# define VERTRES 8. +# define HORZRES 6. +/* down is line feed, up is reverse line feed, + left is backspace, right is space. 48 points per inch + vertically, 60 horizontally */ + +extern int xnow, ynow; +extern int OUTF; +extern struct sgttyb ITTY, PTTY; +extern float HEIGHT, WIDTH, OFFSET; +extern int xscale, xoffset, yscale; +extern float botx, boty, obotx, oboty, scalex,scaley; + diff --git a/usr/src/ucbcmd/plot/libplot/t450/dot.c b/usr/src/ucbcmd/plot/libplot/t450/dot.c new file mode 100644 index 0000000000..06dde59777 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/dot.c @@ -0,0 +1,34 @@ +/* + * 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 (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. + */ + +dot(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/erase.c b/usr/src/ucbcmd/plot/libplot/t450/erase.c new file mode 100644 index 0000000000..969a1d5f63 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/erase.c @@ -0,0 +1,39 @@ +/* + * 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 (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. + */ + +#include "con.h" +erase(){ + int i; + for(i=0; i<11*(VERTRESP/VERTRES); i++) + spew(DOWN); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/label.c b/usr/src/ucbcmd/plot/libplot/t450/label.c new file mode 100644 index 0000000000..0cc08977cc --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/label.c @@ -0,0 +1,43 @@ +/* + * 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 (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. + */ + +#include "con.h" +label(s) +char *s; +{ + int i,c; + while((c = *s++) != '\0'){ + xnow += 6; + spew(c); + } + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/line.c b/usr/src/ucbcmd/plot/libplot/t450/line.c new file mode 100644 index 0000000000..226fee3148 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/line.c @@ -0,0 +1,77 @@ +/* + * 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 (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. + */ + +#include "con.h" +line(x0,y0,x1,y1){ + iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1))); + return; +} +cont(x0,y0){ + iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0))); + return; +} +iline(cx0,cy0,cx1,cy1){ + int maxp,tt,j,np; + char chx,chy; + float xd,yd; + float dist2(),sqrt(); + movep(cx0,cy0); + maxp = sqrt(dist2(cx0,cy0,cx1,cy1))/2.; + xd = cx1-cx0; + yd = cy1-cy0; + if(xd >= 0)chx = RIGHT; + else chx = LEFT; + if(yd >= 0)chy = UP; + else chy = DOWN; + if(maxp == 0){ + xd=0; + yd=0; + } + else{ + xd /= maxp; + yd /= maxp; + } + inplot(); + for (tt=0; tt<=maxp; tt++){ + j= cx0+xd*tt-xnow; + xnow += j; + j = abval(j); + while(j-- > 0)spew(chx); + j = cy0+yd*tt-ynow; + ynow += j; + j = abval(j); + while(j-- > 0)spew(chy); + spew ('.'); + } + outplot(); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/linmod.c b/usr/src/ucbcmd/plot/libplot/t450/linmod.c new file mode 100644 index 0000000000..b1731bdbe9 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/linmod.c @@ -0,0 +1,34 @@ +/* + * 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 (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. + */ + +linemod(){ +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/move.c b/usr/src/ucbcmd/plot/libplot/t450/move.c new file mode 100644 index 0000000000..a0b158bf8d --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/move.c @@ -0,0 +1,36 @@ +/* + * 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 (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. + */ + +move(xi,yi){ + movep(xconv(xsc(xi)),yconv(ysc(yi))); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/open.c b/usr/src/ucbcmd/plot/libplot/t450/open.c new file mode 100644 index 0000000000..6171d87d47 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/open.c @@ -0,0 +1,82 @@ +/* + * 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 (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. + */ + +# +#include <sgtty.h> +/* gsi plotting output routines */ +# define DOWN 012 +# define UP 013 +# define LEFT 010 +# define RIGHT 040 +# define BEL 007 +# define ACK 006 +#define PLOTIN 063 +#define PLOTOUT 064 +# define CR 015 +# define FF 014 +# define VERTRESP 48 +# define HORZRESP 60. +# define HORZRES 6. +# define VERTRES 8. +/* down is line feed, up is reverse oyne feed, + left is bwckspace, right is space. 48 points per inch + vertically, 60 horizontally */ + +int xnow, ynow; +int OUTF; +struct sgttyb ITTY, PTTY; +float HEIGHT = 6.0, WIDTH = 6.0, OFFSET = 0.0; +int xscale, xoffset, yscale; +float botx = 0., boty = 0., obotx = 0., oboty = 0.; +float scalex = 1., scaley = 1.; + +openpl () +{ + int reset(); + xnow = ynow = 0; + OUTF = 1; + printf("\r"); + gtty(OUTF, &ITTY); + signal (2, reset); + PTTY = ITTY; + PTTY.sg_flags &= ~CRMOD; /* don't map lf */ + stty(OUTF,&PTTY); + /* initialize constants */ + xscale = 4096./(HORZRESP * WIDTH); + yscale = 4096 /(VERTRESP * HEIGHT); + xoffset = OFFSET * HORZRESP; + return; +} + +openvt(){ +openpl(); +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/point.c b/usr/src/ucbcmd/plot/libplot/t450/point.c new file mode 100644 index 0000000000..7389adde38 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/point.c @@ -0,0 +1,37 @@ +/* + * 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 (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. + */ + +point(xi,yi){ + move(xi,yi); + label("."); + return; +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/space.c b/usr/src/ucbcmd/plot/libplot/t450/space.c new file mode 100644 index 0000000000..70f60955d4 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/space.c @@ -0,0 +1,41 @@ +/* + * 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 (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. + */ + +# include "con.h" +space(x0,y0,x1,y1){ + botx = -2047.; + boty = -2047.; + obotx = x0; + oboty = y0; + scalex = 4096./(x1-x0); + scaley = 4096./(y1-y0); +} diff --git a/usr/src/ucbcmd/plot/libplot/t450/subr.c b/usr/src/ucbcmd/plot/libplot/t450/subr.c new file mode 100644 index 0000000000..05fb7841a7 --- /dev/null +++ b/usr/src/ucbcmd/plot/libplot/t450/subr.c @@ -0,0 +1,148 @@ +/* + * 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 (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. + */ + +#include <stdio.h> +#include "con.h" +abval(q) +{ + return (q>=0 ? q : -q); +} + +xconv (xp) +{ + /* x position input is -2047 to +2047, output must be 0 to PAGSIZ*HORZRES */ + xp += 2048; + /* the computation is newx = xp*(PAGSIZ*HORZRES)/4096 */ + return (xoffset + xp /xscale); +} + +yconv (yp) +{ + /* see description of xconv */ + yp += 2048; + return (yp / yscale); +} + +inplot() +{ + spew (ESC); + spew(PLOTIN); +} + +outplot() +{ + spew(ESC); + spew(PLOTOUT); + fflush(stdout); +} + +spew(ch) +{ + if(ch == UP){ + putc(ESC,stdout); + ch = DOWN; + } + putc(ch, stdout); +} + +tobotleft () +{ + move(-2048,-2048); +} +reset() +{ + signal(2,1); + outplot(); + stty(OUTF,&ITTY); + exit(0); +} + +float +dist2 (x1, y1, x2, y2) +{ + float t,v; + t = x2-x1; + v = y1-y2; + return (t*t+v*v); +} + +swap (pa, pb) +int *pa, *pb; +{ + int t; + t = *pa; + *pa = *pb; + *pb = t; +} +movep (xg,yg) +{ + int i,ch; + if((xg == xnow) && (yg == ynow))return; + /* if we need to go to left margin, just CR */ + if (xg < xnow/2) + { + spew(CR); + xnow = 0; + } + i = (xg-xnow)/HORZRES; + if(xnow < xg)ch = RIGHT; + else ch = LEFT; + xnow += i*HORZRES; + i = abval(i); + while(i--)spew(ch); + i = abval(xg-xnow); + inplot(); + while(i--) spew(ch); + outplot(); + i=(yg-ynow)/VERTRES; + if(ynow < yg)ch = UP; + else ch = DOWN; + ynow += i*VERTRES; + i = abval(i); + while(i--)spew(ch); + i=abval(yg-ynow); + inplot(); + while(i--)spew(ch); + outplot(); + xnow = xg; ynow = yg; +} + +xsc(xi){ + int xa; + xa = (xi - obotx) * scalex + botx; + return(xa); +} +ysc(yi){ + int ya; + ya = (yi - oboty) *scaley +boty; + return(ya); +} |