home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
misc
/
volume24
/
gnuplot3
/
part19
< prev
next >
Wrap
Text File
|
1991-10-27
|
49KB
|
1,729 lines
Newsgroups: comp.sources.misc
From: gershon%gr@cs.utah.edu (Elber Gershon)
Subject: v24i041: gnuplot3 - interactive function plotting utility, Part19/26
Message-ID: <1991Oct28.002356.12670@sparky.imd.sterling.com>
X-Md4-Signature: be5330d9be4344824f9193dd4c28c6ed
Date: Mon, 28 Oct 1991 00:23:56 GMT
Approved: kent@sparky.imd.sterling.com
Submitted-by: gershon%gr@cs.utah.edu (Elber Gershon)
Posting-number: Volume 24, Issue 41
Archive-name: gnuplot3/part19
Environment: UNIX, MS-DOS, VMS
Supersedes: gnuplot2: Volume 11, Issue 65-79
#!/bin/sh
# this is Part.19 (part 19 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/term/unixplot.trm continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 19; then
echo Please unpack part "$Scheck" next!
exit 1
else
exit 0
fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping gnuplot/term/unixplot.trm'
else
echo 'x - continuing file gnuplot/term/unixplot.trm'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term/unixplot.trm' &&
{
static char *lt[2+5] = {"solid", "longdashed", "solid", "dotted","shortdashed",
X "dotdashed", "longdashed"};
X
X if (linetype >= 5)
X linetype %= 5;
X linemod(lt[linetype+2]);
}
X
X
UP_move(x,y)
unsigned int x,y;
{
X move(x,y);
}
X
X
UP_vector(x,y)
unsigned int x,y;
{
X cont(x,y);
}
X
X
UP_put_text(x,y,str)
unsigned int x,y;
char str[];
{
X UP_move(x+UP_HCHAR/2,y+UP_VCHAR/5);
X label(str);
}
X
UP_reset()
{
X closepl();
}
X
SHAR_EOF
echo 'File gnuplot/term/unixplot.trm is complete' &&
chmod 0666 gnuplot/term/unixplot.trm ||
echo 'restore of gnuplot/term/unixplot.trm failed'
Wc_c="`wc -c < 'gnuplot/term/unixplot.trm'`"
test 1929 -eq "$Wc_c" ||
echo 'gnuplot/term/unixplot.trm: original size 1929, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/v384.trm ==============
if test -f 'gnuplot/term/v384.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/v384.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/v384.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/v384.trm' &&
/* GNUPLOT - v384.trm */
/*
X * Copyright (C) 1990
X *
X * Permission to use, copy, and distribute this software and its
X * documentation for any purpose with or without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and
X * that both that copyright notice and this permission notice appear
X * in supporting documentation.
X *
X * Permission to modify the software is granted, but not the right to
X * distribute the modified code. Modifications are to be distributed
X * as patches to released version.
X *
X * This software is provided "as is" without express or implied warranty.
X *
X * This file is included by ../term.c.
X *
X * This terminal driver supports:
X * Vectrix 384 - works with tandy color printer as well
X *
X * AUTHORS
X * roland@moncskermit.OZ (Roland Yap)
X *
X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
X *
X */
X
/*
X * Vectrix 384 driver - works with tandy color printer as well
X * in reverse printing 8 color mode.
X * This doesn't work on Vectrix 128 because it redefines the
X * color table. It can be hacked to work on the 128 by changing
X * the colours but then it will probably not print best. The color
X * table is purposely designed so that it will print well
X *
X */
X
#define V384_XMAX 630
#define V384_YMAX 480
X
#define V384_XLAST (V384_XMAX - 1)
#define V384_YLAST (V384_YMAX - 1)
X
#define V384_VCHAR 12
#define V384_HCHAR 7
#define V384_VTIC 8
#define V384_HTIC 7
X
X
V384_init()
{
X fprintf(outfile,"%c%c G0 \n",27,18);
X fprintf(outfile,"Q 0 8\n");
X fprintf(outfile,"0 0 0\n");
X fprintf(outfile,"255 0 0\n");
X fprintf(outfile,"0 255 0\n");
X fprintf(outfile,"0 0 255\n");
X fprintf(outfile,"0 255 255\n");
X fprintf(outfile,"255 0 255\n");
X fprintf(outfile,"255 255 0\n");
X fprintf(outfile,"255 255 255\n");
}
X
X
V384_graphics()
{
X fprintf(outfile,"%c%c E0 RE N 65535\n",27,18);
}
X
X
V384_text()
{
X fprintf(outfile,"%c%c\n",27,17);
}
X
X
V384_linetype(linetype)
int linetype;
{
static int color[]= {
X 1 /* red */,
X 2 /* green */,
X 3 /* blue */,
X 4 /* cyan */,
X 5 /* magenta */,
X 6 /* yellow */, /* not a good color so not in use at the moment */
X 7 /* white */
X };
X
X if (linetype < 0)
X linetype=6;
X else
X linetype %= 5;
X fprintf(outfile,"C %d\n",color[linetype]);
}
X
X
V384_move(x,y)
unsigned int x,y;
{
X fprintf(outfile,"M %d %d\n",x+20,y);
}
X
X
V384_vector(x,y)
unsigned int x,y;
{
X fprintf(outfile,"L %d %d\n",x+20,y);
}
X
X
V384_put_text (x, y, str)
unsigned int x, y;
char str[];
{
X V384_move (x, y + V384_VCHAR/2);
X fprintf (outfile, "$%s\n", str);
}
X
X
V384_reset()
{
}
X
SHAR_EOF
chmod 0666 gnuplot/term/v384.trm ||
echo 'restore of gnuplot/term/v384.trm failed'
Wc_c="`wc -c < 'gnuplot/term/v384.trm'`"
test 2579 -eq "$Wc_c" ||
echo 'gnuplot/term/v384.trm: original size 2579, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/vws.trm ==============
if test -f 'gnuplot/term/vws.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/vws.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/vws.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/vws.trm' &&
/* GNUPLOT - vws.trm */
/*
X * Copyright (C) 1990
X *
X * Permission to use, copy, and distribute this software and its
X * documentation for any purpose with or without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and
X * that both that copyright notice and this permission notice appear
X * in supporting documentation.
X *
X * Permission to modify the software is granted, but not the right to
X * distribute the modified code. Modifications are to be distributed
X * as patches to released version.
X *
X * This software is provided "as is" without express or implied warranty.
X *
X * This file is included by ../term.c.
X *
X * This terminal driver supports:
X * IRIS terminals
X *
X * AUTHORS
X * Walter Speth
X * BITNET: SPETH@DBNPIB5
X *
X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
X *
X */
X
#define VWS_XMAX 1024
#define VWS_YMAX 780
#define VWS_VCHAR 25
#define VWS_HCHAR 15
#define VWS_VTIC 10
#define VWS_HTIC 10
X
#include stdio
/*
#include math
#include ssdef
*/
#include descrip
X
#include <uisentry.h>
#include <uisusrdef.h>
X
X
#define DEFAULT_ATTR 0
#define OVER_ATTR 1
#define ERAS_ATTR 2
#define BIS_ATTR 3
#define COLOR_ATTR 4
#define TEXT_ATTR 5
#define LINE_ATTR 6
#define BACK_ATTR 7
X
X
float current_x, current_y;
X
X
int vd_id, wd_id;
int vcm_id;
X
static $DESCRIPTOR(ws_devname, "SYS$WORKSTATION");
static $DESCRIPTOR(vd_title, "gnuplot");
X
static float x0, y0, xsiz, ysiz,
X wc_xmin_new, wc_ymin_new, wc_xmax_new, wc_ymax_new,
X wc_xmin, wc_ymin, wc_xmax, wc_ymax,
X vd_width, vd_height;
X
VWS_resize_ast()
{ uis$resize_window(&vd_id, &wd_id, &x0, &y0, &xsiz, &ysiz,
X &wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax);
X replotrequest();
}
/****************************************************************************/
VWS_init()
X
X
{
X int i;
X int cattr;
X $DESCRIPTOR(a_font,"DTABER0003WK00PG0001UZZZZ02A000");
X
X vd_width = 14;
X vd_height = 10; /* aspect sqrt(2) as DIN A paper */
X
X wc_xmin = 0.0;
X wc_ymin = 0.0;
X wc_xmax = (float) VWS_XMAX;
X wc_ymax = (float) VWS_YMAX;
X
X vcm_id = uis$create_color_map(&8);
X
X vd_id = uis$create_display(&wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax,
X &vd_width, &vd_height, &vcm_id);
X
X uis$set_color(&vd_id, &0, &.5, &.5, &.5);
X uis$set_color(&vd_id, &1, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &2, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &3, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &4, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &5, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &6, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &7, &0.0, &0.0, &0.0);
X
/*
X uis$set_color(&vd_id, &2, &.2, &.2, &.2);
X uis$set_color(&vd_id, &3, &.3, &.3, &.3);
X uis$set_color(&vd_id, &4, &.4, &.4, &.4);
X uis$set_color(&vd_id, &5, &.5, &.5, &.5);
X uis$set_color(&vd_id, &6, &.6, &.6, &.6);
X uis$set_color(&vd_id, &7, &.7, &.7, &.7);
X
/* perhaps better for color terms (which I do not have)
X uis$set_color(&vd_id, &0, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &1, &0.9, &0.0, &0.0);
X uis$set_color(&vd_id, &2, &0.0, &0.9, &0.0);
X uis$set_color(&vd_id, &3, &0.9, &0.9, &0.0);
X uis$set_color(&vd_id, &4, &0.0, &0.0, &0.9);
X uis$set_color(&vd_id, &5, &0.9, &0.0, &0.9);
X uis$set_color(&vd_id, &6, &0.0, &0.9, &0.9);
X uis$set_color(&vd_id, &7, &0.9, &0.9, &0.9);
/*
*/
X uis$disable_display_list(&vd_id);
X
X wd_id = uis$create_window(&vd_id, &ws_devname, &vd_title,
X &wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax,
X &vd_width, &vd_height);
X
X uis$set_resize_ast(&vd_id, &wd_id, &VWS_resize_ast, &0,
X &x0, &y0, &xsiz, &ysiz,
X &wc_xmin_new, &wc_ymin_new, &wc_xmax_new, &wc_ymax_new);
X
X uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &OVER_ATTR, &UIS$C_MODE_OVER);
X uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &ERAS_ATTR, &UIS$C_MODE_ERAS);
X uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &BIS_ATTR, &UIS$C_MODE_BIS);
/*
X for (i=0; i<8; i++) {
X cattr = COLOR_ATTR+i;
X uis$set_writing_index(&vd_id, ©_ATTR, &cattr, &i);
X }
*/
X uis$set_background_index(&vd_id, &DEFAULT_ATTR, &BACK_ATTR, &0);
X uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &TEXT_ATTR, &UIS$C_MODE_OVER);
X uis$set_font(&vd_id,&TEXT_ATTR,&TEXT_ATTR,&a_font);
X uis$set_char_size(&vd_id,&TEXT_ATTR,&TEXT_ATTR,&0,
X &(float)VWS_HCHAR,&(float)VWS_VCHAR);
X uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
}
X
/****************************************************************************/
X
VWS_reset()
{
X uis$delete_display(&vd_id);
}
/****************************************************************************/
VWS_scale(xs,ys)
int xs,ys;
{
X return FALSE;
}
/****************************************************************************/
VWS_graphics()
{
X uis$erase(&vd_id, &wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax);
}
/****************************************************************************/
VWS_text()
{
}
/****************************************************************************/
VWS_move(x,y)
int x,y;
{
X current_x= (float)(x);
X current_y= (float)(y);
}
/****************************************************************************/
VWS_vector(x,y)
int x,y;
{ int col;
X float fx,fy;
X fx=(float) x;
X fy=(float) y;
X
X uis$line(&vd_id, &LINE_ATTR,
X ¤t_x, ¤t_y, &fx, &fy);
X VWS_move (x,y);
}
/****************************************************************************/
VWS_linetype(lt)
int lt;
{
long int lstyle[9]={ 0xffffffff,
X 0Xff00ff00,
X 0xffffff00,
X 0xffff0000,
X 0xf0f0f0f0,
X 0Xfff0fff0,
X 0xf000f000,
X 0xa5a5a5af,
X 0xf00f00f0 };
X
X switch(lt) {
case -1: uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
X uis$set_line_width(&vd_id,&LINE_ATTR,&LINE_ATTR,&1.5);
X break;
case -2: uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
X uis$set_line_width(&vd_id,&LINE_ATTR,&LINE_ATTR,&2.0);
X break;
/*
default: uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&lstyle[lt % 8]);
X makes part of curve disappear on my workstation
*/
default: uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
X uis$set_line_width(&vd_id,&LINE_ATTR,&LINE_ATTR,&1.0);
}
}
X
/****************************************************************************/
static int justify_mode =CENTRE,up;;
X
VWS_put_text(x,y,str)
int x,y; char* str;
{
X float fx,fy, thih, twid;
X
X
/* uis$text parameter is descriptor string not character string */
X
X struct dsc$descriptor_s textline = {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,""};
X
X
X textline.dsc$a_pointer = str;
X textline.dsc$w_length = strlen(textline.dsc$a_pointer);
X uis$measure_text(&vd_id,&TEXT_ATTR,&textline,&twid,&thih);
X fx=(float)x;
X fy=(float)y;
X
X switch (justify_mode) {
X case LEFT : fy+=thih/2.;
X break;
X case RIGHT : fy+=thih/2.;
X fx-=twid;
X break;
X
X case CENTRE : fy+=thih/2.;
X fx-=twid/2;
X break;
X };
X
X uis$text(&vd_id,&TEXT_ATTR,&textline,&fx,&fy);
X /* write to Example Viewport window */
X
X
}
/****************************************************************************/
VWS_text_angle(ang)
int ang;
{
X float degrees;
X degrees=90.*(up=ang);
X uis$set_text_slope (&vd_id, &TEXT_ATTR, &TEXT_ATTR, °rees);
return TRUE;
}
/****************************************************************************/
VWS_justify_text(mode)
int mode;
{ justify_mode=mode;
return TRUE;
}
/****************************************************************************/
VWS_point(x,y,point)
int x,y,point;
{
do_point(x,y,point);
}
/****************************************************************************/
VWS_arrow(sx,sy,ex,ey)
int sx,sy,ex,ey;
{
do_arrow(sx,sy,ex,ey);
}
SHAR_EOF
chmod 0644 gnuplot/term/vws.trm ||
echo 'restore of gnuplot/term/vws.trm failed'
Wc_c="`wc -c < 'gnuplot/term/vws.trm'`"
test 8014 -eq "$Wc_c" ||
echo 'gnuplot/term/vws.trm: original size 8014, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/x11.trm ==============
if test -f 'gnuplot/term/x11.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/x11.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/x11.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/x11.trm' &&
/*
X * x11.trm --- inboard terminal driver for X11
X */
X
#define X11_XMAX 4096
#define X11_YMAX 4096
X
/* approximations for typical font/screen sizes */
#define X11_VCHAR (X11_YMAX/25)
#define X11_HCHAR (X11_XMAX/100)
#define X11_VTIC (X11_YMAX/100)
#define X11_HTIC (X11_XMAX/150)
X
#define X11_nopts 22
char X11_opts[X11_nopts][20] = {
X "-iconic", "-rv", "-reverse", "+rv", "-synchronous",
X "-display", "-geometry", "-bg", "-background", "-bd", "-bordercolor", "-bw",
X "-borderwidth", "-fg", "-foreground", "-fn", "-font", "-name",
X "-selectionTimeout", "-title", "-xnllanguage", "-xrm"
X };
int X11_optarg[X11_nopts] = {
X 0, 0, 0, 0, 0,
X 1, 1, 1, 1, 1, 1, 1,
X 1, 1, 1, 1, 1, 1,
X 1, 1, 1, 1
X };
X
FILE *X11_pipe, *popen();
char X11_command[1024]= "gnuplot_x11 -name gnuplot";
X
X
/* X11_args - scan gnuplot command line for standard X Toolkit options */
X
XX11_args(argc, argv) int argc; char *argv[]; {
X int nx11 = 0, n;
X
X while(++argv, --argc > 0) {
X for (n=0; n<X11_nopts; n++) {
X if (!strcmp(*argv, X11_opts[n])) {
X strcat(X11_command, " ");
X strcat(X11_command, *argv);
X if (X11_optarg[n]) {
X if (--argc <= 0) return(nx11);
X strcat(X11_command, " \"");
X strcat(X11_command, *++argv);
X strcat(X11_command, "\"");
X nx11++;
X }
X nx11++; break;
X }
X }
X if (n == X11_nopts) break;
X }
X return(nx11);
X }
X
#ifdef ULTRIX_KLUDGE
#define X11_ULTRIX_KLUDGE fprintf (X11_pipe, "E\n"); fflush (X11_pipe);
#else
#define X11_ULTRIX_KLUDGE
#endif
X
XX11_init() { X11_pipe = popen(X11_command, "w"); }
X
XX11_reset() { fprintf(X11_pipe, "R\n"); fflush(X11_pipe); pclose(X11_pipe); }
X
XX11_text() { fprintf(X11_pipe, "E\n"); fflush(X11_pipe); X11_ULTRIX_KLUDGE }
X
XX11_graphics() { fprintf(X11_pipe, "G\n"); }
X
XX11_move(x,y) unsigned int x,y; { fprintf(X11_pipe, "M%04d%04d\n", x, y); }
X
XX11_vector(x,y) unsigned int x,y; { fprintf(X11_pipe, "V%04d%04d\n", x, y); }
X
XX11_linetype(lt) int lt; { fprintf(X11_pipe, "L%04d\n", lt); }
X
XX11_put_text(x,y,str) unsigned int x,y; char str[]; {
X fprintf(X11_pipe, "T%04d%04d%s\n", x, y, str);
X }
XX11_justify_text(mode) enum JUSTIFY mode; {
X fprintf(X11_pipe, "J%04d\n", mode);
X return(TRUE);
X }
SHAR_EOF
chmod 0644 gnuplot/term/x11.trm ||
echo 'restore of gnuplot/term/x11.trm failed'
Wc_c="`wc -c < 'gnuplot/term/x11.trm'`"
test 2240 -eq "$Wc_c" ||
echo 'gnuplot/term/x11.trm: original size 2240, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/gpr.trm ==============
if test -f 'gnuplot/term/gpr.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/gpr.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/gpr.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/gpr.trm' &&
/* GNUPLOT - gpr.trm */
/*
X * Copyright (C) 1990
X *
X * Permission to use, copy, and distribute this software and its
X * documentation for any purpose with or without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and
X * that both that copyright notice and this permission notice appear
X * in supporting documentation.
X *
X * Permission to modify the software is granted, but not the right to
X * distribute the modified code. Modifications are to be distributed
X * as patches to released version.
X *
X * This software is provided "as is" without express or implied warranty.
X *
X * This file is included by ../term.c.
X *
X * This terminal driver supports:
X * APOLLO's GPR windowing system
X *
X * AUTHORS
X * Michael Aramini
X * Roque D Oliveira , oliveria@caen.engin.umich.edu
X *
X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
X *
X */
#include <apollo/base.h>
#include <apollo/error.h>
#include <apollo/gpr.h>
#include <apollo/pad.h>
/* landscape window */
/*
#define GPR_XMAX 720
#define GPR_YMAX 450
*/
/* portrait window */
#define GPR_XMAX 585
#define GPR_YMAX 735
X
#define GPR_XLAST (GPR_XMAX - 1)
#define GPR_YLAST (GPR_YMAX - 1)
X
#define GPR_VCHAR 19
#define GPR_HCHAR 10
#define GPR_VTIC (GPR_YMAX/80)
#define GPR_HTIC (GPR_XMAX/80)
X
gpr_$direction_t gpr_path=gpr_$right;
int gpr_ang=0; /* text angle, 0=horizontal, 1=vertical */
enum JUSTIFY gpr_justify=LEFT; /* text is flush left */
X
static status_$t status;
unsigned int DEBUG = 0; /* set it to 1 when debugging program */
X
X
static void check(messagex)
char *messagex;
{
X if (status.all = status_$ok)
X {
X error_$print(status);
X printf("Error occurred while %s.\n", messagex);
X }
}
X
/* return whether stdout is a DM pad . Called by term.c */
gpr_isa_pad()
{
X pad_$isa(1, &status);
X return (status.all == status_$ok);
}
X
X
GPR_init()
{
X gpr_$offset_t dm_bitmap_size;
X gpr_$bitmap_desc_t dm_bitmap_desc;
X pad_$window_desc_t window;
X short font_id;
X stream_$id_t stream_id;
X static gpr_$rgb_plane_t hi_plane;
X static gpr_$disp_char_t display_characteristics;
X static float screen_size_r_width,screen_size_r_height ;
X static short int disp_len = sizeof(gpr_$disp_char_t);
X static short int disp_len_returned;
X
X
X /* open a pad to do graphics in */
X window.top = 0;
X window.left = 0;
X window.width = GPR_XMAX + 10; /* 10 accounts for width of window border */
X window.height = GPR_YMAX + 35; /* 35 accounts for height of window border */
X pad_$create_window("",(short)0,pad_$transcript,(short)1,window,&stream_id,&status);
X check("pad_$create_window");
X
/* pad_$set_full_window(stream_id,(short) 1,&window, &status); */
/* pad_$set_border (stream_id,(short) 1, true, &status); */
X pad_$set_scale (stream_id,(short) 1,(short) 1, &status);
X pad_$set_auto_close(stream_id, (short) 1, true, &status );
X
X gpr_$inq_disp_characteristics(gpr_$direct,stream_id,disp_len,&display_characteristics,&disp_len_returned,&status);
X check("in gpr_$inq_display_characteristics");
X screen_size_r_width = (float) display_characteristics.x_window_size; /*x_window_size in pixels */
X screen_size_r_height = (float) display_characteristics.y_window_size; /*y_window_size in pixels */
X hi_plane = display_characteristics.n_planes - 1;
X if(DEBUG) printf("width=%f height=%f \n",screen_size_r_width,screen_size_r_height);
X
X dm_bitmap_size.x_size = 1280;
X dm_bitmap_size.y_size = 1024;
X gpr_$init(gpr_$direct,stream_id,dm_bitmap_size,hi_plane,&dm_bitmap_desc,&status);
X check("in gpr_$init");
/*
X gpr_$set_obscured_opt(gpr_$pop_if_obs, &status);
X check("in gpr_$set_obscured_opt");
*/
X gpr_$set_auto_refresh(true, &status);
X check("in gpr_$set_auto_refresh");
X
X /* load a font and make it current */
X gpr_$load_font_file("f7x13", 5, &font_id, &status);
X check("in gpr_$load_font_file");
X gpr_$set_text_font(font_id, &status);
X check("in gpr_$set_text_font");
X
X /* set up color values */
X gpr_$set_draw_value((gpr_$pixel_value_t)7, &status); /* white */
X check("in gpr_set_draw_value");
X gpr_$set_text_background_value((gpr_$pixel_value_t)(-1), &status); /* trans */
X check("in gpr_$set_text_background_value");
X gpr_$set_text_value((gpr_$pixel_value_t)7, &status); /* white */
X check("in gpr_$set_text_value");
}
X
X
GPR_graphics()
{
X gpr_$coordinate_t locx,locy,marker_size;
X
X (void) gpr_$acquire_display(&status);
X check("in gpr_$acquire display");
X gpr_$clear((gpr_$pixel_value_t)0, &status); /* black */
X check("in gpr_$clear");
X
X if(DEBUG)
X {
X marker_size = (short) 10;
X
X locx = (short) 5;
X locy = (short) 5;
X gpr_$set_draw_value((gpr_$pixel_value_t)2, &status); /* white */
X gpr_$move( (locx - marker_size/2) ,locy,&status);
X gpr_$line( (locx + marker_size/2) ,locy,&status);
X gpr_$move( locx, (locy + marker_size/2),&status);
X gpr_$line( locx, (locy - marker_size/2),&status);
X
X locx = (short) (GPR_XMAX -1 - 5);
X locy = (short) 5;
X gpr_$set_draw_value((gpr_$pixel_value_t)3, &status); /* white */
X gpr_$move( (locx - marker_size/2) ,locy,&status);
X gpr_$line( (locx + marker_size/2) ,locy,&status);
X gpr_$move( locx, (locy + marker_size/2),&status);
X gpr_$line( locx, (locy - marker_size/2),&status);
X
X locx = (short) 5;
X locy = (short) (GPR_YMAX -1 - 5);
X gpr_$set_draw_value((gpr_$pixel_value_t)4, &status); /* white */
X gpr_$move( (locx - marker_size/2) ,locy,&status);
X gpr_$line( (locx + marker_size/2) ,locy,&status);
X gpr_$move( locx, (locy + marker_size/2),&status);
X gpr_$line( locx, (locy - marker_size/2),&status);
X
X locx = (short) (GPR_XMAX -1 - 5);
X locy = (short) (GPR_YMAX -1 - 5);
X gpr_$set_draw_value((gpr_$pixel_value_t)5, &status); /* white */
X gpr_$move( (locx - marker_size/2) ,locy,&status);
X gpr_$line( (locx + marker_size/2) ,locy,&status);
X gpr_$move( locx, (locy + marker_size/2),&status);
X gpr_$line( locx, (locy - marker_size/2),&status);
X
X gpr_$set_draw_value((gpr_$pixel_value_t)7, &status); /* white */
X check("in gpr_$set_draw_value");
X } /* end if(DEBUG) */
X
}
X
X
GPR_text()
{
X gpr_$release_display(&status);
X check("gpr_$release_display");
}
X
X
GPRold_linetype(linetype)
int linetype;
{
X static gpr_$line_pattern_t patterns[2+5] = {
X { 0xFFFF }, /* solid 1111111111111111 */
X { 0x3FFF }, /* very long dashed 0011111111111111 */
X { 0xFFFF }, /* solid 1111111111111111 */
X { 0x5555 }, /* dotted 0101010101010101 */
X { 0x3333 }, /* short dashed 0011001100110011 */
X { 0xB5AD }, /* dot short-dashed 1011010110101101 */
X { 0x3FFF } /* very long dashed 0011111111111111 */
X };
X if (linetype >= 5) linetype %= 5;
X gpr_$set_line_pattern((short)1, patterns[linetype+2], (short)16, &status);
X check("in gpr_$set_line_pattern");
}
X
GPR_linetype(linetype)
int linetype;
{
X static gpr_$line_pattern_t patterns[2+7] = {
X { 0xFFFF }, /* solid 1111111111111111 */
X { 0x1111 }, /* long-spaced dotted 0001000100010001 */
X { 0xFFFF }, /* solid 1111111111111111 */
X { 0x5555 }, /* dotted 0101010101010101 */
X { 0x3333 }, /* short dashed 0011001100110011 */
X { 0x7777 }, /* medium dashed 0111011101110111 */
X { 0x3F3F }, /* long dashed 0011111100111111 */
X { 0x0F0F }, /* long-spaced dashed 0000111100001111 */
X { 0x5F5F } /* dot dashed 0101111101011111 */
X };
X if (linetype >= 7) linetype %= 7;
X gpr_$set_line_pattern((short)1, patterns[linetype+2], (short)16, &status);
X check("in gpr_$set_line_pattern");
X
/*
X gpr_$set_draw_value((gpr_$pixel_value_t)(linetype + 1), &status);
X check("in gpr_$set_draw_value");
*/
}
X
X
GPR_move(x, y)
unsigned int x, y;
{
X gpr_$move((short)x, (short)(GPR_YMAX -1 - y), &status);
X check("in gpr_$move");
}
X
X
GPR_vector(x, y)
unsigned int x, y;
{
X gpr_$line((short)x, (short)(GPR_YMAX -1 - y), &status);
X check("in gpr_$line");
}
X
X
GPR_put_text(x,y,str)
unsigned int x,y; /* reference point of string */
char str[]; /* the text */
{
X gpr_$coordinate_t xgpr,ygpr;
X gpr_$offset_t str_size_in_pixels;
X short int str_len;
X
X gpr_$coordinate_t locx,locy,marker_size;
X
X if(DEBUG)
X {
X locx = (short) x;
X locy = (short) (GPR_YMAX -1 - y);
X marker_size = (short) 20;
X gpr_$set_draw_value((gpr_$pixel_value_t)1, &status); /* white */
X gpr_$move( (locx - marker_size/2) ,locy,&status);
X gpr_$line( (locx + marker_size/2) ,locy,&status);
X gpr_$move( locx, (locy + marker_size/2),&status);
X gpr_$line( locx, (locy - marker_size/2),&status);
X gpr_$set_draw_value((gpr_$pixel_value_t)7, &status); /* white */
X }
X
X xgpr = (short) x;
X ygpr = (short) (GPR_YMAX -1 - y);
X gpr_$set_text_path(gpr_path, &status);
X check("gpr_$set_text_path");
X
X str_len = (short) strlen(str);
X gpr_$inq_text_extent(str,str_len,&str_size_in_pixels,&status); /* Calculate how much space (in pixels) the string requires */
X check("in gpr_$inq_text_extent");
X
X switch (gpr_justify)
X {
X case LEFT :
X {
X switch (gpr_path)
X {
X case gpr_$up : /* vertical */
X {
X if(DEBUG) printf("LEFT and up , str=%s\n",str);
X break;
X }
X case gpr_$right : /* horizontal */
X {
X ygpr = ygpr + str_size_in_pixels.y_size/2;
X if(DEBUG) printf("LEFT and right, str=%s \n",str);
X break;
X }
X }
X break;
X }
X
X case CENTRE :
X {
X switch (gpr_path)
X {
X case gpr_$up : /* vertical */
X {
X xgpr = xgpr + str_size_in_pixels.x_size/2;
X ygpr = ygpr + str_size_in_pixels.y_size/2;
X if(DEBUG) printf("CENTRE and up, str=%s \n",str);
X break;
X }
X case gpr_$right : /* horizontal */
X {
X xgpr = xgpr - str_size_in_pixels.x_size/2;
X ygpr = ygpr + str_size_in_pixels.y_size/2;
X if(DEBUG) printf("CENTRE and right, str=%s \n",str);
X break;
X }
X }
X break;
X }
X case RIGHT :
X {
X switch (gpr_path)
X {
X case gpr_$up : /* vertical */
X {
X ygpr = ygpr + str_size_in_pixels.y_size;
X if(DEBUG) printf("RIGHT and up, str=%s \n",str);
X break;
X }
X case gpr_$right : /* horizontal */
X {
X xgpr = xgpr - str_size_in_pixels.x_size;
X ygpr = ygpr + str_size_in_pixels.y_size/2;
X if(DEBUG) printf("RIGHT and right, str=%s \n",str);
X break;
X }
X }
X break;
X }
X }
X
X gpr_$move(xgpr,ygpr,&status);
X check("in gpr_$move");
X gpr_$text(str, str_len, &status);
X check("in gpr_$text");
}
X
int GPR_text_angle(ang)
int ang;
{
X if (gpr_ang != ang)
X {
X gpr_ang = ang;
X gpr_path = (gpr_ang == 1 ? gpr_$up : gpr_$right);
X }
X return (TRUE);
}
X
int GPR_justify_text(mode)
enum JUSTIFY mode;
{
X gpr_justify = mode;
X return (TRUE);
}
X
GPR_reset()
{
X gpr_$terminate(false, &status);
X check("in gpr_$terminate");
}
SHAR_EOF
chmod 0644 gnuplot/term/gpr.trm ||
echo 'restore of gnuplot/term/gpr.trm failed'
Wc_c="`wc -c < 'gnuplot/term/gpr.trm'`"
test 11637 -eq "$Wc_c" ||
echo 'gnuplot/term/gpr.trm: original size 11637, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/dumb.trm ==============
if test -f 'gnuplot/term/dumb.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/dumb.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/dumb.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/dumb.trm' &&
/* GNUPLOT - dumb.trm */
/*
X * Copyright (C) 1991
X *
X * Permission to use, copy, and distribute this software and its
X * documentation for any purpose with or without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and
X * that both that copyright notice and this permission notice appear
X * in supporting documentation.
X *
X * Permission to modify the software is granted, but not the right to
X * distribute the modified code. Modifications are to be distributed
X * as patches to released version.
X *
X * This software is provided "as is" without express or implied warranty.
X *
X * This file is included by ../term.c.
X *
X * This terminal driver supports:
X * DUMB terminals
X *
X * AUTHORS
X * Francois Pinard, 91-04-03
X * INTERNET: pinard@iro.umontreal.ca
X *
X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
X *
X */
X
#define DUMB_AXIS_CONST '\1'
#define DUMB_BORDER_CONST '\2'
X
#define DUMB_XMAX 79
#define DUMB_YMAX 24
X
static char *dumb_matrix = NULL; /* matrix of characters */
static char *dumb_priority = NULL; /* matrix of priority at each position */
static char dumb_pen; /* current character used to draw */
static int dumb_x; /* current X position */
static int dumb_y; /* current Y position */
static int dumb_xmax = DUMB_XMAX;
static int dumb_ymax = DUMB_YMAX;
X
#define DUMB_PIXEL(x,y) dumb_matrix[dumb_xmax*(y)+(x)]
X
X
dumb_set_pixel(x,y,v,p)
int x,y,v,p;
{
X if (p > dumb_priority[dumb_xmax*y+x])
X {
X dumb_matrix[dumb_xmax*y+x] = v;
X dumb_priority[dumb_xmax*y+x] = p;
X }
}
X
X
DUMB_options()
{
X int x,y;
X struct value a;
X extern struct value *const_express();
X extern double real();
X
X if (!END_OF_COMMAND) {
X x = (int) real(const_express(&a));
X if (!END_OF_COMMAND) {
X y = (int) real(const_express(&a));
X dumb_xmax = term_tbl[term].xmax = x;
X dumb_ymax = term_tbl[term].ymax = y;
X }
X }
X
X sprintf(term_options, "%d %d",dumb_xmax,dumb_ymax);
}
X
X
DUMB_init()
{
X if (dumb_matrix)
X free(dumb_matrix);
X
X dumb_matrix = alloc (dumb_xmax * dumb_ymax * 2, "dumb terminal");
X
X dumb_priority = dumb_matrix + dumb_xmax * dumb_ymax;
}
X
X
char *
DUMB_str_state()
{
X static char str[80];
X
X sprintf( str, "%d %d", dumb_xmax, dumb_ymax );
X
X return str;
}
X
X
DUMB_graphics ()
{
X int i;
X char *pm = dumb_matrix, *pp = dumb_priority;
X
X for ( i = dumb_xmax * dumb_ymax; i > 0; i-- ) {
X *pm++ = ' ';
X *pp++ = 0;
X }
}
X
X
DUMB_text ()
{
X int x, y, l;
X
X putc ('\f', outfile);
X for (y = dumb_ymax - 1; y >= 0; y--)
X {
X for (l = dumb_xmax; l > 0 && DUMB_PIXEL (l - 1, y) == ' '; l--)
X ;
X for (x = 0; x < l; x++)
X putc (DUMB_PIXEL (x, y), outfile);
X if (y > 0)
X putc ('\n', outfile);
X }
X fflush (outfile);
}
X
X
DUMB_reset()
{
X free (dumb_matrix);
X dumb_matrix = NULL;
}
X
X
DUMB_linetype(linetype)
int linetype;
{
X static char pen_type[7] = {'*', '#', '$', '%', '@', '&', '='};
X
X if (linetype == -2)
X dumb_pen = DUMB_BORDER_CONST;
X else if (linetype == -1)
X dumb_pen = DUMB_AXIS_CONST;
X else
X {
X linetype = linetype % 7;
X dumb_pen = pen_type[linetype];
X }
}
X
X
DUMB_move(x, y)
int x, y;
{
X dumb_x = x;
X dumb_y = y;
}
X
X
DUMB_point(x,y,point)
int x,y,point;
{
X dumb_set_pixel (x, y, point == -1 ? '.' : point % 26 + 'A', 4);
}
X
X
DUMB_vector(x,y)
int x,y;
{
X char pen, pen1;
X int priority;
X int delta;
X
X if (abs (y - dumb_y) > abs (x - dumb_x))
X {
X switch (dumb_pen)
X {
X case DUMB_AXIS_CONST:
X pen = ':';
X pen1 = '+';
X priority = 1;
X break;
X
X case DUMB_BORDER_CONST:
X pen = '|';
X pen1 = '+';
X priority = 2;
X break;
X
X default:
X pen = dumb_pen;
X pen1 = dumb_pen;
X priority = 3;
X break;
X }
X dumb_set_pixel (dumb_x, dumb_y, pen1, priority);
X for (delta = 1; delta < abs (y - dumb_y); delta++)
X dumb_set_pixel (dumb_x
X + (int) ((double) (x - dumb_x) * delta / abs(y - dumb_y)
X + 0.5),
X dumb_y + delta * sign (y - dumb_y),
X pen, priority);
X dumb_set_pixel (x, y, pen1, priority);
X }
X else if (abs (x - dumb_x) > abs (y - dumb_y))
X {
X switch (dumb_pen)
X {
X case DUMB_AXIS_CONST:
X pen = '.';
X pen1 = '+';
X priority = 1;
X break;
X
X case DUMB_BORDER_CONST:
X pen = '-';
X pen1 = '+';
X priority = 2;
X break;
X
X default:
X pen = dumb_pen;
X pen1 = dumb_pen;
X priority = 3;
X break;
X }
X dumb_set_pixel (dumb_x, dumb_y, pen1, priority);
X for (delta = 1; delta < abs (x - dumb_x); delta++)
X dumb_set_pixel (dumb_x + delta * sign (x - dumb_x),
X dumb_y +
X (int) ((double) (y - dumb_y) * delta / abs(x - dumb_x)
X + 0.5),
X pen, priority);
X dumb_set_pixel (x, y, pen1, priority);
X }
X else
X {
X switch (dumb_pen)
X {
X case DUMB_AXIS_CONST: /* zero length axis */
X pen = '+';
X priority = 1;
X break;
X
X case DUMB_BORDER_CONST: /* zero length border */
X pen = '+';
X priority = 2;
X break;
X
X default:
X pen = dumb_pen;
X priority = 3;
X break;
X }
X for (delta = 0; delta <= abs (x - dumb_x); delta++)
X dumb_set_pixel (dumb_x + delta * sign (x - dumb_x),
X dumb_y + delta * sign (y - dumb_y),
X pen, priority);
X }
X dumb_x = x;
X dumb_y = y;
}
X
X
DUMB_put_text(x,y,str)
int x, y;
char *str;
{
X int length;
X int delta;
X
X length = strlen(str);
X if (x + length > dumb_xmax)
X x = max (0, dumb_xmax - length);
X
X for (; x < dumb_xmax && *str; x++, str++)
X dumb_set_pixel (x, y, *str, 5);
}
X
X
DUMB_arrow (sx,sy,ex,ey)
int sx,sy,ex,ey;
{
X char saved_pen;
X char saved_x;
X char saved_y;
X
X saved_pen = dumb_pen;
X saved_x = dumb_x;
X saved_y = dumb_y;
X
X dumb_pen = '>';
X dumb_x = sx;
X dumb_y = sy;
X DUMB_vector (ex,ey);
X
X dumb_pen = saved_pen;
X dumb_x = saved_x;
X dumb_y = saved_y;
}
SHAR_EOF
chmod 0644 gnuplot/term/dumb.trm ||
echo 'restore of gnuplot/term/dumb.trm failed'
Wc_c="`wc -c < 'gnuplot/term/dumb.trm'`"
test 6235 -eq "$Wc_c" ||
echo 'gnuplot/term/dumb.trm: original size 6235, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/amiga.trm ==============
if test -f 'gnuplot/term/amiga.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/amiga.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/amiga.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/amiga.trm' &&
/* GNUPLOT - amiga.trm */
/*
X * Copyright (C) 1991
X *
X * Permission to use, copy, and distribute this software and its
X * documentation for any purpose with or without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and
X * that both that copyright notice and this permission notice appear
X * in supporting documentation.
X *
X * Permission to modify the software is granted, but not the right to
X * distribute the modified code. Modifications are to be distributed
X * as patches to released version.
X *
X * This software is provided "as is" without express or implied warranty.
X *
X * This file is included by ../term.c.
X *
X * This terminal driver supports:
X * Amiga Custom Screen
X *
X * AUTHORS
X * Carsten Steger
X *
X * Pat R. Empleo Slightly modified for Aztec C v5.2a (beta); sort of
X * 08/27/91 supports overscan; for large WB 2.0 virtual screens,
X * we limit the plot size so we don't have to scroll
X * around (not fun).
X *
X * Carsten Steger Modified to support Kickstart 2.0.
X * 09/11/91 Opens a text overscan screen when used with WB 2.0.
X * Discerns between NTSC and PAL Amigas when used with
X * WB 1.3 and lower.
X *
X * Pat R. Empleo Defined some 2.0 stuff in order to get Aztec C to
X * 09/20/91 work with Carsten's new code (see above). When
X * KS/WB 2.0 support gets implemented in Aztec C, this
X * kludge will get deleted!
X * (Aztec C release 5.2 beta)
X *
X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
X *
X */
X
#ifdef AMIGA_AC_5
#include <intuition/intuitionbase.h>
#include <intuition/screens.h>
#include <graphics/text.h>
#include <graphics/gfxbase.h>
X
#define OSCAN_TEXT (1) /* */
#define SA_Dummy (TAG_USER + 32) /* This stuff is temporary */
#define SA_Overscan (SA_Dummy + 0x0014) /* until Aztec C implements */
#define STDSCREENWIDTH -1 /* KS/WB 2.0 support. */
#define TAG_DONE (0L) /* */
#define TAG_USER (1L<<31) /* */
X /* */
typedef ULONG Tag; /* */
X /* */
struct TagItem /* */
X { /* */
X Tag ti_Tag; /* */
X ULONG ti_Data; /* */
X }; /* */
X
#else
/* You will have to use the Kickstart 2.0 header files for this to compile */
#include <exec/types.h>
#include <intuition/intuitionbase.h>
#include <graphics/gfxbase.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/exec.h>
#include <proto/diskfont.h>
#endif
X
extern char *getenv(),*strchr();
X
#define AMIGA_XMAX 640
#define AMIGA_YMAX 512
X
#define AMIGA_VCHAR (12)
#define AMIGA_HCHAR (8)
#define AMIGA_VTIC (AMIGA_YMAX/80)
#define AMIGA_HTIC (AMIGA_XMAX/80)
/* The origin is in the upper left hand corner, so we have to translate */
/* and flip the coordinates: */
#define AMIGA_VTF(y) (AMIGA_ymax-1-(y))
X
X
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Library *DiskfontBase;
static struct TextAttr AMIGA_Font = {
X "topaz.font",TOPAZ_EIGHTY,FS_NORMAL,FPF_ROMFONT
};
static struct TextFont *AMIGA_TextFont;
static struct NewScreen AMIGA_NewScreen = {
X 0,0,AMIGA_XMAX,AMIGA_YMAX,4,15,0,HIRES|LACE,
X CUSTOMSCREEN|SCREENBEHIND|SCREENQUIET,NULL,NULL,NULL,NULL
};
static struct Screen *AMIGA_Screen;
static UWORD AMIGA_Colors [] = {
X 0x000,0xfff,0xbbb,0x0f0,0xf00,0x00f,0x3ca,0xf0f,
X 0x94d,0x0ff,0x82f,0xff0,0x0af,0xc5e,0xfa2,0xf44
};
static int AMIGA_slinetype;
static enum JUSTIFY AMIGA_justify = LEFT;
static unsigned int AMIGA_ymax,AMIGA_xmax;
static WORD AMIGA_cwd,AMIGA_cht,AMIGA_bsl,AMIGA_vadj;
static struct TagItem AMIGA_ScrTagList[] = {
X {SA_Overscan,OSCAN_TEXT},{TAG_DONE,0}
};
X
X
AMIGA_reset()
{
X if (AMIGA_TextFont != NULL) CloseFont(AMIGA_TextFont);
X if (DiskfontBase != NULL) CloseLibrary(DiskfontBase);
X if (AMIGA_Screen != NULL) CloseScreen(AMIGA_Screen);
X if (IntuitionBase != NULL) CloseLibrary(IntuitionBase);
X if (GfxBase != NULL) CloseLibrary(GfxBase);
X AMIGA_TextFont = NULL;
X DiskfontBase = NULL;
X AMIGA_Screen = NULL;
X IntuitionBase = NULL;
X GfxBase = NULL;
}
X
X
AMIGA_init()
{
X static char fontname[80],*gnufont,*search;
X static int fsize;
X static char *test_str =
X " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
X static WORD test_len,test_pxl;
X
X
#ifdef AMIGA_LC_5_1
X /* Install exit trap in case of abnormal termination (see below). */
X int AMIGA_exit();
X if (!onexit(&AMIGA_exit)) {
X fprintf(stderr,"Couldn't set exit trap\n");
X exit(20);
X }
#endif
X GfxBase = OpenLibrary("graphics.library",0);
X if (GfxBase == NULL) {
X fprintf(stderr,"No Graphics-Library\n");
X AMIGA_reset();
X exit(20);
X }
X IntuitionBase = OpenLibrary("intuition.library",0);
X if (IntuitionBase == NULL) {
X fprintf(stderr,"No Intuition-Library\n");
X AMIGA_reset();
X exit(20);
X }
X if (IntuitionBase->LibNode.lib_Version <= 34) {
X /* We compute the vertical resolution for those poor NTSC-souls :-) */
X if (GfxBase->DisplayFlags && PAL) AMIGA_ymax = 512;
X else AMIGA_ymax = 400;
X AMIGA_xmax = 640;
X AMIGA_NewScreen.Width = AMIGA_xmax;
X AMIGA_NewScreen.Height = AMIGA_ymax;
X AMIGA_Screen = OpenScreen(&AMIGA_NewScreen);
X if (AMIGA_Screen == NULL) {
X fprintf(stderr,"No Screen\n");
X AMIGA_reset();
X exit(20);
X }
X } else {
X /* Kickstart 2.0 support */
X AMIGA_NewScreen.Width = STDSCREENWIDTH;
X AMIGA_NewScreen.Height = STDSCREENHEIGHT;
X /* I had to set TopEdge equal to 1 with my (probably outdated) software */
X /* version of Kickstart 2.0 in order for the last line to be displayed */
X /* correctly. Remove the next two lines and check if it still works */
X /* with newer ROM-versions of Kickstart 2.0 */
#ifdef AMIGA_LC_5_1
X AMIGA_NewScreen.TopEdge = 1;
X AMIGA_NewScreen.LeftEdge = 0;
#endif
X AMIGA_Screen = OpenScreenTagList(&AMIGA_NewScreen,AMIGA_ScrTagList);
X if (AMIGA_Screen == NULL) {
X fprintf(stderr,"No Screen\n");
X AMIGA_reset();
X exit(20);
X }
X AMIGA_xmax = AMIGA_Screen->Width;
X AMIGA_ymax = AMIGA_Screen->Height;
X }
X term_tbl[term].xmax = AMIGA_xmax;
X term_tbl[term].ymax = AMIGA_ymax;
X gnufont = getenv("GNUFONT");
X if (gnufont != NULL ) {
X search = strchr(gnufont,'/');
X if (search != NULL) {
X *search++ = '\0';
X strncpy(fontname,gnufont,74);
X strcat(fontname,".font");
X sscanf(search,"%d",&fsize);
X /* Avoid opening "diskfont.library" if a built-in font is desired */
X if ((strcmp("topaz.font",fontname) == 0) &&
X ((fsize == TOPAZ_EIGHTY) || (fsize == TOPAZ_SIXTY))) {
X AMIGA_Font.ta_Name = fontname;
X AMIGA_Font.ta_YSize = fsize;
X AMIGA_Font.ta_Style = FS_NORMAL;
X AMIGA_Font.ta_Flags = FPF_ROMFONT;
X AMIGA_TextFont = OpenFont(&AMIGA_Font);
X if (AMIGA_TextFont != NULL)
X SetFont(&AMIGA_Screen->RastPort,AMIGA_TextFont);
X } else {
X DiskfontBase = OpenLibrary("diskfont.library",0);
X if (DiskfontBase != NULL) {
X AMIGA_Font.ta_Name = fontname;
X AMIGA_Font.ta_YSize = fsize;
X AMIGA_Font.ta_Style = FS_NORMAL;
X AMIGA_Font.ta_Flags = FPF_ROMFONT|FPF_DISKFONT;
X AMIGA_TextFont = OpenDiskFont(&AMIGA_Font);
X if (AMIGA_TextFont != NULL)
X SetFont(&AMIGA_Screen->RastPort,AMIGA_TextFont);
X }
X }
X }
X }
X /* Width of characters: This works better for proportional fonts than */
X /* AMIGA_Screen->RastPort.TxWidth + AMIGA_Screen->RastPort.TxSpacing */
X test_len = strlen(test_str);
X test_pxl = TextLength(&AMIGA_Screen->RastPort,test_str,test_len);
X AMIGA_cwd = test_pxl / test_len;
X AMIGA_cht = AMIGA_Screen->RastPort.TxHeight; /* Height of characters */
X AMIGA_bsl = AMIGA_Screen->RastPort.TxBaseline; /* Reference line */
X /* Amount by which characters have to be shifted upwards to be */
X /* vertically justified: */
X AMIGA_vadj = AMIGA_bsl / 2;
X term_tbl[term].v_char = AMIGA_cht + 4; /* So lines won't be too close */
X term_tbl[term].h_char = AMIGA_cwd;
X LoadRGB4(&AMIGA_Screen->ViewPort,AMIGA_Colors,16);
X RemakeDisplay();
X AMIGA_slinetype = 1;
X SetAPen(&AMIGA_Screen->RastPort,AMIGA_slinetype);
X SetDrMd(&AMIGA_Screen->RastPort,JAM1);
}
X
X
AMIGA_text()
{
X char c;
X
X c = getc(stdin); /* This is extremely ugly... Yuk !!!! >:-( */
X ungetc(c,stdin); /* Maybe someone else will find a better solution */
X ScreenToBack(AMIGA_Screen);
}
X
X
AMIGA_graphics()
{
X SetRast(&AMIGA_Screen->RastPort,0);
X SetAPen(&AMIGA_Screen->RastPort,AMIGA_slinetype);
X ScreenToFront(AMIGA_Screen);
}
X
X
AMIGA_move(x,y)
unsigned int x,y;
{
X if ((x>=AMIGA_xmax) || (y>=AMIGA_ymax)) return;
X Move(&AMIGA_Screen->RastPort,x,AMIGA_VTF(y));
}
X
X
AMIGA_vector(x,y)
unsigned int x,y;
{
X if ((x>=AMIGA_xmax) || (y>=AMIGA_ymax)) return;
X Draw(&AMIGA_Screen->RastPort,x,AMIGA_VTF(y));
}
X
X
AMIGA_linetype(linetype)
int linetype;
{
X if (linetype >= 13) linetype %= 13;
X AMIGA_slinetype = linetype+3;
X SetAPen(&AMIGA_Screen->RastPort,AMIGA_slinetype);
}
X
X
AMIGA_put_text(x,y,str)
unsigned int x,y;
char *str;
{
X LONG len,tx_len;
X WORD xmin,xmax,ymin,ymax;
X
X len = strlen(str);
X tx_len = TextLength(&AMIGA_Screen->RastPort,str,len);
X switch (AMIGA_justify) {
X case LEFT:
X xmin = x;
X xmax = x + tx_len;
X break;
X case CENTRE:
X xmin = x - tx_len / 2;
X xmax = x + tx_len - tx_len / 2; /* aviod roundoff errors ! */
X break;
X case RIGHT:
X xmin = x - tx_len;
X xmax = x;
X break;
X }
X ymin = AMIGA_VTF(y) - AMIGA_vadj;
X ymax = ymin + AMIGA_cht;
X /* Check if character-string lies completely within the screen: */
X if ((xmax >= AMIGA_xmax) || (ymin < 0) || (ymax >= AMIGA_ymax)) return;
X Move(&AMIGA_Screen->RastPort,xmin,ymin+AMIGA_bsl);
X Text(&AMIGA_Screen->RastPort,str,len);
}
X
X
int AMIGA_justify_text(mode)
enum JUSTIFY mode;
{
X AMIGA_justify = mode;
X return TRUE;
}
X
X
/* This function is mainly included if the program terminates abnormally */
/* and the screen and libraries are still open. It closes down all opened */
/* libraries and screens. This happens e.g. when loading "bivariat.demo" */
/* and the stack is smaller than 70000 bytes. */
#ifdef AMIGA_LC_5_1
int AMIGA_exit(rc)
int rc;
{
X AMIGA_reset();
X return rc;
}
#endif
SHAR_EOF
chmod 0644 gnuplot/term/amiga.trm ||
echo 'restore of gnuplot/term/amiga.trm failed'
Wc_c="`wc -c < 'gnuplot/term/amiga.trm'`"
test 10991 -eq "$Wc_c" ||
echo 'gnuplot/term/amiga.trm: original size 10991, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/apollo.trm ==============
if test -f 'gnuplot/term/apollo.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/apollo.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/apollo.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/apollo.trm' &&
/* GNUPLOT - apollo.trm */
/*
X Apollo terminal driver for GNUplot.
X
X Open a pad for the graphics, and use GPR routines. For additional
X speed, we do the graphics to a separate bitmap, and the blt the
X entire bitmap to the display. When the user specifies an output
X file name, however, we draw directly to the screen, so the graphics
X are written to the file correctly. Thus, the user can save the
X graphics in a file, to be viewed later. If we try the bitmap
X trick, it looks funny.
SHAR_EOF
true || echo 'restore of gnuplot/term/apollo.trm failed'
fi
echo 'End of part 19'
echo 'File gnuplot/term/apollo.trm is continued in part 20'
echo 20 > _shar_seq_.tmp
exit 0
exit 0 # Just in case...
--
Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD UUCP: uunet!sparky!kent
Phone: (402) 291-8300 FAX: (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.