This commit is contained in:
seta75D
2021-10-11 19:38:01 -03:00
commit 7c4988eac0
12567 changed files with 3198619 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#
#ident "@(#)Makefile 1.2 92/12/16 SMI"
#
# Copyright (c) 1989 by Sun Microsystems, Inc.
#
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
BUILD.AR = $(AR) $(ARFLAGS) $@ `$(LORDER) $(AROBJS) | $(TSORT)`
CLOBBERFILES= $(LIBRARY)
.KEEP_STATE:
all: $(LIBS)
include ../../../../lib/Makefile.targ

View File

@@ -0,0 +1,62 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)arc.c 1.1 90/08/19 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);
*/
}

View File

@@ -0,0 +1,30 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)box.c 1.1 90/08/19 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);
}

View File

@@ -0,0 +1,34 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)circle.c 1.1 90/08/19 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) );
}

View File

@@ -0,0 +1,31 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)close.c 1.1 90/08/19 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 );
}

View File

@@ -0,0 +1,31 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)cont.c 1.1 90/08/19 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 );
}

View File

@@ -0,0 +1,23 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)dot.c 1.1 90/08/19 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(){
}

View File

@@ -0,0 +1,23 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)erase.c 1.1 90/08/19 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(){
}

View File

@@ -0,0 +1,47 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)hp7221.h 1.1 90/08/19 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;

View File

@@ -0,0 +1,29 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)label.c 1.1 90/08/19 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 );
}

View File

@@ -0,0 +1,35 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)line.c 1.1 90/08/19 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);
}
}

View File

@@ -0,0 +1,81 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)linemod.c 1.1 90/08/19 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;
}

View File

@@ -0,0 +1,31 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)move.c 1.1 90/08/19 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 );
}

View File

@@ -0,0 +1,55 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)open.c 1.1 90/08/19 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);
}

View File

@@ -0,0 +1,30 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)point.c 1.1 90/08/19 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);
}

View File

@@ -0,0 +1,33 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)space.c 1.1 90/08/19 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;
}

View File

@@ -0,0 +1,86 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)subr.c 1.1 90/08/19 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;
}