home *** CD-ROM | disk | FTP | other *** search
- Subject: v14i013: Device-independant graphics system, with drivers
- Newsgroups: comp.sources.unix
- Sender: sources
- Approved: rsalz@uunet.UU.NET
- From: rsalz@uunet.uu.net
-
- Submitted-by: Joe Dellinger <joe@hanauma.STANFORD.EDU>
- Posting-number: Volume 14, Issue 13
- Archive-name: vplot/part08
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 8 (of 24)."
- # Wrapped by rsalz@fig.bbn.com on Fri Mar 25 11:47:00 1988
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'Envision_device/envilib/enviclose.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Envision_device/envilib/enviclose.c'\"
- else
- echo shar: Extracting \"'Envision_device/envilib/enviclose.c'\" \(1894 characters\)
- sed "s/^X//" >'Envision_device/envilib/enviclose.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/envilib/enviclose.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X#include <stdio.h>
- X#include "../include/mesgcom.h"
- X#include "../include/closestat.h"
- X#include "envi.h"
- X
- X
- extern FILE *pltout;
- X
- extern int out_isatty;
- int want_bell = 1;
- X
- enviclose (status)
- X int status;
- X{
- X switch (status)
- X {
- X case CLOSE_FLUSH:
- X fflush (pltout);
- X break;
- X case CLOSE_PAUSE:
- X envisetmode (REG);
- X if (want_bell == 1)
- X {
- X fprintf (pltout, "\007");
- X }
- X fflush (pltout);
- X break;
- X case CLOSE_NORMAL:
- X break;
- X case CLOSE_DONE:
- X envisetmode (REG);
- X if (out_isatty)
- X {
- X enviresetcolors ();
- X envinograph ();
- X }
- X enviresetpan ();
- X envicursoroff ();
- X fflush (pltout);
- X break;
- X case CLOSE_ERROR:
- X break;
- X case CLOSE_INTERRUPT:
- X envisetmode (REG);
- X putc (US, pltout);
- X putc (US, pltout);
- X fprintf (pltout, "%c\n\n", ESC);
- X putc (US, pltout);
- X putc (US, pltout);
- X putc (US, pltout);
- X putc (US, pltout);
- X putc (US, pltout);
- X putc (US, pltout);
- X fprintf (pltout, "%c\n", ESC);
- X putc (US, pltout);
- X enviresetcolors ();
- X envinograph ();
- X enviresetpan ();
- X envicursoroff ();
- X enviresetcolors ();
- X envinograph ();
- X enviresetpan ();
- X fprintf (pltout, "%c\n", ESC);
- X enviresetcolors ();
- X envinograph ();
- X enviresetpan ();
- X envicursoroff ();
- X fflush (pltout);
- X break;
- X case CLOSE_NOTHING:
- X break;
- X default:
- X break;
- X }
- X}
- END_OF_FILE
- if test 1894 -ne `wc -c <'Envision_device/envilib/enviclose.c'`; then
- echo shar: \"'Envision_device/envilib/enviclose.c'\" unpacked with wrong size!
- fi
- # end of 'Envision_device/envilib/enviclose.c'
- fi
- if test -f 'Envision_device/envilib/enviconf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Envision_device/envilib/enviconf.c'\"
- else
- echo shar: Extracting \"'Envision_device/envilib/enviconf.c'\" \(1994 characters\)
- sed "s/^X//" >'Envision_device/envilib/enviconf.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/envilib/enviconf.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X/*
- X * Envision configuration, models 215 and 220.
- X * The only difference between these two is in the open routine.
- X * Several configuration variables are reset.
- X * Keyword: envision pen vplot
- X */
- X#include <stdio.h>
- X#include "../include/extern.h"
- X
- X/*
- X * mandatory declarations
- X */
- X#ifdef SEP
- char name[] = "Envipen";
- X#else
- char name[] = "envipen";
- X#endif
- X#include "envidoc.h"
- X
- X/*
- X * device routine table
- X */
- extern int
- enviopen (), envireset (), envimessage (), envierase (), enviclose ();
- extern int
- genvector (), gentext (), genraster1 ();
- extern int enviattributes ();
- extern int
- enviplot (), envistartpoly (), envimidpoly (), enviendpoly ();
- extern int
- genarea (), envipoint (), genmarker ();
- extern int
- envigetpoint (), vecarea (), nulldev (), geninteract ();
- X
- struct device dev =
- X{
- X /* control routines */
- X enviopen, /* open */
- X envireset, /* reset */
- X envimessage, /* message */
- X envierase, /* erase */
- X enviclose, /* close */
- X
- X /* high level output */
- X genvector, /* vector */
- X genmarker, /* marker */
- X gentext, /* text */
- X genarea, /* area */
- X genraster1, /* raster */
- X envipoint, /* point */
- X enviattributes, /* attributes */
- X
- X /* input */
- X envigetpoint, /* getpoint */
- X geninteract, /* interact */
- X
- X /* low level output */
- X enviplot, /* plot */
- X envistartpoly, /* startpoly */
- X envimidpoly, /* midpoly */
- X enviendpoly /* endpoly */
- X};
- END_OF_FILE
- if test 1994 -ne `wc -c <'Envision_device/envilib/enviconf.c'`; then
- echo shar: \"'Envision_device/envilib/enviconf.c'\" unpacked with wrong size!
- fi
- # end of 'Envision_device/envilib/enviconf.c'
- fi
- if test -f 'Imagen_device/imaglib/imagclose.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Imagen_device/imaglib/imagclose.c'\"
- else
- echo shar: Extracting \"'Imagen_device/imaglib/imagclose.c'\" \(1844 characters\)
- sed "s/^X//" >'Imagen_device/imaglib/imagclose.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/imaglib/imagclose.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X/* Routine to finish up */
- X#include <stdio.h>
- X#include "../include/closestat.h"
- X#include "../include/enum.h"
- X#include "../include/extern.h"
- X#include "../include/err.h"
- X#include "imagen.h"
- X
- imagclose (status)
- X int status;
- X{
- char system_call[120];
- extern int system ();
- X
- X switch (status)
- X {
- X case CLOSE_FLUSH:
- X fflush (pltout);
- X break;
- X case CLOSE_NORMAL:
- X if (tex == YES)
- X fprintf (pltout, "%c", POP);
- X if (stripped == NO)
- X fprintf (pltout, "%c", EOPLOT);
- X /*
- X * If we created a temporary file, ipr it and tell it to remove it
- X * when done.
- X */
- X if (file_created)
- X {
- X fclose (pltout);
- X sprintf (system_call, "lpr -Pim -r -s -v %s\n", scratch_file);
- X if (0 == system (system_call))
- X {
- X file_created = NO;
- X }
- X else
- X {
- X /* else figure we'll need to delete scratch file outselves */
- X ERR (WARN, name, "Couldn't get lpr to cooperate\n");
- X }
- X }
- X break;
- X case CLOSE_ERROR:
- X case CLOSE_NOTHING:
- X case CLOSE_INTERRUPT:
- X break;
- X case CLOSE_DONE:
- X /*
- X * If we created a temporary file, remove it
- X */
- X if (file_created)
- X unlink (scratch_file);
- X break;
- X case CLOSE_PAUSE:
- X break;
- X default: /* not meant for us, ignore */
- X break;
- X }
- X}
- END_OF_FILE
- if test 1844 -ne `wc -c <'Imagen_device/imaglib/imagclose.c'`; then
- echo shar: \"'Imagen_device/imaglib/imagclose.c'\" unpacked with wrong size!
- fi
- # end of 'Imagen_device/imaglib/imagclose.c'
- fi
- if test -f 'Imagen_device/imaglib/imagconf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Imagen_device/imaglib/imagconf.c'\"
- else
- echo shar: Extracting \"'Imagen_device/imaglib/imagconf.c'\" \(1858 characters\)
- sed "s/^X//" >'Imagen_device/imaglib/imagconf.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/imaglib/imagconf.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X/*
- X * Imagen 8/300 configuration
- X * Keyword: vplot imagen pen
- X */
- X#include <stdio.h>
- X#include "../include/enum.h"
- X#include "../include/extern.h"
- X
- X/*
- X * mandatory declarations and initializations
- X */
- X#ifdef SEP
- char name[] = "Imagpen";
- X#else
- char name[] = "imagpen";
- X#endif
- X#include "imagdoc.h"
- X
- X/*
- X * device routine table
- X */
- extern int
- imagopen (), imagreset (), imagerase (), imagclose ();
- extern int
- imagvector (), imagplot (), imagattributes ();
- extern int
- gentext (), imagraster (), genmessage (), hersheytext ();
- extern int
- genarea (), genmarker (), genpoint ();
- extern int
- nulldev (), imagstartpoly (), imagmidpoly (), imagendpoly ();
- X
- struct device dev =
- X{
- X
- X /* control routines */
- X imagopen, /* open */
- X imagreset, /* reset */
- X genmessage, /* message */
- X imagerase, /* erase */
- X imagclose, /* close */
- X
- X /* high level output */
- X imagvector, /* vector */
- X genmarker, /* marker */
- X gentext, /* text */
- X genarea, /* area */
- X imagraster, /* raster */
- X genpoint, /* point */
- X imagattributes, /* attributes */
- X
- X /* input */
- X nulldev, /* getpoint */
- X nulldev, /* interact */
- X
- X /* low level output */
- X imagplot, /* plot */
- X imagstartpoly, /* startpoly */
- X imagmidpoly, /* midpoly */
- X imagendpoly /* endpoly */
- X};
- END_OF_FILE
- if test 1858 -ne `wc -c <'Imagen_device/imaglib/imagconf.c'`; then
- echo shar: \"'Imagen_device/imaglib/imagconf.c'\" unpacked with wrong size!
- fi
- # end of 'Imagen_device/imaglib/imagconf.c'
- fi
- if test -f 'Masscomp_device/gpslib/known_bugs' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Masscomp_device/gpslib/known_bugs'\"
- else
- echo shar: Extracting \"'Masscomp_device/gpslib/known_bugs'\" \(1902 characters\)
- sed "s/^X//" >'Masscomp_device/gpslib/known_bugs' <<'END_OF_FILE'
- This does not put out GPS records directly, instead it calls MC/PLOT
- library routines. For this reason gpspen only compiles and runs on
- the Masscomp as it links with several of their libraries.
- X
- On the Masscomp you have to issue the universe ucb command in
- order for this to compile and run correctly.
- X
- Don't know how to erase a GPS window. GPS doesn't appear to have
- this notion.
- X
- There's no GPS notion of area fill, and this is painfully slow with vector draws.
- X
- Color is a real hash here. I need to build a crpf.config
- ascii file with all sorts of junk in it to make this work well.
- For now you can rely on the standard colors 0 to 7 (though 0
- may not erase).
- X
- The mcd command can give you a softcopy preview but the colors won't match
- the ones you asked for. Different defaults than the crpf command.
- X
- The Masscomp truncates filenames to 16 characters! Ouch Ouch Ouch!
- This wreaks havoc in loclib, with getpar_string_store.c and getpar_decode.c
- and anything that calls it. Also several of the test files and I don't
- remember what else. (Oh yes, include/font_definition.h)
- X
- You need to install vplot.h in one of the standard include libraries before
- attempting to make any pen filter, including gpspen.
- X
- You may need to fix up the location of the vplot text fonts in include/param.h
- I did at least. You also need to fix up filters/machdep. The link library
- list for MC/PLOT is as long as your arm!
- X
- A good color scheme for a graphics tube may look bad on hardcopy because
- the background is white, not black. Watch out for yellow, especially.
- X
- The aspect ratio will need some work. The mcd previews generally fill
- the screen, or at least large portions of it, but the color hardcopy
- is covering only about half the sheet.
- X
- Setting ppi=300 does significantly speed up the plotting, but the lines
- come out awfully thin. (The overall plot stays the same height and width.)
- X
- X - Stew Levin
- END_OF_FILE
- if test 1902 -ne `wc -c <'Masscomp_device/gpslib/known_bugs'`; then
- echo shar: \"'Masscomp_device/gpslib/known_bugs'\" unpacked with wrong size!
- fi
- # end of 'Masscomp_device/gpslib/known_bugs'
- fi
- if test -f 'Printronix_device/lprlib/lpropen.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Printronix_device/lprlib/lpropen.c'\"
- else
- echo shar: Extracting \"'Printronix_device/lprlib/lpropen.c'\" \(1995 characters\)
- sed "s/^X//" >'Printronix_device/lprlib/lpropen.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/lprlib/lpropen.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X#include <stdio.h>
- X#include "../include/err.h"
- X#include "../include/enum.h"
- X#include "../include/extern.h"
- X#include "../include/params.h"
- X#include "lprpen.h"
- X
- X/* raster memory */
- short *mem; /* front of bit map */
- int xlimit = XSTRSZ;
- char inbuf[BUFSIZ]; /* input buffer -used by getc/h */
- short line[NYW + 1]; /* buffer for one raster line */
- X
- int file_created = NO;
- char spoolfile[100];
- char mapfile[100] = "default";
- X
- lpropen ()
- X{
- X/*
- X * physical device parameters
- X */
- X dev_xmax = 3000;
- X dev_ymax = 791;
- X dev_xmin = 0;
- X dev_ymin = 0;
- X pixels_per_inch = 72.0;
- X aspect_ratio = 1.2023;
- X num_col = 0;
- X
- X/*
- X * device capabilities
- X */
- X need_end_erase = YES;
- X buffer_output = YES;
- X smart_clip = NO;
- X mono = YES;
- X dither = 3;
- X pixc = 0.6;
- X greyc = -0.5;
- X
- X/* Since this is a hard copy device, might as well use a nice font */
- X txfont = DEFAULT_HARDCOPY_FONT;
- X txprec = DEFAULT_HARDCOPY_PREC;
- X
- X epause = 0;
- X endpause = NO;
- X size = ABSOLUTE;
- X if (isatty (fileno (pltout)))
- X {
- X file_created = YES;
- X sprintf (spoolfile, "%s%s", LPR_SPOOL, "/lprpen_XXXXXX");
- X mktemp (spoolfile);
- X pltout = fopen (spoolfile, "w");
- X if (pltout == NULL)
- X {
- X ERR (FATAL, name, "could not open spool file %s!",
- X spoolfile);
- X }
- X }
- X
- X mem = (short *) malloc (2 * XSTRSZ * NYW);
- X}
- END_OF_FILE
- if test 1995 -ne `wc -c <'Printronix_device/lprlib/lpropen.c'`; then
- echo shar: \"'Printronix_device/lprlib/lpropen.c'\" unpacked with wrong size!
- fi
- # end of 'Printronix_device/lprlib/lpropen.c'
- fi
- if test -f 'RasterTek_device/rteklib/rtekconf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'RasterTek_device/rteklib/rtekconf.c'\"
- else
- echo shar: Extracting \"'RasterTek_device/rteklib/rtekconf.c'\" \(1825 characters\)
- sed "s/^X//" >'RasterTek_device/rteklib/rtekconf.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/rteklib/rtekconf.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X#include "rtekpen.h"
- X
- X/* declarations */
- X#ifdef SEP
- char name[] = "Rpen";
- X#else
- char name[] = "rpen";
- X#endif
- X#include "rtekdoc.h"
- X
- X/* physical device size */
- int version = 1 - 75;
- X
- X/* device routine table */
- extern
- rtekopen (), rtekclose (), rtekplot (), rtekerase (), rtekattributes ();
- extern
- rtekpoint (), rtekarea (), rtekraster (), rtekgetpoint ();
- extern
- nulldev (), genmessage (), genvector (), genmarker (), gentext ();
- extern
- vecarea (), genpatarea (), geninteract ();
- X
- struct device dev = {
- X /* control routines */
- X rtekopen, /* open */
- X nulldev, /* reset */
- X genmessage, /* message */
- X rtekerase, /* erase */
- X rtekclose, /* close */
- X /* high level output */
- X genvector, /* vector */
- X genmarker, /* marker */
- X gentext, /* text */
- X genpatarea, /* area */
- X rtekraster, /* raster */
- X rtekpoint, /* point */
- X rtekattributes, /* attributes */
- X /* input */
- X rtekgetpoint, /* getpoint */
- X geninteract, /* interact */
- X /* low level output */
- X rtekplot, /* plot */
- X nulldev, /* startpoly */
- X nulldev, /* midpoly */
- X nulldev /* endpoly */
- X};
- END_OF_FILE
- if test 1825 -ne `wc -c <'RasterTek_device/rteklib/rtekconf.c'`; then
- echo shar: \"'RasterTek_device/rteklib/rtekconf.c'\" unpacked with wrong size!
- fi
- # end of 'RasterTek_device/rteklib/rtekconf.c'
- fi
- if test -f 'Regis_device/gigilib/gigiconf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Regis_device/gigilib/gigiconf.c'\"
- else
- echo shar: Extracting \"'Regis_device/gigilib/gigiconf.c'\" \(1909 characters\)
- sed "s/^X//" >'Regis_device/gigilib/gigiconf.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/gigilib/gigiconf.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X/*
- X * Keywords: DEC gigi pen vplot
- X * DEC GIGI configuration
- X */
- X#include <stdio.h>
- X#include "../include/enum.h"
- X#include "../include/extern.h"
- X
- char name[] = "gigipen";
- X#include "gigidoc.h"
- X
- X/*
- X * device routine table structure
- X */
- extern int
- gigiopen (), gigireset (), gigimessage (), gigierase (), gigiclose ();
- extern int
- genvector (), gentext (), genraster1 ();
- extern int gigiattributes ();
- extern int
- gigiplot (), gigistartpoly (), gigimidpoly (), gigiendpoly ();
- extern int
- vecarea (), genpoint (), genmarker ();
- extern int
- gigigetpoint (), nulldev (), geninteract ();
- X
- struct device dev = {
- X
- X /* control routines */
- X gigiopen, /* open */
- X gigireset, /* reset */
- X gigimessage, /* message */
- X gigierase, /* erase */
- X gigiclose, /* close */
- X
- X /* high level output */
- X genvector, /* vector */
- X genmarker, /* marker */
- X gentext, /* text */
- X vecarea, /* area */
- X genraster1, /* raster */
- X genpoint, /* point */
- X gigiattributes, /* attributes */
- X
- X /* input */
- X gigigetpoint, /* getpoint */
- X geninteract, /* interact */
- X
- X /* low level output */
- X gigiplot, /* plot */
- X nulldev, /* startpoly */
- X nulldev, /* midpoly */
- X nulldev /* endpoly */
- X};
- END_OF_FILE
- if test 1909 -ne `wc -c <'Regis_device/gigilib/gigiconf.c'`; then
- echo shar: \"'Regis_device/gigilib/gigiconf.c'\" unpacked with wrong size!
- fi
- # end of 'Regis_device/gigilib/gigiconf.c'
- fi
- if test -f 'Regis_device/gigilib/gigimessage.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Regis_device/gigilib/gigimessage.c'\"
- else
- echo shar: Extracting \"'Regis_device/gigilib/gigimessage.c'\" \(2009 characters\)
- sed "s/^X//" >'Regis_device/gigilib/gigimessage.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/gigilib/gigimessage.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X/*
- X * Device dependent subroutine to handle text operations
- X * Not one of the GIGI's strong points. (Indeed if it has any)
- X */
- X#include <stdio.h>
- X#include <strings.h>
- X#include "gigi.h"
- X#include "../include/mesgcom.h"
- X
- extern FILE *pltout;
- X
- int messagecount = 0;
- X
- gigimessage (command, string)
- X int command;
- X char string[];
- X{
- int count;
- static int first = 0;
- X switch (command)
- X {
- X case MESG_OFF:
- X case MESG_ON:
- X case MESG_ERASE:
- X break;
- X case MESG_HOME:
- X fprintf (pltout, ";P[0,0];");
- X break;
- X case MESG_READY:
- X if (lastop != '\0')
- X {
- X fprintf (pltout, ";P[0,0];T(BS1D0I0");
- X first = 1;
- X }
- X break;
- X case MESG_DONE:
- X if (first == 1)
- X {
- X first = 0;
- X fprintf (pltout, ")");
- X }
- X if (lastop != '\0')
- X fprintf (pltout, "T(E);");
- X break;
- X
- X case MESG_HIGHLIGHT_ON:
- X fprintf (pltout, "W(A1N0I7R)");
- X break;
- X
- X case MESG_HIGHLIGHT_OFF:
- X gigimessage (MESG_DONE);
- X gigimessage (MESG_READY);
- X break;
- X case MESG_TEXT:
- X if (strcmp ("\n", string))
- X {
- X if (first == 1)
- X {
- X first = 0;
- X fprintf (pltout, ")");
- X }
- X if (lastop != '\0')
- X {
- X fprintf (pltout, "\"");
- X for (count = messagecount; count > 0; count--)
- X fprintf (pltout, "\n");
- X }
- X fprintf (pltout, "%s", string);
- X if (lastop != '\0')
- X {
- X messagecount++;
- X fprintf (pltout, "\"");
- X }
- X }
- X break;
- X }
- X}
- END_OF_FILE
- if test 2009 -ne `wc -c <'Regis_device/gigilib/gigimessage.c'`; then
- echo shar: \"'Regis_device/gigilib/gigimessage.c'\" unpacked with wrong size!
- fi
- # end of 'Regis_device/gigilib/gigimessage.c'
- fi
- if test -f 'Tek_device/cteklib/ctekconf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Tek_device/cteklib/ctekconf.c'\"
- else
- echo shar: Extracting \"'Tek_device/cteklib/ctekconf.c'\" \(2030 characters\)
- sed "s/^X//" >'Tek_device/cteklib/ctekconf.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/cteklib/ctekconf.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X/*
- X * Tek 4100 series configuration
- X * Keywords: pen vplot tek
- X */
- X#include <stdio.h>
- X#include "../include/enum.h"
- X#include "../include/extern.h"
- X
- X/*
- X * mandatory declarations and initializations
- X */
- X#ifdef SEP
- char name[] = "Ctekpen";
- X#else
- char name[] = "ctekpen";
- X#endif
- X#include "ctekdoc.h"
- X
- X/*
- X * device routine table
- X */
- extern int
- ctekopen (), ctekreset (), ctekmessage (), ctekerase (), ctekclose ();
- extern int
- ctekattributes (), ctekstartpoly (), ctekmidpoly (), ctekendpoly ();
- extern int
- genvector (), gentext (), ctekraster ();
- extern int
- ctekplot (), ctekgetpoint ();
- extern int
- genpatarea (), genpoint (), genmarker ();
- extern int
- nulldev (), geninteract ();
- X
- struct device dev = {
- X
- X /* control routines */
- X ctekopen, /* open */
- X ctekreset, /* reset */
- X ctekmessage, /* message */
- X ctekerase, /* erase */
- X ctekclose, /* close */
- X
- X /* high level output */
- X genvector, /* vector */
- X genmarker, /* marker */
- X gentext, /* text */
- X genpatarea, /* area */
- X ctekraster, /* raster */
- X genpoint, /* point */
- X ctekattributes, /* attributes */
- X
- X /* input */
- X ctekgetpoint, /* getpoint */
- X geninteract, /* interact */
- X
- X /* low level output */
- X ctekplot, /* plot */
- X ctekstartpoly, /* startpoly */
- X ctekmidpoly, /* midpoly */
- X ctekendpoly, /* endpoly */
- X};
- END_OF_FILE
- if test 2030 -ne `wc -c <'Tek_device/cteklib/ctekconf.c'`; then
- echo shar: \"'Tek_device/cteklib/ctekconf.c'\" unpacked with wrong size!
- fi
- # end of 'Tek_device/cteklib/ctekconf.c'
- fi
- if test -f 'Tek_device/teklib/tekconf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Tek_device/teklib/tekconf.c'\"
- else
- echo shar: Extracting \"'Tek_device/teklib/tekconf.c'\" \(1929 characters\)
- sed "s/^X//" >'Tek_device/teklib/tekconf.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/teklib/tekconf.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X/*
- X * tektronix 4010-4014 configuration
- X * distinctive attributes of emulators are dealt with in tekopen.c
- X */
- X#include <stdio.h>
- X#include "../include/enum.h"
- X#include "../include/extern.h"
- X
- X/*
- X * mandatory declarations and initializations
- X */
- X#ifdef SEP
- char name[] = "Tekpen";
- X#else
- char name[] = "tekpen";
- X#endif
- X#include "tekdoc.h"
- X
- X/*
- X * device routine table
- X */
- extern int
- tekopen (), tekmessage (), tekerase (), tekclose ();
- extern int
- genvector (), gentext (), genraster (), genmarker ();
- extern int
- tekplot (), tekpoint ();
- extern int
- vecarea (), geninteract ();
- extern int nulldev ();
- X
- struct device dev = {
- X
- X /* control routines */
- X tekopen, /* open */
- X nulldev, /* reset */
- X tekmessage, /* message */
- X tekerase, /* erase */
- X tekclose, /* close */
- X
- X /* high level output */
- X genvector, /* vector */
- X genmarker, /* marker */
- X gentext, /* text */
- X nulldev /*vecarea*/ , /* area */
- X genraster, /* raster */
- X tekpoint, /* point */
- X nulldev, /* attributes */
- X
- X /* input */
- X nulldev, /* getpoint */
- X geninteract, /* interact */
- X
- X /* low level output */
- X tekplot, /* plot */
- X nulldev, /* startpoly */
- X nulldev, /* midpoly */
- X nulldev /* endpoly */
- X};
- END_OF_FILE
- if test 1929 -ne `wc -c <'Tek_device/teklib/tekconf.c'`; then
- echo shar: \"'Tek_device/teklib/tekconf.c'\" unpacked with wrong size!
- fi
- # end of 'Tek_device/teklib/tekconf.c'
- fi
- if test -f 'Tek_device/teklib/tekpack.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Tek_device/teklib/tekpack.c'\"
- else
- echo shar: Extracting \"'Tek_device/teklib/tekpack.c'\" \(2040 characters\)
- sed "s/^X//" >'Tek_device/teklib/tekpack.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/teklib/tekpack.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X#include <stdio.h>
- X#include "tek.h"
- extern FILE *pltout;
- X
- X/*
- X * Tek x,y coordinate packing.
- X * Previously-encoded positions are saved in
- X * ohiy, oloy, etc. in order to abbreviate the number of
- X * bytes sent out. This routine assumes pltout is open.
- X */
- tekxypack (x, y)
- X int x, y;
- X{
- register int hiy, loy, hix, lox;
- static int ohiy, oloy, ohix, olox;
- X
- X /*
- X * Encode the new position.
- X */
- X hiy = 0040 | ((y >> 5) & 037);
- X loy = 0140 | (y & 037);
- X hix = 0040 | ((x >> 5) & 037);
- X lox = 0100 | (x & 037);
- X
- X /*
- X * Only print what's necessary, according to Tek rules.
- X */
- X if (hiy != ohiy || lost == 1)
- X putc (hiy, pltout);
- X if (loy != oloy || hix != ohix || lost == 1)
- X putc (loy, pltout);
- X if (hix != ohix || lost == 1)
- X putc (hix, pltout);
- X if (hiy != ohiy || loy != oloy || hix != ohix || lox != olox || lost == 1)
- X putc (lox, pltout);
- X
- X /*
- X * Remember these for next time.
- X */
- X ohiy = hiy;
- X oloy = loy;
- X ohix = hix;
- X olox = lox;
- X}
- X
- X/*
- X * Issue a packed integer. From one to three bytes sent.
- X */
- tekipack (i)
- X register int i;
- X{
- register int ihi, imd, ilo;
- X
- X if (i < 0)
- X {
- X i = -i;
- X ilo = 040;
- X }
- X else
- X ilo = 060;
- X
- X ihi = 0100 | ((i >> 10) & 037);
- X imd = 0100 | ((i >> 4) & 077);
- X ilo |= (i & 017);
- X
- X if (ihi != 0100)
- X putc (ihi, pltout);
- X if (imd != 0100)
- X putc (imd, pltout);
- X putc (ilo, pltout);
- X}
- END_OF_FILE
- if test 2040 -ne `wc -c <'Tek_device/teklib/tekpack.c'`; then
- echo shar: \"'Tek_device/teklib/tekpack.c'\" unpacked with wrong size!
- fi
- # end of 'Tek_device/teklib/tekpack.c'
- fi
- if test -f 'Virtual_device/raslib/rasclose.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Virtual_device/raslib/rasclose.c'\"
- else
- echo shar: Extracting \"'Virtual_device/raslib/rasclose.c'\" \(1891 characters\)
- sed "s/^X//" >'Virtual_device/raslib/rasclose.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/raslib/rasclose.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X#include <stdio.h>
- X#include "../include/closestat.h"
- X#include "../include/err.h"
- X#include "../include/extern.h"
- X#include "../include/params.h"
- X#include "raspen.h"
- extern int color_table[NCOLOR][3];
- extern char colfile[];
- X
- rasclose (status)
- X int status;
- X{
- int value;
- FILE *colout;
- X
- X switch (status)
- X {
- X case CLOSE_NORMAL:
- X#ifdef SEP
- X Puthead ("Color table:\n");
- X for (value = 0; value < NCOLOR; value++)
- X {
- X if (color_table[value][0] != -1)
- X {
- X Puthead ("%d\t\t%d\t%d\t%d\n", value,
- X color_table[value][0], color_table[value][1], color_table[value][2]);
- X }
- X }
- X Puthead ("\n");
- X#else
- X fprintf (stderr, "I recommend using the SEPlib version,\n");
- X fprintf (stderr, "since Movie is a SEP program.\n");
- X#endif
- X
- X colout = fopen (colfile, "w");
- X if (colout == NULL)
- X ERR (WARN, name, "can't open colfile %s\n", colfile);
- X else
- X {
- X for (value = 0; value < NCOLOR; value++)
- X {
- X if (color_table[value][0] != -1)
- X {
- X fprintf (colout, "%d\t\t%f\t%f\t%f\n", value,
- X (float) color_table[value][0] / MAX_GUN,
- X (float) color_table[value][1] / MAX_GUN,
- X (float) color_table[value][2] / MAX_GUN);
- X }
- X }
- X }
- X break;
- X case CLOSE_FLUSH:
- X fflush (pltout);
- X break;
- X default:
- X break;
- X }
- X}
- END_OF_FILE
- if test 1891 -ne `wc -c <'Virtual_device/raslib/rasclose.c'`; then
- echo shar: \"'Virtual_device/raslib/rasclose.c'\" unpacked with wrong size!
- fi
- # end of 'Virtual_device/raslib/rasclose.c'
- fi
- if test -f 'Vplot_Kernel/filters/Tests/ufilltest.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/Tests/ufilltest.c'\"
- else
- echo shar: Extracting \"'Vplot_Kernel/filters/Tests/ufilltest.c'\" \(1816 characters\)
- sed "s/^X//" >'Vplot_Kernel/filters/Tests/ufilltest.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/Tests/ufilltest.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X#include <stdio.h>
- X#include <vplot.h>
- X#include <math.h>
- X
- X#define NP 4
- X
- main ()
- X{
- float xarray[NP], yarray[NP];
- int i, j;
- int angle, numhatch;
- int hatcharray[8];
- extern float rand ();
- X
- X/*
- X * Set up where you want the vplot output to go.
- X */
- X vp_filep (stdout);
- X
- X/*
- X * Decide what "style" plot this is to be.
- X */
- X vp_style (STANDARD);
- X
- X/*
- X * solid fill
- X */
- X xarray[0] = 2.;
- X yarray[0] = 2.;
- X xarray[1] = 2.;
- X yarray[1] = 6.;
- X xarray[2] = 6.;
- X yarray[2] = 6.;
- X xarray[3] = 6.;
- X yarray[3] = 2.;
- X
- X vp_color (RED);
- X vp_ufill (xarray, yarray, NP);
- X/*
- X * define a hatching pattern and fill.
- X */
- X angle = 30;
- X numhatch = 1;
- X hatcharray[0] = 1;
- X hatcharray[1] = CYAN;
- X hatcharray[2] = 0;
- X hatcharray[3] = 20;
- X hatcharray[4] = 1;
- X hatcharray[5] = WHITE;
- X hatcharray[6] = 0;
- X hatcharray[7] = 10;
- X
- X xarray[0] = 2.;
- X yarray[0] = 2.;
- X xarray[1] = 2.;
- X yarray[1] = 6.;
- X xarray[2] = 6.;
- X yarray[2] = 6.;
- X xarray[3] = 6.;
- X yarray[3] = 2.;
- X
- X vp_hatchload (angle, numhatch, CYAN, hatcharray);
- X vp_color (CYAN);
- X vp_ufill (xarray, yarray, NP);
- X
- X/*
- X * Finish up
- X */
- X vp_endplot ();
- X}
- END_OF_FILE
- if test 1816 -ne `wc -c <'Vplot_Kernel/filters/Tests/ufilltest.c'`; then
- echo shar: \"'Vplot_Kernel/filters/Tests/ufilltest.c'\" unpacked with wrong size!
- fi
- # end of 'Vplot_Kernel/filters/Tests/ufilltest.c'
- fi
- if test -f 'Vplot_Kernel/filters/loclib/bufpar.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/loclib/bufpar.c'\"
- else
- echo shar: Extracting \"'Vplot_Kernel/filters/loclib/bufpar.c'\" \(1941 characters\)
- sed "s/^X//" >'Vplot_Kernel/filters/loclib/bufpar.c' <<'END_OF_FILE'
- X/*
- X *
- X * source file: ./filters/loclib/bufpar.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X
- X/* bufpar.c: get and store getpar-style parameters from a text
- X * buffer.
- X * bufpar_scan: parse the buffer, and make a hashed list
- X * bufpar_: return a value from the list
- X * bufpar_string_store: add a {tag,value} pair to the list
- X * bufpar_free: erase the list
- X * -- c. r. karish 18 dec 1986
- X */
- X
- X#include "fastpar.h"
- X#define NULL 0
- X#define BUF_QUEUE_SIZE 127
- X#define POINTER unsigned long
- char *alloc ();
- static hash_item *buf_queue[BUF_QUEUE_SIZE];
- static int buf_queue_size = BUF_QUEUE_SIZE;
- X
- int
- bufpar_scan (strbuf, buflen, reset)
- X register char *strbuf;
- X int buflen, reset;
- X{
- char *buffer;
- register char *bptr;
- register int ii;
- X
- X /* make sure the 'queue' is clean */
- X if (reset)
- X bzero ((char *) buf_queue, BUF_QUEUE_SIZE * sizeof (POINTER));
- X
- X /* set up the input */
- X buffer = alloc (buflen + 3);
- X bptr = buffer;
- X *bptr++ = '\n';
- X for (ii = 0; ii < buflen; ii++)
- X *bptr++ = *strbuf++;
- X *bptr++ = '\n';
- X *bptr = '\0';
- X getpar_push_input (buffer, 1);
- X
- X /* scan input, and put results on 'queue' */
- X getpar_scan (buf_queue, buf_queue_size);
- X}
- X
- int
- bufpar (tag, type, val)
- X char *tag, *type;
- X MIXED val;
- X{
- X return (getpar_decode (buf_queue, buf_queue_size, tag, type, val));
- X}
- X
- bufpar_add_string (string)
- X char *string;
- X{
- X getpar_string_store (buf_queue, buf_queue_size, string);
- X}
- X
- X/* aliases: for calling from fortran */
- X
- bpscan_ (buffer)
- X char *buffer;
- X{
- X bufpar_scan (buffer);
- X}
- X
- bufpar_ (tag, type, val)
- X char *tag, *type;
- X MIXED val;
- X{
- X bufpar (tag, type, val);
- X}
- X
- bpadds_ (string)
- X char *string;
- X{
- X bufpar_add_string (string);
- X}
- END_OF_FILE
- if test 1941 -ne `wc -c <'Vplot_Kernel/filters/loclib/bufpar.c'`; then
- echo shar: \"'Vplot_Kernel/filters/loclib/bufpar.c'\" unpacked with wrong size!
- fi
- # end of 'Vplot_Kernel/filters/loclib/bufpar.c'
- fi
- if test -f 'Vplot_Kernel/filters/loclib/getpar.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/loclib/getpar.c'\"
- else
- echo shar: Extracting \"'Vplot_Kernel/filters/loclib/getpar.c'\" \(1896 characters\)
- sed "s/^X//" >'Vplot_Kernel/filters/loclib/getpar.c' <<'END_OF_FILE'
- X/*
- clayton 1981 wrote getpar
- hale 1982 ? INPAR?
- JFC 1-22-83 stdin copied to stdout and parsed first.
- ron 1-28-83 allow for multiple names of a variable
- ron 2-1-83 does not count entries where there is no
- X argument as being found
- ron 2-2-83 changed the stdin read from character by character
- X to line by line
- ron 2-4-83 altered the stdin read to not keep lines starting
- X with '#'
- JFC 2-7-83 hetch introduced
- ron 2-8-83 split up the text file of getpar and fetch
- ron 2-15-83 added count_found so that the routines in fetch and
- X getpar would use the same found.
- ron 2-23-83 added save_get and getm_getsav so that only the last
- X parameter is used.
- ron 2-25-83 fixed getpar so that it can do recursive par= in
- X par files. The limit in depth of the calls is
- X MAXPARLEVEL.
- stew 3-5-83 defined getpar() as alias for getpar_()
- stew 7-14-83 added err and perror diagnostics
- stew 9-6-87 use <varargs> for portability to Sun-4 and Cray-2
- joe 2-25-88 Make the other getpar synonyms share the same code
- X*/
- X
- X#ifndef GETPARSYNONYM
- X#define GETPARSYNONYM getpar
- X#endif GETPARSYNONYM
- X
- typedef union { int *i; float *f; double *g ; char *s; } MIXED;
- X
- X#include <varargs.h>
- X
- X/*VARARGS0*/
- int
- GETPARSYNONYM(va_alist /*name,type,ptr*/)
- va_dcl
- X{
- X char *name, *type;
- X va_list apdum;
- X int rc;
- X MIXED var;
- X extern int getch_();
- X va_start(apdum);
- X name = va_arg(apdum,char *);
- X type = va_arg(apdum,char *);
- X switch(type[0]) {
- X case 'g': var.g = va_arg(apdum,double *); break;
- X case 's': var.s = va_arg(apdum,char *); break;
- X case 'f': case 'r': var.f = va_arg(apdum,float *); break;
- X default: var.i = va_arg(apdum,int *); break;
- X }
- X va_end(apdum);
- X switch(type[0]) {
- X case 'g': rc = getch_(name,type,var.g); break;
- X case 's': rc = getch_(name,type,var.s); break;
- X case 'f': case 'r': rc = getch_(name,type,var.f); break;
- X default: rc = getch_(name,type,var.i); break;
- X }
- X return (rc);
- X}
- END_OF_FILE
- if test 1896 -ne `wc -c <'Vplot_Kernel/filters/loclib/getpar.c'`; then
- echo shar: \"'Vplot_Kernel/filters/loclib/getpar.c'\" unpacked with wrong size!
- fi
- # end of 'Vplot_Kernel/filters/loclib/getpar.c'
- fi
- if test -f 'Vplot_Kernel/filters/sample.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/sample.c'\"
- else
- echo shar: Extracting \"'Vplot_Kernel/filters/sample.c'\" \(1991 characters\)
- sed "s/^X//" >'Vplot_Kernel/filters/sample.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/sample.c
- X *
- X * Joe Dellinger (SEP), Feb 19 1988
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X#include <stdio.h>
- X/*
- X * Things we have to include
- X */
- X#include "./include/closestat.h"
- X#include "./include/extern.h"
- X
- X/*
- X * These make init_vplot happy
- X */
- extern char callname[];
- extern FILE *pltout;
- int xargc;
- char **xargv;
- X
- X/*
- X * These make dovplot happy
- X */
- extern FILE *pltin;
- extern char pltname[];
- X
- main(argc,argv)
- int argc;
- char **argv;
- X{
- X/*
- X * Copy these across so getpar has something to work with.
- X */
- xargc = argc;
- xargv = argv;
- X
- X/*
- X * Throw in dummy names just so there's something there.
- X */
- strcpy (callname, "default");
- strcpy (pltname, "Sample");
- X
- X/*
- X * Set up pltin and pltout
- X */
- pltout = stdout;
- pltin = stdin;
- X
- X/*
- X * Initialize everything
- X */
- init_vplot();
- X
- X/*
- X * Do the plot
- X */
- dovplot();
- X
- X/*
- X * Close the device
- X */
- dev.close (CLOSE_NORMAL);
- dev.close (CLOSE_DONE);
- X
- X/*
- X * The problem, of course, is that bypassing all the other routines
- X * we may be overlooking possibly vital things such as did the device
- X * need an "ERASE_END", can it use piped input, did it need the
- X * text screen turned back on, etc, etc.
- X * We also neglect to turn echoing and output translation back on
- X * (if it was turned off), etc, etc. Probably better to at least use
- X * proc_vplot, or to start by making a copy of it.
- X * But, for a specific device with known requirements this
- X * simple example shows how to use the power of dovplot without having to
- X * throw in the kitchen sink, too.
- X */
- X}
- END_OF_FILE
- if test 1991 -ne `wc -c <'Vplot_Kernel/filters/sample.c'`; then
- echo shar: \"'Vplot_Kernel/filters/sample.c'\" unpacked with wrong size!
- fi
- # end of 'Vplot_Kernel/filters/sample.c'
- fi
- if test -f 'Vplot_Kernel/filters/utilities/clip.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/utilities/clip.c'\"
- else
- echo shar: Extracting \"'Vplot_Kernel/filters/utilities/clip.c'\" \(1805 characters\)
- sed "s/^X//" >'Vplot_Kernel/filters/utilities/clip.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./filters/utilities/clip.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X/*
- X * VPLOT utility routine
- X * Cohen-Sutherland Clipping routine
- X */
- X
- extern int xwmin, xwmax, ywmin, ywmax;
- X
- X#define code(x,y) (x<xwmin?1:(x>xwmax?2:0))|(y<ywmin?4:(y>ywmax?8:0))
- X
- clip (x1, y1, x2, y2)
- X int *x1, *y1, *x2, *y2;
- X{
- register int c1, c2, temp;
- int swap;
- X c1 = code (*x1, *y1);
- X c2 = code (*x2, *y2);
- X swap = 0;
- X if (!(c1 || c2))
- X return (0); /* line completely in bounds */
- X while (c1 | c2)
- X {
- X if (c1 & c2)
- X return (1); /* line completely out of bounds */
- X if (!c1) /* interchange endpoints */
- X {
- X temp = *x1;
- X *x1 = *x2;
- X *x2 = temp;
- X temp = *y1;
- X *y1 = *y2;
- X *y2 = temp;
- X temp = c1;
- X c1 = c2;
- X c2 = temp;
- X swap = ~swap;
- X }
- X if (c1 < 4) /* move endpoint in x */
- X {
- X temp = (c1 & 2 ? xwmax : xwmin);
- X *y1 = solve (temp, *x1, *y1, *x2, *y2);
- X *x1 = temp;
- X }
- X else /* move endpoint in y */
- X {
- X temp = (c1 & 8 ? ywmax : ywmin);
- X *x1 = solve (temp, *y1, *x1, *y2, *x2);
- X *y1 = temp;
- X }
- X c1 = code (*x1, *y1);
- X }
- X if (swap) /* put endpoints in order */
- X {
- X temp = *x1;
- X *x1 = *x2;
- X *x2 = temp;
- X temp = *y1;
- X *y1 = *y2;
- X *y2 = temp;
- X }
- X return (0);
- X}
- END_OF_FILE
- if test 1805 -ne `wc -c <'Vplot_Kernel/filters/utilities/clip.c'`; then
- echo shar: \"'Vplot_Kernel/filters/utilities/clip.c'\" unpacked with wrong size!
- fi
- # end of 'Vplot_Kernel/filters/utilities/clip.c'
- fi
- if test -f 'Vplot_Kernel/lvplot/vp_area.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Vplot_Kernel/lvplot/vp_area.c'\"
- else
- echo shar: Extracting \"'Vplot_Kernel/lvplot/vp_area.c'\" \(1935 characters\)
- sed "s/^X//" >'Vplot_Kernel/lvplot/vp_area.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./lvplot/vp_area.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X * Joe Dellinger Jan 14 1988
- X * Do rounding.
- X */
- X
- X#include <stdio.h>
- X#include <vplot.h>
- X#include "round.h"
- X#include "vp_pc.h"
- X
- X#ifdef FORTRAN
- X
- X#ifndef UUU
- X#define AREA vparea_
- X#else UUU
- X#define UAREA vpuarea_
- X#endif UUU
- X#define LP *lp
- X#define FAT *fat
- X#define XMASK *xmask
- X#define YMASK *ymask
- X#define XP xp2
- X#define YP yp2
- X
- X#else
- X
- X#ifndef UUU
- X#define AREA vp_area
- X#else UUU
- X#define UAREA vp_uarea
- X#endif UUU
- X#define LP lp
- X#define FAT fat
- X#define XMASK xmask
- X#define YMASK ymask
- X#define XP xp
- X#define YP yp
- X
- X#endif
- X
- X#ifndef UUU
- AREA (xp, yp, lp, fat, xmask, ymask)
- X#else UUU
- UAREA (xp, yp, lp, fat, xmask, ymask)
- X#endif UUU
- X float *xp, *yp;
- X int LP, FAT, XMASK, YMASK;
- X{
- int i;
- int ix, iy;
- X
- X#ifdef FORTRAN
- register float *xp2, *yp2;
- X xp2 = xp;
- X yp2 = yp;
- X#endif FORTRAN
- X
- X putc (VP_OLDAREA, vp_pc._pltout);
- X puth (LP, vp_pc._pltout);
- X puth (FAT, vp_pc._pltout);
- X puth (XMASK, vp_pc._pltout);
- X puth (YMASK, vp_pc._pltout);
- X for (i = 0; i < LP; i++)
- X {
- X#ifndef UUU
- X ix = ROUND ((*XP) * RPERIN);
- X iy = ROUND ((*YP) * RPERIN);
- X#else UUU
- X ix = ROUND ((vp_pc._x0 + ((*XP) - vp_pc._xu0) * vp_pc._xscl) * RPERIN);
- X iy = ROUND ((vp_pc._y0 + ((*YP) - vp_pc._yu0) * vp_pc._yscl) * RPERIN);
- X#endif UUU
- X XP++;
- X YP++;
- X puth (ix, vp_pc._pltout);
- X puth (iy, vp_pc._pltout);
- X }
- X}
- END_OF_FILE
- if test 1935 -ne `wc -c <'Vplot_Kernel/lvplot/vp_area.c'`; then
- echo shar: \"'Vplot_Kernel/lvplot/vp_area.c'\" unpacked with wrong size!
- fi
- # end of 'Vplot_Kernel/lvplot/vp_area.c'
- fi
- if test -f 'Vplot_Kernel/lvplot/vp_pmark.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Vplot_Kernel/lvplot/vp_pmark.c'\"
- else
- echo shar: Extracting \"'Vplot_Kernel/lvplot/vp_pmark.c'\" \(1956 characters\)
- sed "s/^X//" >'Vplot_Kernel/lvplot/vp_pmark.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./lvplot/vp_pmark.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X * Joe Dellinger Jan 14 1988
- X * Do rounding.
- X */
- X
- X#include <stdio.h>
- X#include <vplot.h>
- X#include "round.h"
- X#include "vp_pc.h"
- X
- X#ifdef FORTRAN
- X
- X#ifdef UUU
- X#define PMARK vpupmark_
- X#else UUU
- X#define PMARK vppmark_
- X#endif UUU
- X#define NPTS *npts
- X#define MTYPE *mtype
- X#define MSIZE *msize
- X#define XP xp2
- X#define YP yp2
- X
- X#else
- X
- X#ifdef UUU
- X#define PMARK vp_upmark
- X#else UUU
- X#define PMARK vp_pmark
- X#endif UUU
- X#define NPTS npts
- X#define MTYPE mtype
- X#define MSIZE msize
- X#define XP xp
- X#define YP yp
- X
- X#endif
- X
- PMARK (npts, mtype, msize, xp, yp)
- X float *xp, *yp;
- X int NPTS, MTYPE, MSIZE;
- X{
- int i, ix, iy;
- X
- X#ifdef FORTRAN
- float *xp2, *yp2;
- X
- X xp2 = xp;
- X yp2 = yp;
- X#endif FORTRAN
- X
- X putc (VP_PMARK, vp_pc._pltout);
- X puth (NPTS, vp_pc._pltout);
- X puth (MTYPE, vp_pc._pltout);
- X puth (MSIZE, vp_pc._pltout);
- X
- X#ifdef UUU /* units are user units */
- X for (i = 0; i < NPTS; i++)
- X {
- X ix = ROUND ((vp_pc._x0 + ((*XP) - vp_pc._xu0) * vp_pc._xscl) * RPERIN);
- X iy = ROUND ((vp_pc._y0 + ((*YP) - vp_pc._yu0) * vp_pc._yscl) * RPERIN);
- X XP++;
- X YP++;
- X puth (ix, vp_pc._pltout);
- X puth (iy, vp_pc._pltout);
- X }
- X#else UUU /* units are inches */
- X for (i = 0; i < NPTS; i++)
- X {
- X ix = ROUND ((*XP) * RPERIN);
- X iy = ROUND ((*YP) * RPERIN);
- X XP++;
- X YP++;
- X puth (ix, vp_pc._pltout);
- X puth (iy, vp_pc._pltout);
- X }
- X#endif UUU
- X}
- END_OF_FILE
- if test 1956 -ne `wc -c <'Vplot_Kernel/lvplot/vp_pmark.c'`; then
- echo shar: \"'Vplot_Kernel/lvplot/vp_pmark.c'\" unpacked with wrong size!
- fi
- # end of 'Vplot_Kernel/lvplot/vp_pmark.c'
- fi
- if test -f 'Vplot_Kernel/lvplot/vp_ugtext.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Vplot_Kernel/lvplot/vp_ugtext.c'\"
- else
- echo shar: Extracting \"'Vplot_Kernel/lvplot/vp_ugtext.c'\" \(1987 characters\)
- sed "s/^X//" >'Vplot_Kernel/lvplot/vp_ugtext.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./lvplot/vp_ugtext.c
- X *
- X * Joe Dellinger (SEP), Jan 14 1988
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X#include <stdio.h>
- X#include <vplot.h>
- X#include "vp_pc.h"
- X
- X#ifdef FORTRAN
- X
- X#define UTEXT vpwugtext_
- X#define TEXT vpwgtext_
- X#define X *x
- X#define Y *y
- X#define XP &xp
- X#define YP &yp
- X#define XPATH *xpath
- X#define YPATH *ypath
- X#define XPATHP &xpathp
- X#define YPATHP &ypathp
- X#define XUP *xup
- X#define YUP *yup
- X#define XUPP &xupp
- X#define YUPP &yupp
- X
- X#else
- X
- X#define UTEXT vp_ugtext
- X#define TEXT vp_gtext
- X#define X x
- X#define Y y
- X#define XP xp
- X#define YP yp
- X#define XPATH xpath
- X#define YPATH ypath
- X#define XPATHP xpathp
- X#define YPATHP ypathp
- X#define XUP xup
- X#define YUP yup
- X#define XUPP xupp
- X#define YUPP yupp
- X
- X#endif
- X
- X#ifdef FORTRAN
- UTEXT (x, y, xpath, ypath, xup, yup, string, nchars)
- X#else
- UTEXT (x, y, xpath, ypath, xup, yup, string)
- X#endif
- X float X, Y;
- X float XPATH, YPATH;
- X float XUP, YUP;
- X char *string;
- X#ifdef FORTRAN
- X int *nchars;
- X#endif
- X{
- float xp, yp;
- float xpathp, ypathp;
- float xupp, yupp;
- X
- X xp = vp_pc._x0 + (X - vp_pc._xu0) * vp_pc._xscl;
- X yp = vp_pc._y0 + (Y - vp_pc._yu0) * vp_pc._yscl;
- X xpathp = XPATH * vp_pc._xscl;
- X ypathp = YPATH * vp_pc._yscl;
- X xupp = XUP * vp_pc._xscl;
- X yupp = YUP * vp_pc._yscl;
- X
- X#ifdef FORTRAN
- X TEXT (XP, YP, XPATHP, YPATHP, XUPP, YUPP, string, nchars);
- X#else
- X TEXT (XP, YP, XPATHP, YPATHP, XUPP, YUPP, string);
- X#endif
- X}
- END_OF_FILE
- if test 1987 -ne `wc -c <'Vplot_Kernel/lvplot/vp_ugtext.c'`; then
- echo shar: \"'Vplot_Kernel/lvplot/vp_ugtext.c'\" unpacked with wrong size!
- fi
- # end of 'Vplot_Kernel/lvplot/vp_ugtext.c'
- fi
- if test -f 'Vplot_Kernel/lvplot/vp_unit.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Vplot_Kernel/lvplot/vp_unit.c'\"
- else
- echo shar: Extracting \"'Vplot_Kernel/lvplot/vp_unit.c'\" \(2008 characters\)
- sed "s/^X//" >'Vplot_Kernel/lvplot/vp_unit.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./lvplot/vp_unit.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X/*
- X * Joe Dellinger Oct 19, 1987 (Monday Massacre)
- X * Put in ifdef's for 4.2 VS 4.3.
- X * Somebody should volunteer to re-write this routine in FORTRAN.
- X * Phil Farrell 31 Dec 1987
- X * changed 4.3 ifdef identfier from "4.3BSD", which is illegal in
- X * C because it contains a period and numerals, to FOURTHREEBSD
- X */
- X
- X#ifdef FORTRAN
- X#include <stdio.h>
- X#include <vplot.h>
- X#include "vp_pc.h"
- X
- X/*
- X * fortran logical unit table definitions
- X */
- typedef long ftnint;
- typedef ftnint flag;
- X
- typedef struct /*units*/
- X{
- X FILE *ufd;/*0=unconnected*/
- X char *ufnm;
- X long uinode;
- X int url;/*0=sequential*/
- X flag useek; /*true=can backspace, use dir, ...*/
- X flag ufmt;
- X flag uprnt;
- X flag ublnk;
- X flag uend;
- X flag uwrt; /*last io was write*/
- X flag uscrtch;
- X} unit;
- X
- extern unit units[];/*logical units table*/
- vpunit_ (lunit)
- X long *lunit;
- X{
- FILE *fileptr;
- unit *uptr;
- X
- X uptr = units + (*lunit);
- X fileptr = uptr->ufd;
- X/*
- X * A low-level routine from the fortran compiler library is called
- X * here to determine if file is accessed. This routine has a different
- X * name under 4.2BSD than 4.3BSD.
- X */
- X#ifdef FOURTHREEBSD
- X nowwriting (uptr);
- X#else
- X now_acc (uptr, "a");
- X#endif
- X vp_pc._pltout = fileptr;
- X}
- X#endif
- END_OF_FILE
- if test 2008 -ne `wc -c <'Vplot_Kernel/lvplot/vp_unit.c'`; then
- echo shar: \"'Vplot_Kernel/lvplot/vp_unit.c'\" unpacked with wrong size!
- fi
- # end of 'Vplot_Kernel/lvplot/vp_unit.c'
- fi
- if test -f 'Vplot_Kernel/lvplot/vp_uraster.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Vplot_Kernel/lvplot/vp_uraster.c'\"
- else
- echo shar: Extracting \"'Vplot_Kernel/lvplot/vp_uraster.c'\" \(1985 characters\)
- sed "s/^X//" >'Vplot_Kernel/lvplot/vp_uraster.c' <<'END_OF_FILE'
- X/*
- X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
- X * University. Official permission to use this software is included in
- X * the documentation. It authorizes you to use this file for any
- X * non-commercial purpose, provided that this copyright notice is not
- X * removed and that any modifications made to this file are commented
- X * and dated in the style of my example below.
- X */
- X
- X/*
- X *
- X * source file: ./lvplot/vp_uraster.c
- X *
- X * Joe Dellinger (SEP), June 11 1987
- X * Inserted this sample edit history entry.
- X * Please log any further modifications made to this file:
- X */
- X
- X#include <stdio.h>
- X#include <vplot.h>
- X#include "vp_pc.h"
- X
- X#ifdef FORTRAN
- X
- X#define RASTER vpraster_
- X#define URASTER vpuraster_
- X#define XLL *xll
- X#define YLL *yll
- X#define XPIX *xpix
- X#define YPIX *ypix
- X#define PPI *ppi
- X#define BIT *bit
- X#define OFFSET *offset
- X#define BLAST *blast
- X#define ORIENT *orient
- X#define INVERT *invert
- X
- X#else
- X
- X#define RASTER vp_raster
- X#define URASTER vp_uraster
- X#define XLL xll
- X#define YLL yll
- X#define XPIX xpix
- X#define YPIX ypix
- X#define PPI ppi
- X#define BIT bit
- X#define OFFSET offset
- X#define BLAST blast
- X#define ORIENT orient
- X#define INVERT invert
- X
- X#endif
- X
- URASTER (array, blast, bit, offset, xpix, ypix, xll, yll, ppi, xur, yur, orient, invert)
- X unsigned char *array;
- X float XLL, YLL, *xur, *yur, PPI;
- X int XPIX, YPIX, BIT, OFFSET, BLAST, ORIENT, INVERT;
- X{
- float x1, y1, x2, y2;
- X
- X x1 = vp_pc._x0 + (XLL - vp_pc._xu0) * vp_pc._xscl;
- X y1 = vp_pc._y0 + (YLL - vp_pc._yu0) * vp_pc._yscl;
- X
- X if (PPI == 0.)
- X {
- X x2 = vp_pc._x0 + (*xur - vp_pc._xu0) * vp_pc._xscl;
- X y2 = vp_pc._y0 + (*yur - vp_pc._yu0) * vp_pc._yscl;
- X }
- X
- X RASTER (array, BLAST, BIT, OFFSET, XPIX, YPIX, x1, y1, PPI, &x2, &y2, ORIENT, INVERT);
- X
- X if (PPI != 0. && vp_pc._xscl != 0. && vp_pc._yscl != 0.)
- X {
- X *xur = (x2 - vp_pc._x0) / vp_pc._xscl + vp_pc._xu0;
- X *yur = (y2 - vp_pc._y0) / vp_pc._yscl + vp_pc._yu0;
- X }
- X}
- END_OF_FILE
- if test 1985 -ne `wc -c <'Vplot_Kernel/lvplot/vp_uraster.c'`; then
- echo shar: \"'Vplot_Kernel/lvplot/vp_uraster.c'\" unpacked with wrong size!
- fi
- # end of 'Vplot_Kernel/lvplot/vp_uraster.c'
- fi
- echo shar: End of archive 8 \(of 24\).
- cp /dev/null ark8isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 24 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-