home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-25 | 61.7 KB | 2,900 lines |
- Newsgroups: comp.sources.misc
- organization: Pixar -- Marin County, California
- subject: v11i075: Gnuplot 2.0 - 10 of 14
- From: thaw@ucbvax.Berkeley.EDU@pixar.UUCP (Tom Williams)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 11, Issue 75
- Submitted-by: thaw@ucbvax.Berkeley.EDU@pixar.UUCP (Tom Williams)
- Archive-name: gnuplot2/part10
-
- This is gnuplot.sh10
-
- --- CUT HERE ---
- #! /bin/sh
- echo x - term/post.trm
- sed 's/^X//' >term/post.trm <<'*-*-END-of-term/post.trm-*-*'
- X/* GNUPLOT - post.trm */
- X/*
- 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 * postscript, psbig, epsf1, epsf2
- X *
- X * AUTHORS
- X * Russell Lang
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X
- X/* PostScript driver by Russell Lang, rjl@monu1.cc.monash.edu.au */
- X
- Xint pspage=0; /* page count */
- Xint ps_path_count=0; /* count of lines in path */
- Xint ps_ang=0; /* text angle */
- Xenum JUSTIFY ps_justify=LEFT; /* text is flush left */
- Xchar *ps_font; /* name of font in use */
- XBOOLEAN ps_big; /* true if big font used */
- X
- Xchar *PS_header[] = {
- X"/vpt2 vpt 2 mul def\n",
- X"/hpt2 hpt 2 mul def\n",
- X/* flush left show */
- X"/Lshow { 0 vshift rmoveto show } def\n",
- X/* flush right show */
- X"/Rshow { dup stringwidth pop neg vshift rmoveto show } def\n",
- X/* centred show */
- X"/Cshow { dup stringwidth pop -2 div vshift rmoveto show } def\n",
- X/* Border Lines */
- X"/BL { stroke gnulinewidth 2 mul setlinewidth} def\n",
- X/* Axes Lines */
- X"/AL { stroke gnulinewidth 2 div setlinewidth } def\n",
- X/* Plot Lines */
- X"/PL { stroke gnulinewidth setlinewidth } def\n",
- X/* Line Types */
- X"/LTb { BL [] 0 setdash } def\n", /* border */
- X"/LTa { AL [1 dl 2 dl] 0 setdash } def\n", /* axes */
- X"/LT0 { PL [] 0 setdash } def\n",
- X"/LT1 { PL [4 dl 2 dl] 0 setdash } def\n",
- X"/LT2 { PL [2 dl 3 dl] 0 setdash } def\n",
- X"/LT3 { PL [1 dl 1.5 dl] 0 setdash } def\n",
- X"/LT4 { PL [5 dl 2 dl 1 dl 2 dl] 0 setdash } def\n",
- X"/LT5 { PL [4 dl 3 dl 1 dl 3 dl] 0 setdash } def\n",
- X"/LT6 { PL [2 dl 2 dl 2 dl 4 dl] 0 setdash } def\n",
- X"/LT7 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 0 setdash } def\n",
- X"/LT8 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 0 setdash } def\n",
- X"/M {moveto} def\n",
- X"/L {lineto} def\n",
- X"/P { LT0\n", /* Point */
- X" currentlinewidth 2 div sub moveto\n",
- X" 0 currentlinewidth rlineto stroke } def\n",
- X"/D { LT0 2 copy vpt add moveto\n", /* Diamond */
- X" hpt neg vpt neg rlineto hpt vpt neg rlineto\n",
- X" hpt vpt rlineto hpt neg vpt rlineto closepath stroke\n",
- X" P } def\n",
- X"/A { LT0 vpt sub moveto 0 vpt2 rlineto\n", /* Plus (Add) */
- X" currentpoint stroke moveto\n",
- X" hpt neg vpt neg rmoveto hpt2 0 rlineto stroke\n",
- X" } def\n",
- X"/B { LT0 2 copy exch hpt sub exch vpt add moveto\n", /* Box */
- X" 0 vpt2 neg rlineto hpt2 0 rlineto 0 vpt2 rlineto\n",
- X" hpt2 neg 0 rlineto closepath stroke\n",
- X" P } def\n",
- X"/C { LT0 exch hpt sub exch vpt add moveto\n", /* Cross */
- X" hpt2 vpt2 neg rlineto currentpoint stroke moveto\n",
- X" hpt2 neg 0 rmoveto hpt2 vpt2 rlineto stroke } def\n",
- X"/T { LT0 2 copy vpt 1.12 mul add moveto\n", /* Triangle */
- X" hpt neg vpt -1.62 mul rlineto\n",
- X" hpt 2 mul 0 rlineto\n",
- X" hpt neg vpt 1.62 mul rlineto closepath stroke\n",
- X" P } def\n",
- X"/S { LT0 2 copy A C} def\n", /* Star */
- XNULL
- X};
- X
- X#define PS_XMAX 3600
- X#define PS_YMAX 2520
- X
- X#define PS_XLAST (PS_XMAX - 1)
- X#define PS_YLAST (PS_YMAX - 1)
- X
- X#define PS_VTIC (PS_YMAX/80)
- X#define PS_HTIC (PS_YMAX/80)
- X
- X
- X#define PS_SC (360.0/PS_XMAX) /* scale is 1pt = 10 units */
- X#define PS_LW (0.25/PS_SC) /* linewidth = 0.25 pts */
- X
- X#define PS_VCHAR1 (int)(7.0/PS_SC) /* 7 point characters */
- X#define PS_HCHAR1 (int)(0.6*7.0/PS_SC)
- X
- X#define PS_VCHAR2 (int)(11.0/PS_SC) /* 11 point characters */
- X#define PS_HCHAR2 (int)(0.6*11.0/PS_SC)
- X
- X
- XEPSF1_init()
- X{
- X ps_big = FALSE;
- X ps_font = "Courier";
- X /* the font could also be "Courier-Bold" or "Times-Roman" etc. */
- X}
- X
- X
- XEPSF2_init()
- X{
- X ps_big = TRUE;
- X ps_font = "Courier";
- X}
- X
- X
- XEPSF_graphics()
- X{
- Xint i;
- X fprintf(outfile,"%%!PS-Adobe-2.0 EPSF-2.0\n");
- X fprintf(outfile,"%%%%Creator: gnuplot\n");
- X fprintf(outfile,"%%%%DocumentFonts: %s\n", ps_font);
- X fprintf(outfile,"%%%%DocumentNeededFonts: %s\n", ps_font);
- X fprintf(outfile,"%%%%BoundingBox: 0 0 %d %d\n",
- X (int)(xsize*(PS_XMAX)*PS_SC+0.5),
- X (int)(ysize*(PS_YMAX)*PS_SC+0.5) );
- X fprintf(outfile,"%%%%EndComments\n");
- X fprintf(outfile,"40 dict begin\n");
- X fprintf(outfile,"/gnulinewidth %.3f def\n",PS_LW);
- X fprintf(outfile,"/vshift %d def\n",
- X ps_big ? -PS_VCHAR2/3 : -PS_VCHAR1/3);
- X fprintf(outfile,"/dl {%.3f mul} def\n",1/PS_SC); /* dash length */
- X fprintf(outfile,"/hpt %.1f def\n",PS_HTIC/2.0);
- X fprintf(outfile,"/vpt %.1f def\n",PS_VTIC/2.0);
- X for ( i=0; PS_header[i] != NULL; i++)
- X fprintf(outfile,"%s",PS_header[i]);
- X fprintf(outfile,"%%%%EndProlog\n");
- X fprintf(outfile,"%%%%BeginSetup\n");
- X fprintf(outfile,"/Gnu_save save def\n");
- X fprintf(outfile,"%.3f %.3f scale\n",PS_SC,PS_SC);
- X fprintf(outfile,"%%%%IncludeFont: %s\n", ps_font);
- X fprintf(outfile,"/%s findfont %d ", ps_font,
- X ps_big ? PS_VCHAR2 : PS_VCHAR1 );
- X fprintf(outfile,"scalefont setfont\n");
- X fprintf(outfile,"newpath\n");
- X ps_path_count = 0;
- X fprintf(outfile,"%%%%EndSetup\n");
- X}
- X
- X
- XEPSF_text()
- X{
- X fprintf(outfile,"stroke\nGnu_save restore\n");
- X fprintf(outfile,"showpage\n");
- X ps_path_count = 0;
- X fprintf(outfile,"%%%%Trailer\n");
- X fprintf(outfile,"end\n");
- X}
- X
- X
- XEPSF_reset()
- X{
- X}
- X
- X
- XPS1_init()
- X{
- X EPSF1_init();
- X PS_init();
- X}
- X
- X
- XPS2_init()
- X{
- X EPSF2_init();
- X PS_init();
- X}
- X
- X
- XPS_init()
- X{
- X fprintf(outfile,"%%!PS-Adobe-2.0\n");
- X fprintf(outfile,"%%%%Creator: gnuplot\n");
- X fprintf(outfile,"%%%%DocumentFonts: %s\n", ps_font);
- X fprintf(outfile,"%%%%DocumentNeededFonts: %s\n", ps_font);
- X fprintf(outfile,"%%%%Pages: (atend)\n");
- X fprintf(outfile,"%%%%BoundingBox: %d 50 550 %d\n",
- X (int)(550.5-ysize*(PS_YMAX)*PS_SC*2),
- X (int)(50.5+xsize*(PS_XMAX)*PS_SC*2) );
- X fprintf(outfile,"%%%%EndComments\n");
- X fprintf(outfile,"/GnuTransform {\n");
- X fprintf(outfile," 90 rotate\n 50 -550 translate\n 2 2 scale\n");
- X fprintf(outfile,"} def\n");
- X fprintf(outfile,"%%%%EndProlog\n");
- X pspage = 0;
- X}
- X
- X
- X
- XPS_graphics()
- X{
- X fprintf(outfile,"%%%%Page: ? %d\n",++pspage);
- X fprintf(outfile,"gsave\nGnuTransform\n");
- X fprintf(outfile,"%%%%BeginDocument: EPSF\n");
- X fprintf(outfile,"1 dict begin\n/showpage {} def\n");
- X EPSF_graphics();
- X}
- X
- X
- XPS_text()
- X{
- X EPSF_text();
- X fprintf(outfile,"%%%%EndDocument\n");
- X fprintf(outfile,"end\nshowpage\ngrestore\n");
- X}
- X
- X
- X
- XPS_reset()
- X{
- X fprintf(outfile,"%%%%Trailer\n");
- X fprintf(outfile,"%%%%Pages: %d\n",pspage);
- X}
- X
- X
- XPS_linetype(linetype)
- Xint linetype;
- X{
- Xchar *line = "ba012345678";
- X fprintf(outfile,"LT%c\n", line[(linetype%9)+2]);
- X ps_path_count = 0;
- X}
- X
- X
- XPS_move(x,y)
- Xunsigned int x,y;
- X{
- X fprintf(outfile,"%d %d M\n", x, y);
- X ps_path_count += 1;
- X}
- X
- X
- XPS_vector(x,y)
- Xunsigned int x,y;
- X{
- X fprintf(outfile,"%d %d L\n", x, y);
- X ps_path_count += 1;
- X if (ps_path_count >= 400) {
- X fprintf(outfile,"currentpoint stroke moveto\n");
- X ps_path_count = 0;
- X }
- X}
- X
- X
- XPS_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- Xchar ch;
- X PS_move(x,y);
- X if (ps_ang != 0)
- X fprintf(outfile,"currentpoint gsave translate %d rotate 0 0 moveto\n"
- X ,ps_ang*90);
- X putc('(',outfile);
- X ch = *str++;
- X while(ch!='\0') {
- X if ( (ch=='(') || (ch==')') || (ch=='\\') )
- X putc('\\',outfile);
- X putc(ch,outfile);
- X ch = *str++;
- X }
- X switch(ps_justify) {
- X case LEFT : fprintf(outfile,") Lshow\n");
- X break;
- X case CENTRE : fprintf(outfile,") Cshow\n");
- X break;
- X case RIGHT : fprintf(outfile,") Rshow\n");
- X break;
- X }
- X if (ps_ang != 0)
- X fprintf(outfile,"grestore\n");
- X}
- X
- Xint PS_text_angle(ang)
- Xint ang;
- X{
- X ps_ang=ang;
- X return TRUE;
- X}
- X
- Xint PS_justify_text(mode)
- Xenum JUSTIFY mode;
- X{
- X ps_justify=mode;
- X return TRUE;
- X}
- X
- X/* postscript point routines */
- XPS_point(x,y,number)
- Xint x,y;
- Xint number;
- X{
- Xchar *point = "PDABCTS";
- X number %= POINT_TYPES;
- X if (number < -1)
- X number = -1; /* negative types are all 'dot' */
- X fprintf(outfile,"%d %d %c\n", x, y, point[number+1]);
- X ps_path_count = 0;
- X}
- X
- *-*-END-of-term/post.trm-*-*
- echo x - term/pc.trm
- sed 's/^X//' >term/pc.trm <<'*-*-END-of-term/pc.trm-*-*'
- X/* GNUPLOT - pc.trm */
- X/*
- 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 * Under Microsoft C
- X * cga, egabios, egalib, vgabios, hercules, corona325, att
- X * Under Turboc C
- X * egalib, vgalib, vgamono, mcga, cga, hercules
- X *
- X * AUTHORS
- X * Colin Kelley, Thomas Williams, William Wilson, Russell Lang
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X#ifdef __TURBOC__
- X#include <graphics.h>
- X#include <dos.h>
- X int g_driver, g_mode, g_error;
- X char far *path;
- X char *pathp, path_s[128];
- X
- X/* instead of string.h */
- Xextern char *strrchr();
- X
- Xget_path()
- X{
- X path=(char far *) getenv("BGI");
- X if (path==NULL) {
- X (void) strcpy(path_s,_argv[0]);
- X pathp=strrchr(path_s,'\\');
- X *pathp=0x00;
- X path=path_s;
- X }
- X}
- X
- X#endif
- X
- X
- Xstatic char near buf[80]; /* kludge since EGA.LIB is compiled SMALL */
- X
- Xstatic int pattern[] = {0xffff, 0x0f0f, 0xffff, 0xaaaa, 0x3333, 0x3f3f, 0x0f0f};
- X
- Xstatic int graphics_on = FALSE;
- Xint startx, starty;
- X
- Xint pc_angle;
- X#define PC_VCHAR 11
- X#define PC_HCHAR 7
- X
- Xpause() /* press any key to continue... */
- X{
- X while (kbhit())
- X (void) getch(); /* flush the keyboard buffer */
- X while (!kbhit())
- X ;
- X}
- X
- X
- XPC_text()
- X{
- X if (graphics_on) {
- X graphics_on = FALSE;
- X pause();
- X }
- X#ifdef __TURBOC__
- X closegraph();
- X#else
- X Vmode(3);
- X#endif
- X}
- X
- XPC_reset()
- X{
- X#ifdef __TURBOC__
- X closegraph();
- X#endif
- X}
- X
- X
- X#ifndef __TURBOC__
- X
- XPC_putc(x,y,c,angle,line_func)
- Xunsigned int x,y;
- Xchar c;
- Xint angle;
- XFUNC_PTR line_func;
- X{
- Xint i,j,k;
- Xunsigned int pixelon;
- X i = (int)(c) - 32;
- X for (j=0; j<9; j++) {
- X for (k=0; k<5; k++) {
- X pixelon = (((unsigned int)(font5x7[i][j])) >> k & 1);
- X if (pixelon) {
- X switch(angle) {
- X case 0 : line_func(x+k+1,y-j,x+k+1,y-j);
- X break;
- X case 1 : line_func(x-j,y-k-1,x-j,y-k-1);
- X break;
- X }
- X }
- X }
- X }
- X}
- X
- X
- Xint PC_text_angle(ang)
- Xint ang;
- X{
- X pc_angle=ang;
- X return TRUE;
- X}
- X
- X
- X#define CGA_XMAX 640
- X#define CGA_YMAX 200
- X
- X#define CGA_XLAST (CGA_XMAX - 1)
- X#define CGA_YLAST (CGA_YMAX - 1)
- X
- X#define CGA_VCHAR PC_VCHAR
- X#define CGA_HCHAR PC_HCHAR
- X#define CGA_VTIC 4
- X#define CGA_HTIC 6
- X
- Xint line_cga;
- X
- XCGA_init()
- X{
- X PC_color(1); /* monochrome */
- X}
- X
- XCGA_graphics()
- X{
- X graphics_on = TRUE;
- X Vmode(6);
- X}
- X
- X#define CGA_text PC_text
- X
- XCGA_linetype(linetype)
- X{
- X if (linetype >= 5)
- X linetype %= 5;
- X line_cga=linetype;
- X PC_mask(pattern[linetype+2]);
- X}
- X
- XCGA_move(x,y)
- X{
- X startx = x;
- X starty = y;
- X}
- X
- X
- XCGA_vector(x,y)
- X{
- X PC_line(startx,CGA_YLAST-starty,x,CGA_YLAST-y);
- X startx = x;
- X starty = y;
- X}
- X
- X
- XCGA_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- Xint i;
- Xint line;
- X line= line_cga; /* disable the dotted lines temporarily */
- X PC_mask(pattern[0]);
- X switch(pc_angle) {
- X case 0 : y -= CGA_VCHAR/2;
- X break;
- X case 1 : x += CGA_VCHAR/2;
- X break;
- X }
- X for (i=0;str[i];i++) {
- X PC_putc(x,CGA_YLAST-y,str[i],pc_angle,PC_line);
- X switch(pc_angle) {
- X case 0 : x+=CGA_HCHAR ;
- X break;
- X case 1 : y+=CGA_HCHAR ;
- X break;
- X }
- X }
- X PC_mask(pattern[line]); /* enable dotted lines */
- X}
- X
- X
- X#define CGA_text_angle PC_text_angle
- X
- X#define CGA_reset PC_reset
- X
- X
- X#define EGA_XMAX 640
- X#define EGA_YMAX 350
- X
- X#define EGA_XLAST (EGA_XMAX - 1)
- X#define EGA_YLAST (EGA_YMAX - 1)
- X
- X#define EGA_VCHAR PC_VCHAR
- X#define EGA_HCHAR PC_HCHAR
- X#define EGA_VTIC 4
- X#define EGA_HTIC 5
- X
- Xstatic int ega64color[] = {1,1,5,4,3,5,4,3, 5, 4, 3, 5, 4, 3,5};
- Xstatic int ega256color[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
- X
- Xstatic int *egacolor;
- X
- X
- XEGA_init()
- X{
- X PC_mask(0xffff);
- X egacolor = ega256color; /* should be smarter */
- X}
- X
- XEGA_graphics()
- X{
- X graphics_on = TRUE;
- X Vmode(16);
- X}
- X
- X#define EGA_text PC_text
- X
- XEGA_linetype(linetype)
- X{
- X if (linetype >= 13)
- X linetype %= 13;
- X PC_color(egacolor[linetype+2]);
- X}
- X
- XEGA_move(x,y)
- X{
- X startx = x;
- X starty = y;
- X}
- X
- XEGA_vector(x,y)
- X{
- X PC_line(startx,EGA_YLAST-starty,x,EGA_YLAST-y);
- X startx = x;
- X starty = y;
- X}
- X
- X
- XEGA_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- Xint i;
- X switch(pc_angle) {
- X case 0 : y -= EGA_VCHAR/2;
- X break;
- X case 1 : x += EGA_VCHAR/2;
- X break;
- X }
- X for (i=0;str[i];i++) {
- X PC_putc(x,EGA_YLAST-y,str[i],pc_angle,PC_line);
- X switch(pc_angle) {
- X case 0 : x+=EGA_HCHAR ;
- X break;
- X case 1 : y+=EGA_HCHAR ;
- X break;
- X }
- X }
- X}
- X
- X
- X#define EGA_text_angle PC_text_angle
- X
- X#define EGA_reset PC_reset
- X
- X
- X
- X/* The following VGA routines are hacked from the above EGA routines
- X They worked on two VGA cards.
- X Russell Lang, eln272v@monu1.cc.monash.oz */
- X#define VGA_XMAX 640
- X#define VGA_YMAX 480
- X
- X#define VGA_XLAST (VGA_XMAX - 1)
- X#define VGA_YLAST (VGA_YMAX - 1)
- X
- X#define VGA_VCHAR PC_VCHAR
- X#define VGA_HCHAR PC_HCHAR
- X#define VGA_VTIC 5
- X#define VGA_HTIC 5
- X
- Xstatic int vga256color[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
- X
- Xstatic int *vgacolor;
- X
- X
- XVGA_init()
- X{
- X PC_mask(0xffff);
- X vgacolor = vga256color; /* should be smarter */
- X}
- X
- XVGA_graphics()
- X{
- X graphics_on = TRUE;
- X Vmode(18);
- X}
- X
- X#define VGA_text PC_text
- X
- XVGA_linetype(linetype)
- X{
- X if (linetype >= 13)
- X linetype %= 13;
- X PC_color(vgacolor[linetype+2]);
- X}
- X
- XVGA_move(x,y)
- X{
- X startx = x;
- X starty = y;
- X}
- X
- XVGA_vector(x,y)
- X{
- X PC_line(startx,VGA_YLAST-starty,x,VGA_YLAST-y);
- X startx = x;
- X starty = y;
- X}
- X
- X
- XVGA_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- Xint i;
- X switch(pc_angle) {
- X case 0 : y -= VGA_VCHAR/2;
- X break;
- X case 1 : x += VGA_VCHAR/2;
- X break;
- X }
- X for (i=0;str[i];i++) {
- X PC_putc(x,VGA_YLAST-y,str[i],pc_angle,PC_line);
- X switch(pc_angle) {
- X case 0 : x+=VGA_HCHAR ;
- X break;
- X case 1 : y+=VGA_HCHAR ;
- X break;
- X }
- X }
- X}
- X
- X
- X#define VGA_text_angle PC_text_angle
- X
- X#define VGA_reset PC_reset
- X
- X
- X
- X#ifdef EGALIB
- X
- X#define EGALIB_XMAX 640
- X#define EGALIB_YMAX 350
- X
- X#define EGALIB_XLAST (EGA_XMAX - 1)
- X#define EGALIB_YLAST (EGA_YMAX - 1)
- X
- X#define EGALIB_VCHAR 14
- X#define EGALIB_HCHAR 8
- X#define EGALIB_VTIC 4
- X#define EGALIB_HTIC 5
- X
- X#include "mcega.h"
- X
- XEGALIB_init()
- X{
- X GPPARMS();
- X if (GDTYPE != 5) {
- X term = 0;
- X int_error("color EGA board not found",NO_CARET);
- X }
- X egacolor = (GDMEMORY < 256) ? ega64color : ega256color;
- X}
- X
- XEGALIB_graphics()
- X{
- X graphics_on = TRUE;
- X GPINIT();
- X}
- X
- XEGALIB_text()
- X{
- X if (graphics_on) {
- X graphics_on = FALSE;
- X pause();
- X }
- X GPTERM();
- X}
- X
- XEGALIB_linetype(linetype)
- X{
- X if (linetype >= 13)
- X linetype %= 13;
- X GPCOLOR(egacolor[linetype+2]);
- X}
- X
- XEGALIB_move(x,y)
- X{
- X GPMOVE(x,GDMAXROW-y);
- X}
- X
- X
- XEGALIB_vector(x,y)
- X{
- X GPLINE(x,GDMAXROW-y);
- X}
- X
- X
- XEGALIB_put_text(x,y,str)
- Xint x, y;
- Xchar *str;
- X{
- X strcpy((char far *)buf,str);
- X GotoXY((int)(x/EGALIB_HCHAR),
- X (int)((EGALIB_YMAX-y-(EGALIB_VCHAR/2))/EGALIB_VCHAR));
- X gprintf(buf);
- X}
- X
- X
- X#define EGALIB_reset PC_reset
- X
- X#endif /* EGALIB */
- X
- X
- X#ifdef HERCULES
- X
- X#define HERC_XMAX 720
- X#define HERC_YMAX 348
- X
- X#define HERC_XLAST (HERC_XMAX - 1)
- X#define HERC_YLAST (HERC_YMAX - 1)
- X
- X#define HERC_VCHAR PC_VCHAR
- X#define HERC_HCHAR PC_HCHAR
- X#define HERC_VTIC 4
- X#define HERC_HTIC 5
- X
- Xint line_herc;
- X
- XHERC_init()
- X{
- X H_init();
- X}
- X
- XHERC_graphics()
- X{
- X HVmode(1);
- X graphics_on = TRUE;
- X}
- X
- XHERC_text()
- X{
- X if (graphics_on) {
- X graphics_on = FALSE;
- X pause();
- X }
- X HVmode(0);
- X}
- X
- XHERC_linetype(linetype)
- X{
- X if (linetype >= 5)
- X linetype %= 5;
- X H_mask(pattern[linetype+2]);
- X line_herc = linetype;
- X}
- X
- XHERC_move(x,y)
- X{
- X if (x < 0)
- X startx = 0;
- X else if (x > HERC_XLAST)
- X startx = HERC_XLAST;
- X else
- X startx = x;
- X
- X if (y < 0)
- X starty = 0;
- X else if (y > HERC_YLAST)
- X starty = HERC_YLAST;
- X else
- X starty = y;
- X}
- X
- XHERC_vector(x,y)
- X{
- X if (x < 0)
- X x = 0;
- X else if (x > HERC_XLAST)
- X x = HERC_XLAST;
- X if (y < 0)
- X y = 0;
- X else if (y > HERC_YLAST)
- X y = HERC_YLAST;
- X
- X H_line(startx,HERC_YLAST-starty,x,HERC_YLAST-y);
- X startx = x;
- X starty = y;
- X}
- X
- X
- XHERC_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- Xint i;
- Xint line;
- X line= line_herc; /* disable the dotted lines temporarily */
- X H_mask(pattern[0]);
- X switch(pc_angle) {
- X case 0 : y -= HERC_VCHAR/2;
- X break;
- X case 1 : x += HERC_VCHAR/2;
- X break;
- X }
- X for (i=0;str[i];i++) {
- X PC_putc(x,HERC_YLAST-y,str[i],pc_angle,H_line);
- X switch(pc_angle) {
- X case 0 : x+=HERC_HCHAR ;
- X break;
- X case 1 : y+=HERC_HCHAR ;
- X break;
- X }
- X }
- X H_mask(pattern[line]); /* enable dotted lines */
- X}
- X
- X
- X#define HERC_text_angle PC_text_angle
- X
- X#define HERC_reset PC_reset
- X
- X
- X#endif /* HERCULES */
- X
- X
- X/* thanks to sask!macphed (Geoff Coleman and Ian Macphedran) for the
- X ATT 6300 driver */
- X
- X
- X#ifdef ATT6300
- X
- X#define ATT_XMAX 640
- X#define ATT_YMAX 400
- X
- X#define ATT_XLAST (ATT_XMAX - 1)
- X#define ATT_YLAST (ATT_YMAX - 1)
- X
- X#define ATT_VCHAR PC_VCHAR
- X#define ATT_HCHAR PC_HCHAR
- X#define ATT_VTIC 4
- X#define ATT_HTIC 5
- X
- X#define ATT_init CGA_init
- X
- XATT_graphics()
- X{
- X graphics_on = TRUE;
- X Vmode(0x40); /* 40H is the magic number for the AT&T driver */
- X}
- X
- X#define ATT_text CGA_text
- X
- X#define ATT_linetype CGA_linetype
- X
- X#define ATT_move CGA_move
- X
- XATT_vector(x,y)
- X{
- X PC_line(startx,ATT_YLAST-starty,x,ATT_YLAST-y);
- X startx = x;
- X starty = y;
- X}
- X
- X
- XATT_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- Xint i;
- Xint line;
- X line= line_cga; /* disable the dotted lines temporarily */
- X PC_mask(pattern[0]);
- X switch(pc_angle) {
- X case 0 : y -= ATT_VCHAR/2;
- X break;
- X case 1 : x += ATT_VCHAR/2;
- X break;
- X }
- X for (i=0;str[i];i++) {
- X PC_putc(x,ATT_YLAST-y,str[i],pc_angle,PC_line);
- X switch(pc_angle) {
- X case 0 : x+=ATT_HCHAR ;
- X break;
- X case 1 : y+=ATT_HCHAR ;
- X break;
- X }
- X }
- X PC_mask(pattern[line]); /* enable dotted lines */
- X}
- X
- X
- X#define ATT_text_angle PC_text_angle
- X
- X#define ATT_reset CGA_reset
- X
- X#endif /* ATT6300 */
- X
- X
- X#ifdef CORONA
- X
- X#define COR_XMAX 640
- X#define COR_YMAX 325
- X
- X#define COR_XLAST (COR_XMAX - 1)
- X#define COR_YLAST (COR_YMAX - 1)
- X
- X#define COR_VCHAR PC_VCHAR
- X#define COR_HCHAR PC_HCHAR
- X#define COR_VTIC 4
- X#define COR_HTIC 5
- X
- Xint line_cor;
- X
- Xstatic int corscreen; /* screen number, 0 - 7 */
- X
- XCOR_init()
- X{
- Xregister char *p;
- X if (!(p = getenv("CORSCREEN")))
- X int_error("must run CORPLOT for Corona graphics",NO_CARET);
- X corscreen = *p - '0';
- X}
- X
- XCOR_graphics()
- X{
- X graphics_on = TRUE;
- X Vmode(3); /* clear text screen */
- X grinit(corscreen);
- X grandtx();
- X}
- X
- XCOR_text()
- X{
- X if (graphics_on) {
- X graphics_on = FALSE;
- X pause();
- X }
- X grreset();
- X txonly();
- X Vmode(3);
- X}
- X
- XCOR_linetype(linetype)
- X{
- X if (linetype >= 5)
- X linetype %= 5;
- X line_cor = linetype;
- X Cor_mask(pattern[linetype+2]);
- X}
- X
- XCOR_move(x,y)
- X{
- X if (x < 0)
- X startx = 0;
- X else if (x > COR_XLAST)
- X startx = COR_XLAST;
- X else
- X startx = x;
- X
- X if (y < 0)
- X starty = 0;
- X else if (y > COR_YLAST)
- X starty = COR_YLAST;
- X else
- X starty = y;
- X}
- X
- XCOR_vector(x,y)
- X{
- X if (x < 0)
- X x = 0;
- X else if (x > COR_XLAST)
- X x = COR_XLAST;
- X if (y < 0)
- X y = 0;
- X else if (y > COR_YLAST)
- X y = COR_YLAST;
- X
- X Cor_line(startx,COR_YLAST-starty,x,COR_YLAST-y);
- X startx = x;
- X starty = y;
- X}
- X
- X
- XCOR_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- Xint i;
- Xint line;
- X line= line_cor; /* disable the dotted lines temporarily */
- X Cor_mask(pattern[0]);
- X switch(pc_angle) {
- X case 0 : y -= COR_VCHAR/2;
- X break;
- X case 1 : x += COR_VCHAR/2;
- X break;
- X }
- X for (i=0;str[i];i++) {
- X PC_putc(x,COR_YLAST-y,str[i],pc_angle,Cor_line);
- X switch(pc_angle) {
- X case 0 : x+=COR_HCHAR ;
- X break;
- X case 1 : y+=COR_HCHAR ;
- X break;
- X }
- X }
- X COR_mask(pattern[line]); /* enable dotted lines */
- X}
- X
- X
- X#define COR_text_angle PC_text_angle
- X
- X#define COR_reset PC_reset
- X
- X#endif /* CORONA */
- X
- X
- X#else /* ifndef __TURBOC__ */
- X/* all of the Turbo C routines for the different graphics devices go here */
- X
- Xint PC_text_angle(ang)
- Xint ang;
- X{
- X pc_angle = ang;
- X switch (ang) {
- X case 0 : settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
- X break;
- X case 1 : settextstyle(DEFAULT_FONT,VERT_DIR,1);
- X break;
- X }
- X return TRUE;
- X}
- X
- Xint PC_justify_text(mode)
- Xenum JUSTIFY mode;
- X{
- X switch(mode) {
- X case LEFT :
- X settextjustify(LEFT_TEXT,CENTER_TEXT);
- X break;
- X case CENTRE :
- X settextjustify(CENTER_TEXT,CENTER_TEXT);
- X break;
- X case RIGHT:
- X settextjustify(RIGHT_TEXT,CENTER_TEXT);
- X break;
- X }
- X return TRUE;
- X}
- X
- X
- X#define VGA_XMAX 640
- X#define VGA_YMAX 480
- X
- X#define VGA_XLAST (VGA_XMAX - 1)
- X#define VGA_YLAST (VGA_YMAX - 1)
- X
- X#define VGA_VCHAR 10
- X#define VGA_HCHAR 8
- X#define VGA_VTIC 4
- X#define VGA_HTIC 5
- X
- Xstatic int vga256color[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
- X
- Xstatic int *vgacolor;
- X
- X#define VGA_reset EGALIB_reset
- X#define VGA_text EGALIB_text
- X#define VGA_move EGALIB_move
- X#define VGA_vector EGALIB_vector
- X#define VGA_text_angle PC_text_angle
- X#define VGA_justify_text PC_justify_text
- X
- XVGA_init()
- X{
- X g_driver=VGA;
- X g_mode=2;
- X initgraph(&g_driver,&g_mode,path);
- X if(g_driver!=9){
- X term=0;
- X switch (g_driver){
- X case -2: fprintf(stderr,"Graphics card not detected.\n");
- X break;
- X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
- X break;
- X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
- X break;
- X case -5: fprintf(stderr,"Insufficient memory to load ",
- X "graphics driver.");
- X break;
- X }
- X
- X/* int_error("color VGA board not found",NO_CARET);*/
- X }
- X if(g_driver==VGA) vgacolor=vga256color;
- X}
- X
- XVGA_graphics()
- X{ g_driver=VGA;
- X g_mode=2;
- X graphics_on = TRUE;
- X initgraph(&g_driver,&g_mode,path);
- X VGA_justify_text(LEFT);
- X}
- X
- XVGA_linetype(linetype)
- X{
- X if (linetype >= 13)
- X linetype %= 13;
- X setcolor(vgacolor[linetype+2]);
- X}
- X
- XVGA_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- X strcpy((char far *)buf,str);
- X outtextxy(x,VGA_YLAST-y,buf);
- X}
- X
- X
- XVGAMONO_linetype(linetype)
- X{
- X if (linetype >= 5)
- X linetype %= 5;
- X setlinestyle(4,pattern[linetype+2],1);
- X}
- X
- X#define MCGA_XMAX 640
- X#define MCGA_YMAX 480
- X
- X#define MCGA_XLAST (MCGA_XMAX - 1)
- X#define MCGA_YLAST (MCGA_YMAX - 1)
- X
- X#define MCGA_VCHAR 10
- X#define MCGA_HCHAR 8
- X#define MCGA_VTIC 4
- X#define MCGA_HTIC 5
- X
- Xstatic int *MCGAcolor;
- X
- X#define MCGA_reset EGALIB_reset
- X#define MCGA_text EGALIB_text
- X#define MCGA_move EGALIB_move
- X#define MCGA_vector EGALIB_vector
- X#define MCGA_text_angle PC_text_angle
- X#define MCGA_justify_text PC_justify_text
- X
- XMCGA_init()
- X{
- X g_driver=MCGA;
- X g_mode=5;
- X initgraph(&g_driver,&g_mode,path);
- X if(g_driver!=2){
- X term=0;
- X switch (g_driver){
- X case -2: fprintf(stderr,"Graphics card not detected.\n");
- X break;
- X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
- X break;
- X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
- X break;
- X case -5: fprintf(stderr,"Insufficient memory to load ",
- X "graphics driver.");
- X break;
- X }
- X
- X }
- X}
- X
- XMCGA_graphics()
- X{ g_driver=MCGA;
- X g_mode=5;
- X graphics_on = TRUE;
- X initgraph(&g_driver,&g_mode,path);
- X MCGA_justify_text(LEFT);
- X}
- X
- X
- XMCGA_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- X strcpy((char far *)buf,str);
- X outtextxy(x,MCGA_YLAST-y,buf);
- X}
- X
- X
- XMCGA_linetype(linetype)
- X{
- X if (linetype >= 5)
- X linetype %= 5;
- X setlinestyle(4,pattern[linetype+2],1);
- X}
- X
- X
- X#define EGALIB_XMAX 640
- X#define EGALIB_YMAX 350
- X
- X#define EGALIB_XLAST (EGALIB_XMAX - 1)
- X#define EGALIB_YLAST (EGALIB_YMAX - 1)
- X
- X#define EGALIB_VCHAR 10
- X#define EGALIB_HCHAR 8
- X#define EGALIB_VTIC 4
- X#define EGALIB_HTIC 5
- X
- Xstatic int ega64color[] = {1,1,5,4,3,5,4,3, 5, 4, 3, 5, 4, 3,5};
- Xstatic int ega256color[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
- X
- Xstatic int *egacolor;
- X
- X#define EGALIB_text_angle PC_text_angle
- X#define EGALIB_justify_text PC_justify_text
- X
- XEGALIB_init()
- X{
- X g_driver=EGA;
- X g_mode=1;
- X initgraph(&g_driver,&g_mode,path);
- X if(g_driver<3 || g_driver>4){
- X term=0;
- X switch (g_driver){
- X case -2: fprintf(stderr,"Graphics card not detected.\n");
- X break;
- X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
- X break;
- X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
- X break;
- X case -5: fprintf(stderr,"Insufficient memory to load ",
- X "graphics driver.");
- X break;
- X }
- X
- X/* int_error("color EGA board not found",NO_CARET);*/
- X }
- X if(g_driver==EGA) egacolor=ega256color;
- X if(g_driver==EGA64) egacolor=ega64color;
- X}
- X
- XEGALIB_graphics()
- X{
- X graphics_on = TRUE;
- X initgraph(&g_driver,&g_mode,path);
- X EGALIB_justify_text(LEFT);
- X}
- X
- XEGALIB_text()
- X{
- X if (graphics_on) {
- X graphics_on = FALSE;
- X pause();
- X }
- X closegraph();
- X}
- X
- XEGALIB_linetype(linetype)
- X{
- X if (linetype >= 13)
- X linetype %= 13;
- X setcolor(egacolor[linetype+2]);
- X}
- X
- XEGALIB_move(x,y)
- X{
- X moveto(x,getmaxy()-y);
- X}
- X
- X
- XEGALIB_vector(x,y)
- X{
- X lineto(x,getmaxy()-y);
- X}
- X
- X
- XEGALIB_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- X strcpy((char far *)buf,str);
- X outtextxy(x,EGALIB_YLAST-y,buf);
- X}
- X
- X
- XEGALIB_reset()
- X{
- X closegraph();
- X}
- X
- X
- X#define CGA_XMAX 640
- X#define CGA_YMAX 200
- X
- X#define CGA_XLAST (CGA_XMAX - 1)
- X#define CGA_YLAST (CGA_YMAX - 1)
- X
- X#define CGA_VCHAR 10
- X#define CGA_HCHAR 8
- X#define CGA_VTIC 4
- X#define CGA_HTIC 6
- X
- X#define CGA_text_angle PC_text_angle
- X#define CGA_justify_text PC_justify_text
- X#define CGA_reset PC_reset
- X
- XCGA_init()
- X{
- X g_driver=CGA;
- X g_mode=4;
- X initgraph(&g_driver,&g_mode,path);
- X switch (g_driver){
- X case -2: fprintf(stderr,"Graphics card not detected.\n");
- X break;
- X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
- X break;
- X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
- X break;
- X case -5: fprintf(stderr,"Insufficient memory to load ",
- X "graphics driver.");
- X break;
- X }
- X/* PC_color(1); monochrome */
- X
- X}
- X
- XCGA_graphics()
- X{
- X graphics_on = TRUE;
- X g_driver=CGA;
- X g_mode=4;
- X initgraph(&g_driver,&g_mode,path);
- X CGA_justify_text(LEFT);
- X /* Vmode(6);*/
- X}
- X
- X#define CGA_text PC_text
- X
- XCGA_linetype(linetype)
- X{
- X if (linetype >= 5)
- X linetype %= 5;
- X setlinestyle(4,pattern[linetype+2],1);
- X}
- X
- XCGA_move(x,y)
- X{
- X moveto(x,getmaxy()-y);
- X}
- X
- X
- XCGA_vector(x,y)
- X{
- X lineto(x,getmaxy()-y);
- X}
- X
- XCGA_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- X strcpy((char far *)buf,str);
- X outtextxy(x,CGA_YLAST-y,buf);
- X}
- X
- X
- X
- X#define HERC_XMAX 720
- X#define HERC_YMAX 348
- X
- X#define HERC_XLAST (HERC_XMAX - 1)
- X#define HERC_YLAST (HERC_YMAX - 1)
- X
- X#define HERC_VCHAR 10
- X#define HERC_HCHAR 8
- X#define HERC_VTIC 4
- X#define HERC_HTIC 5
- X
- X#define HERC_text_angle PC_text_angle
- X#define HERC_justify_text PC_justify_text
- X#define HERC_reset PC_reset
- X
- XHERC_init()
- X{
- X g_driver=HERCMONO;
- X g_mode=0;
- X initgraph(&g_driver,&g_mode,path);
- X switch (g_driver){
- X case -2: fprintf(stderr,"Graphics card not detected.\n");
- X break;
- X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
- X break;
- X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
- X break;
- X case -5: fprintf(stderr,"Insufficient memory to load ",
- X "graphics driver.");
- X break;
- X }
- X}
- X
- XHERC_graphics()
- X{
- X g_driver=HERCMONO;
- X g_mode=0;
- X initgraph(&g_driver,&g_mode,path);
- X HERC_justify_text(LEFT);
- X graphics_on = TRUE;
- X}
- X
- XHERC_text()
- X{
- X if (graphics_on) {
- X graphics_on = FALSE;
- X pause();
- X }
- X closegraph();
- X}
- X
- XHERC_linetype(linetype)
- X{
- X if (linetype >= 5)
- X linetype %= 5;
- X setlinestyle(4,pattern[linetype+2],1);
- X}
- X
- XHERC_move(x,y)
- X{
- X if (x < 0)
- X x = 0;
- X else if (x > HERC_XLAST)
- X x = HERC_XLAST;
- X
- X if (y < 0)
- X y = 0;
- X else if (y > HERC_YLAST)
- X y = HERC_YLAST;
- X moveto(x,getmaxy()-y);
- X}
- X
- XHERC_vector(x,y)
- X{
- X if (x < 0)
- X x = 0;
- X else if (x > HERC_XLAST)
- X x = HERC_XLAST;
- X if (y < 0)
- X y = 0;
- X else if (y > HERC_YLAST)
- X y = HERC_YLAST;
- X
- X lineto(x,getmaxy()-y);
- X}
- X
- X
- XHERC_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- X strcpy((char far *)buf,str);
- X outtextxy(x,HERC_YLAST-y,buf);
- X}
- X
- X
- X#endif /* ifndef __TURBOC__ */
- X
- *-*-END-of-term/pc.trm-*-*
- echo x - term/qms.trm
- sed 's/^X//' >term/qms.trm <<'*-*-END-of-term/qms.trm-*-*'
- X/* GNUPLOT - qms.trm */
- X/*
- 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 * QMS laser printers
- X *
- X * AUTHORS
- X * Colin Kelley, Thomas Williams, Russell Lang
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X#define QMS_XMAX 9000
- X#define QMS_YMAX 6000
- X
- X#define QMS_XLAST (QMS_XMAX - 1)
- X#define QMS_YLAST (QMS_YMAX - 1)
- X
- X#define QMS_VCHAR 120
- X#define QMS_HCHAR 70
- X#define QMS_VTIC 70
- X#define QMS_HTIC 70
- X
- Xint qms_line = 0; /* to remember current line type */
- X
- XQMS_init()
- X{
- X/* This was just ^IOL, but at Rutgers at least we need some more stuff */
- X fprintf(outfile,"^PY^-\n^IOL\n^ISYNTAX00000^F^IB11000^IJ00000^IT00000\n");
- X/* ^ QUIC on ^set defaults ^ set botttom,top,left margins
- X ^landscape ^free format */
- X/* set defaults are: implicit decimal point, units in inches,
- X numbers left justified, units in 1/1000 inch, do not ignore spaces */
- X/* margins are in 1/1000 inch units */
- X}
- X
- X
- XQMS_graphics()
- X{
- X fprintf(outfile,"^IGV\n");
- X/* ^enter graphics vector mode */
- X}
- X
- X
- X
- XQMS_text()
- X{
- X/* added ^-, because ^, after an ^I command doesn't actually print a page */
- X/* Did anybody try this code out? [uhh...-cdk] */
- X fprintf(outfile,"^IGE\n^-^,");
- X/* ^exit graphics vector mode
- X ^pass terminator
- X ^print page */
- X}
- X
- X
- XQMS_linetype(linetype)
- Xint linetype;
- X{
- Xstatic int width[2+9] = {7, 3, 3, 3, 3, 5, 5, 5, 7, 7, 7};
- Xstatic int type[2+9] = {0, 1, 0, 2, 3, 0, 2, 3, 0, 2, 3};
- X/*
- X * I don't know about Villanova, but on our printer, using ^V without
- X * previously setting up a pattern crashes the microcode.
- X * [nope, doesn't crash here. -cdk]
- X * [it generates a controller error here on dotted lines. - rjl]
- X */
- X/* Code to define patterns added by rjl
- X * According to the manual it should work - but it doesn't
- X */
- X qms_line = linetype;
- X if (linetype >= 9)
- X linetype %= 9;
- X fprintf(outfile,"^PW%02d\n",width[linetype+2]);
- X/* ^width in dots */
- X switch (type[linetype+2]) {
- X case 1 : /* short dash */
- X fprintf(outfile,"^PV102025^G\n^V1\n");
- X/* ^PV = define pattern vector, 1 = pattern number,
- X 02 = number of pen downs and ups, 025 = .025" length of ups/downs */
- X break;
- X case 2 : /* medium dash */
- X fprintf(outfile,"^PV202050^G\n^V2\n");
- X break;
- X case 3 : /* long dash */
- X fprintf(outfile,"^PV302100^G\n^V3\n");
- X break;
- X default:
- X case 0 :
- X fprintf(outfile,"^V0\n");
- X break;
- X }
- X}
- X
- X
- XQMS_move(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"^U%05d:%05d\n", 1000 + x, QMS_YLAST + 1000 - y);
- X/* ^pen up vector*/
- X}
- X
- X
- XQMS_vector(x2,y2)
- Xint x2,y2;
- X{
- X fprintf(outfile,"^D%05d:%05d\n", 1000 + x2, QMS_YLAST + 1000 - y2);
- X/* ^pen down vector*/
- X}
- X
- X
- XQMS_put_text(x,y,str)
- Xunsigned int x,y;
- Xchar str[];
- X{
- Xchar ch;
- X QMS_move(x,y + QMS_VCHAR/3);
- X fputs("^IGE\n",outfile);
- X ch = *str++;
- X while(ch!='\0') {
- X if (ch=='^')
- X putc('^',outfile);
- X putc(ch,outfile);
- X ch = *str++;
- X }
- X fputs("\n^IGV\n",outfile);
- X QMS_linetype(qms_line); /* restore line type */
- X}
- X
- X
- XQMS_reset()
- X{
- X fprintf(outfile,"^PN^-\n");
- X/* ^QUIC off*/
- X}
- X
- *-*-END-of-term/qms.trm-*-*
- echo x - term/regis.trm
- sed 's/^X//' >term/regis.trm <<'*-*-END-of-term/regis.trm-*-*'
- X/* GNUPLOT - regis.trm */
- X/*
- 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 * REGIS devices
- X *
- X * AUTHORS
- X * Colin Kelley, Thomas Williams
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X#define REGISXMAX 800
- X#define REGISYMAX 440
- X
- X#define REGISXLAST (REGISXMAX - 1)
- X#define REGISYLAST (REGISYMAX - 1)
- X
- X#define REGISVCHAR 20
- X#define REGISHCHAR 9
- X#define REGISVTIC 8
- X#define REGISHTIC 6
- X
- Xint REGISang = 0;
- X
- XREGISinit()
- X{
- X fprintf(outfile,"\033[r\033[24;1H");
- X/* 1 2
- X 1. reset scrolling region
- X 2. locate cursor on bottom line
- X*/
- X}
- X
- X
- X/* thanks to calmasd!dko (Dan O'Neill) for adding S(E) for vt125s */
- XREGISgraphics()
- X{
- X fprintf(outfile,"\033[2J\033P1pS(C0)S(E)");
- X/* 1 2 3 4 5
- X 1. clear screen
- X 2. enter ReGIS graphics
- X 3. turn off graphics diamond cursor
- X 4. clear graphics screen
- X*/
- X (void) REGIStext_angle(0); /* select text size and angle */
- X}
- X
- X
- XREGIStext()
- X{
- X fprintf(outfile,"\033\\\033[24;1H");
- X/* 1 2
- X 1. Leave ReGIS graphics mode
- X 2. locate cursor on last line of screen
- X*/
- X}
- X
- X
- XREGISlinetype(linetype)
- Xint linetype;
- X{
- X /* This will change color in order G,R,B,G-dot,R-dot,B-dot */
- Xstatic int in_map[9 + 2] = {2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1};
- Xstatic int lt_map[9 + 2] = {1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6};
- X
- X if (linetype >= 9)
- X linetype %= 9;
- X fprintf(outfile, "W(I%d)", in_map[linetype + 2]);
- X fprintf(outfile, "W(P%d)", lt_map[linetype + 2]);
- X}
- X
- X
- XREGISmove(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"P[%d,%d]",x,REGISYLAST-y,x,REGISYLAST-y);
- X}
- X
- X
- XREGISvector(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"v[]v[%d,%d]",x,REGISYLAST - y);
- X/* the initial v[] is needed to get the first pixel plotted */
- X}
- X
- X
- X/* put_text and text_angle by rjl */
- XREGISput_text(x,y,str)
- Xint x, y;
- Xchar *str;
- X{
- X if (REGISang==1)
- X REGISmove(x-REGISVCHAR/2-1,y);
- X else
- X REGISmove(x,y+REGISVCHAR/2-1);
- X (void) putc('T',outfile); (void) putc('\'',outfile);
- X while (*str) {
- X (void) putc(*str,outfile);
- X if (*str == '\'')
- X (void) putc('\'',outfile); /* send out another one */
- X str++;
- X }
- X (void) putc('\'',outfile);
- X}
- X
- X
- Xint REGIStext_angle(ang)
- Xint ang;
- X{
- X REGISang = ang;
- X if (ang == 1)
- X fputs("T(D90,S1)",outfile);
- X else
- X fputs("T(D0,S1)",outfile);
- X return TRUE;
- X}
- X
- X
- XREGISreset()
- X{
- X fprintf(outfile,"\033[2J\033[24;1H");
- X}
- X
- *-*-END-of-term/regis.trm-*-*
- echo x - term/tek.trm
- sed 's/^X//' >term/tek.trm <<'*-*-END-of-term/tek.trm-*-*'
- X/* GNUPLOT - tek.trm */
- X/*
- 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 * tek40xx, bitgraph, kermit_color_tek40xx, kermit_mono_tek40xx, selanar
- X *
- X * AUTHORS
- X * Colin Kelley, Thomas Williams, Russell Lang
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X#ifdef TEK
- X
- X#define TEK40XMAX 1024
- X#define TEK40YMAX 780
- X
- X#define TEK40XLAST (TEK40XMAX - 1)
- X#define TEK40YLAST (TEK40YMAX - 1)
- X
- X#define TEK40VCHAR 25
- X#define TEK40HCHAR 14
- X#define TEK40VTIC 11
- X#define TEK40HTIC 11
- X
- X#define HX 0x20 /* bit pattern to OR over 5-bit data */
- X#define HY 0x20
- X#define LX 0x40
- X#define LY 0x60
- X
- X#define LOWER5 31
- X#define UPPER5 (31<<5)
- X
- X
- XTEK40init()
- X{
- X}
- X
- X
- XTEK40graphics()
- X{
- X fprintf(outfile,"\033\014");
- X/* 1
- X 1. clear screen
- X*/
- X (void) fflush(outfile);
- X sleep(1);
- X /* sleep 1 second to allow screen time to clear on real
- X tektronix terminals */
- X}
- X
- XTEK40text()
- X{
- X TEK40move(0,12);
- X fprintf(outfile,"\037");
- X/* 1
- X 1. into alphanumerics
- X*/
- X}
- X
- X
- XTEK40linetype(linetype)
- Xint linetype;
- X{
- X}
- X
- XTEK40move(x,y)
- Xunsigned int x,y;
- X{
- X (void) putc('\035', outfile); /* into graphics */
- X TEK40vector(x,y);
- X}
- X
- X
- XTEK40vector(x,y)
- Xunsigned int x,y;
- X{
- X (void) putc((HY | (y & UPPER5)>>5), outfile);
- X (void) putc((LY | (y & LOWER5)), outfile);
- X (void) putc((HX | (x & UPPER5)>>5), outfile);
- X (void) putc((LX | (x & LOWER5)), outfile);
- X}
- X
- X
- XTEK40put_text(x,y,str)
- Xunsigned int x,y;
- Xchar str[];
- X{
- X TEK40move(x,y-11);
- X fprintf(outfile,"\037%s\n",str);
- X}
- X
- X
- XTEK40reset()
- X{
- X}
- X
- X#endif /* TEK */
- X
- X
- X
- X/* thanks to dukecdu!evs (Ed Simpson) for the BBN BitGraph driver */
- X
- X#ifdef BITGRAPH
- X
- X#define BG_XMAX 768 /* width of plot area */
- X#define BG_YMAX 768 /* height of plot area */
- X#define BG_SCREEN_HEIGHT 1024 /* full screen height */
- X
- X#define BG_XLAST (BG_XMAX - 1)
- X#define BG_YLAST (BG_YMAX - 1)
- X
- X#define BG_VCHAR 16
- X#define BG_HCHAR 9
- X#define BG_VTIC 8
- X#define BG_HTIC 8
- X
- X
- X#define BG_init TEK40init
- X
- X#define BG_graphics TEK40graphics
- X
- X
- X#define BG_linetype TEK40linetype
- X
- X#define BG_move TEK40move
- X
- X#define BG_vector TEK40vector
- X
- X
- XBG_text()
- X{
- X BG_move(0, BG_SCREEN_HEIGHT - 2 * BG_VCHAR);
- X fprintf(outfile,"\037");
- X/* 1
- X 1. into alphanumerics
- X*/
- X}
- X
- X
- XBG_put_text(x,y,str)
- Xunsigned int x,y;
- Xchar str[];
- X{
- X BG_move(x,y-11);
- X fprintf(outfile,"\037%s\n",str);
- X}
- X
- X
- X#define BG_reset TEK40reset
- X
- X#endif /* BITGRAPH */
- X
- X
- X/* Color and Monochrome specials for the MS-Kermit Tektronix Emulator
- X by Russell Lang, eln272v@monu1.cc.monash.oz */
- X
- X#ifdef KERMIT
- X
- X#define KTEK40HCHAR 13
- X
- XKTEK40graphics()
- X{
- X fprintf(outfile,"\033\014");
- X/* 1
- X 1. clear screen
- X*/
- X /* kermit tektronix emulation doesn't need to wait */
- X}
- X
- XKTEK40Ctext()
- X{
- X TEK40text();
- X KTEK40Clinetype(0); /* change to green */
- X}
- X
- X/* special color linetypes for MS-DOS Kermit v2.31 tektronix emulator */
- X/* 0 = normal, 1 = bright
- X foreground color (30-37) = 30 + colors
- X where colors are 1=red, 2=green, 4=blue */
- Xstatic char *kermit_color[15]= {"\033[0;37m","\033[1;30m",
- X "\033[0;32m","\033[0;36m","\033[0;31m","\033[0;35m",
- X "\033[1;34m","\033[1;33m","\033[1;31m","\033[1;37m",
- X "\033[1;35m","\033[1;32m","\033[1;36m","\033[0;34m",
- X "\033[0;33m"};
- X
- XKTEK40Clinetype(linetype)
- Xint linetype;
- X{
- X if (linetype >= 13)
- X linetype %= 13;
- X fprintf(outfile,"%s",kermit_color[linetype+2]);
- X}
- X
- X
- X/* linetypes for MS-DOS Kermit v2.30 tektronix emulator */
- X/* `=solid, a=fine dots, b=short dashes, c=dash dot,
- X d=long dash dot, e=dash dot dot */
- Xstatic char *kerm_linetype = "`a`abcde" ;
- X
- XKTEK40Mlinetype(linetype)
- Xint linetype;
- X{
- X if (linetype >= 6)
- X linetype %= 6;
- X fprintf(outfile,"\033%c",kerm_linetype[linetype+2]);
- X}
- X
- XKTEK40reset()
- X{
- X fprintf(outfile,"\030\n"); /* turn off Tek emulation */
- X}
- X
- X#endif /* KERMIT */
- X
- X
- X/* thanks to sask!macphed (Geoff Coleman and Ian Macphedran) for the
- X Selanar driver */
- X
- X#ifdef SELANAR
- X
- XSEL_init()
- X{
- X fprintf(outfile,"\033\062");
- X/* 1
- X 1. set to ansi mode
- X*/
- X}
- X
- X
- XSEL_graphics()
- X{
- X fprintf(outfile,"\033[H\033[J\033\061\033\014");
- X/* 1 2 3
- X 1. clear ANSI screen
- X 2. set to TEK mode
- X 3. clear screen
- X*/
- X}
- X
- X
- XSEL_text()
- X{
- X TEK40move(0,12);
- X fprintf(outfile,"\033\062");
- X/* 1
- X 1. into ANSI mode
- X*/
- X}
- X
- XSEL_reset()
- X{
- X fprintf(outfile,"\033\061\033\012\033\062\033[H\033[J");
- X/* 1 2 3 4
- X1 set tek mode
- X2 clear screen
- X3 set ansi mode
- X4 clear screen
- X*/
- X}
- X#endif /* SELANAR */
- X
- *-*-END-of-term/tek.trm-*-*
- echo x - term/unixpc.trm
- sed 's/^X//' >term/unixpc.trm <<'*-*-END-of-term/unixpc.trm-*-*'
- X/* GNUPLOT - unixpc.trm */
- X/*
- 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 * Unix PC's (ATT 3b1)
- X *
- X * AUTHORS
- X * John Campbell
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X/*
- X>From: John Campbell (...!arizona!naucse!jdc)
- X
- XI originally ported gnuplot to the ATT 3b1 (ATT7300) on 12/4/88, and then
- Xadded the minimal code needed to bring it up to 2.0 level on 1/28/90. The
- X3b1, as I view it, is a 720x300 bitmapped, monochrome display (often people
- Xdon't use the top 12 scan lines and thus the effective size is 720x288). I
- Xtried to maximize the size of the graph area, by using these top 12 lines
- X(normally reserved) and set up a signal handler to restore them upon exit,
- Xabort, etc.
- X
- XLine styles were "fudged" (they do not know the aspect ratio). The same
- Xline style may look different depending upon the slope of the curve. Due to
- Xthis only 4 line styles were implemented. While more line types are possible,
- Xthe current styles were chosen as distinguishable.
- X
- XThe 3b1 has 4 "special" rows at the bottom that I could not use in graphics
- Xmode. It has been suggested that we use these lines for command prompting.
- XOthers have requested that we have a graphics window and a command window.
- XMy experience with gnuplot only includes relatively dumb graphics devices--
- Xhence gnuplot "looks and feels" normal to me the way I implemented it.
- XI welcome either of these changes from someone else, however.
- X*/
- X
- X#include <sys/window.h> /* Started with tam.h--too much trouble. */
- X#include <sys/signal.h>
- X#include <errno.h>
- X
- X#define uPC_HIGH_BIT (0x8000)
- X
- Xtypedef unsigned short Scr_type;
- Xtypedef unsigned char Scr_kluge;
- X
- X#define uPC_XMAX 720
- X#define uPC_YMAX 300
- X
- X#define uPC_XSIZE 45 /* Short ints. */
- X#define uPC_YSIZE uPC_YMAX
- X
- XScr_type uPC_display[uPC_YSIZE][uPC_XSIZE];
- Xint uPC_width = 2*uPC_XSIZE;
- Xint uPC_sx=0, uPC_sy=0;
- Xint uPC_cur_linetype=0;
- Xint uPC_angle = 0;
- Xunsigned short uPC_raster_count=0;
- Xstatic Scr_type lookup[] = {
- X 0x0001, 0x0002, 0x0004, 0x0008,
- X 0x0010, 0x0020, 0x0040, 0x0080,
- X 0x0100, 0x0200, 0x0400, 0x0800,
- X 0x1000, 0x2000, 0x4000, 0x8000,
- X };
- X
- X#define uPC_XLAST (uPC_XMAX - 1)
- X#define uPC_YLAST (uPC_YMAX - 1)
- X
- X#define uPC_VCHAR 11
- X#define uPC_HCHAR 7
- X#define uPC_VTIC 8
- X#define uPC_HTIC 12
- X
- Xextern errno, sys_nerr;
- Xextern char *sys_errlist[];
- X
- Xstatic struct urdata uPC_ur = {(unsigned short *)uPC_display, 2*uPC_XSIZE, 0, 0,
- X 0, 0, 0, 0, uPC_XMAX, uPC_YMAX, SRCSRC, DSTOR, 0};
- X
- X#define IfErrOut(e1,e2,s1,s2) if (e1 e2) {\
- Xfprintf(stderr, "%s:: %s %s\n", sys_errlist[errno], s1, s2);\
- XuPC_fixwind(0);\
- Xexit(-1);}
- X
- XuPC_init()
- X{
- X/* This routine will ioctl to change 0 size */
- X int i;
- X struct uwdata uw;
- X int uPC_fixwind();
- X short gw;
- X
- X/* Check that we are on the bitmapped window. */
- X if (iswind() != 0) {
- X fprintf (stderr, "Sorry--must run from the bitmapped terminal\n");
- X exit(-1);
- X }
- X for (i=1; i<=16; i++) {
- X if (i != SIGINT && i != SIGFPE) /* Two are caught in plot.c */
- X signal (i, uPC_fixwind);
- X }
- X
- X/* Increase the screen size */
- X uw.uw_x = 0;
- X uw.uw_y = 0; /* Leave room for top status line. */
- X uw.uw_width = uPC_XMAX; /* 720 */
- X uw.uw_height = uPC_YMAX; /* 288 normal--we clobber 12 (top row)*/
- X uw.uw_uflags = 1; /* Creates with no border */
- X
- X IfErrOut (ioctl(0, WIOCSETD, &uw), <0, "ioctl failed on", "WIOCSETD");
- X}
- X
- X
- XuPC_graphics()
- X{
- X/* This routine will clear the uPC_display buffer and window. */
- X register Scr_type *j;
- X register int i;
- X
- X j = (Scr_type *)uPC_display;
- X i = uPC_YSIZE*uPC_XSIZE + 1;
- X
- X while (--i)
- X *j++ = 0;
- X/*
- X Position the cursor to the bottom of the screen so when we come back to
- X text mode we are just below the graph.
- X*/
- X printf ("\033[25;1H");
- X
- X uPC_ur.ur_dstop = DSTSRC; /* replace (clear screen). */
- X IfErrOut (ioctl(0, WIOCRASTOP, &uPC_ur), <0,
- X "ioctl failed", "WIOCRASTOP");
- X uPC_ur.ur_dstop = DSTOR; /* Or in (show text) */
- X}
- X
- X
- XuPC_text()
- X{
- X/* This routine will flush the display. */
- X
- X IfErrOut (ioctl(0, WIOCRASTOP, &uPC_ur), <0,
- X "ioctl failed", "WIOCRASTOP");
- X}
- X
- X
- XuPC_linetype(linetype)
- Xint linetype;
- X{
- X/* This routine records the current linetype. */
- X if (uPC_cur_linetype != linetype) {
- X uPC_raster_count = 0;
- X uPC_cur_linetype = linetype;
- X }
- X}
- X
- X
- XuPC_move(x,y)
- Xunsigned int x,y;
- X{
- X/* This routine just records x and y in uPC_sx, uPC_sy */
- X uPC_sx = x;
- X uPC_sy = y;
- X}
- X
- X
- X/* Was just (*(a)|=(b)) */
- X#define uPC_PLOT(a,b) (uPC_cur_linetype != 0 ? uPC_plot_word (a,b) :\
- X *(a)|=(b))
- X
- XuPC_plot_word(a,b)
- XScr_type *a, b;
- X/*
- X Weak attempt to make line styles. The real problem is the aspect
- X ratio. This routine is called only when a bit is to be turned on in
- X a horizontal word. A better line style routine would know something
- X about the slope of the line around the current point (in order to
- X change weighting).
- X
- X This yields 3 working linetypes plus a usable axis line type.
- X*/
- X{
- X/* Various line types */
- X switch (uPC_cur_linetype) {
- X case -1:
- X /* Distinguish between horizontal and vertical axis. */
- X if (uPC_sx > uPC_XMAX/8 && uPC_sx < 7*uPC_XMAX/8) {
- X /* Fuzzy tolerance because we don't know exactly where the y axis is */
- X if (++uPC_raster_count % 2 == 0) *(a) |= b;
- X }
- X else {
- X /* Due to aspect ratio, take every other y pixel and every third x. */
- X *(a) |= (b & 0x9999);
- X }
- X break;
- X case 1:
- X case 5:
- X /* Make a | |----| |----| type of line. */
- X if ((1<<uPC_raster_count) & 0xF0F0) *(a) |= b;
- X if (++uPC_raster_count > 15) uPC_raster_count = 0;
- X break;
- X case 2:
- X case 6:
- X /* Make a |----|----|----|--- | | type of line. */
- X if ((1<<uPC_raster_count) & 0x0EFFF) *(a) |= b;
- X if (++uPC_raster_count > 19) uPC_raster_count = 0;
- X break;
- X case 3:
- X case 7:
- X /* Make a | - | - | - | - | type of line. */
- X if ((1<<uPC_raster_count) & 0x4444) *(a) |= b;
- X if (++uPC_raster_count > 15) uPC_raster_count = 0;
- X break;
- X case 4:
- X case 8:
- X default:
- X *(a) |= b;
- X break;
- X }
- X}
- X
- XuPC_vector(x,y)
- Xunsigned int x,y;
- X{
- X/* This routine calls line with x,y */
- X int x1 = uPC_sx, y1=uPC_sy, x2 = x, y2 = y;
- X register int c, e, dx, dy, width;
- X register Scr_type mask, *a;
- X
- X/* Record new sx, sy for next call to the vector routine. */
- X uPC_sx = x2;
- X uPC_sy = y2;
- X
- X a = &uPC_display[(uPC_YSIZE - 1) - y1][x1 >> 4];
- X mask = lookup[x1 & 0x0f];
- X width = uPC_width;
- X
- X if ((dx = x2 - x1) > 0) {
- X if ((dy = y2 - y1) > 0) {
- X if (dx > dy) { /* dx > 0, dy > 0, dx > dy */
- X dy <<= 1;
- X e = dy - dx;
- X c = dx + 2;
- X dx <<= 1;
- X
- X while (--c) {
- X uPC_PLOT(a, mask);
- X if (e >= 0) {
- X (Scr_kluge *)a -= width;
- X e -= dx;
- X }
- X if (mask & uPC_HIGH_BIT) {
- X mask = 1;
- X a++;
- X } else
- X mask <<= 1;
- X e += dy;
- X }
- X } else { /* dx > 0, dy > 0, dx <= dy */
- X dx <<= 1;
- X e = dx - dy;
- X c = dy + 2;
- X dy <<= 1;
- X
- X while (--c) {
- X uPC_PLOT(a, mask);
- X if (e >= 0) {
- X if (mask & uPC_HIGH_BIT) {
- X mask = 1;
- X a++;
- X } else
- X mask <<= 1;
- X e -= dy;
- X }
- X (Scr_kluge *)a -= width;
- X e += dx;
- X }
- X }
- X } else {
- X dy = -dy;
- X if (dx > dy) { /* dx > 0, dy <= 0, dx > dy */
- X dy <<= 1;
- X e = dy - dx;
- X c = dx + 2;
- X dx <<= 1;
- X
- X while (--c) {
- X uPC_PLOT(a, mask);
- X if (e >= 0) {
- X (Scr_kluge *)a += width;
- X e -= dx;
- X }
- X if (mask & uPC_HIGH_BIT) {
- X mask = 1;
- X a++;
- X } else
- X mask <<= 1;
- X e += dy;
- X }
- X } else { /* dx > 0, dy <= 0, dx <= dy */
- X dx <<= 1;
- X e = dx - dy;
- X c = dy + 2;
- X dy <<= 1;
- X
- X while (--c) {
- X uPC_PLOT(a, mask);
- X if (e >= 0) {
- X if (mask & uPC_HIGH_BIT) {
- X mask = 1;
- X a++;
- X } else
- X mask <<= 1;
- X e -= dy;
- X }
- X (Scr_kluge *)a += width;
- X e += dx;
- X }
- X }
- X }
- X } else {
- X dx = -dx;
- X if ((dy = y2 - y1) > 0) {
- X if (dx > dy) { /* dx <= 0, dy > 0, dx > dy */
- X dy <<= 1;
- X e = dy - dx;
- X c = dx + 2;
- X dx <<= 1;
- X
- X while (--c) {
- X uPC_PLOT(a, mask);
- X if (e >= 0) {
- X (Scr_kluge *)a -= width;
- X e -= dx;
- X }
- X if (mask & 1) {
- X mask = uPC_HIGH_BIT;
- X a--;
- X } else
- X mask >>= 1;
- X e += dy;
- X }
- X } else { /* dx <= 0, dy > 0, dx <= dy */
- X dx <<= 1;
- X e = dx - dy;
- X c = dy + 2;
- X dy <<= 1;
- X
- X while (--c) {
- X uPC_PLOT(a, mask);
- X if (e >= 0) {
- X if (mask & 1) {
- X mask = uPC_HIGH_BIT;
- X a--;
- X } else
- X mask >>= 1;
- X e -= dy;
- X }
- X (Scr_kluge *)a -= width;
- X e += dx;
- X }
- X }
- X } else {
- X dy = -dy;
- X if (dx > dy) { /* dx <= 0, dy <= 0, dx > dy */
- X dy <<= 1;
- X e = dy - dx;
- X c = dx + 2;
- X dx <<= 1;
- X
- X while (--c) {
- X uPC_PLOT(a, mask);
- X if (e >= 0) {
- X (Scr_kluge *)a += width;
- X e -= dx;
- X }
- X if (mask & 1) {
- X mask = uPC_HIGH_BIT;
- X a--;
- X } else
- X mask >>= 1;
- X e += dy;
- X }
- X } else { /* dx <= 0, dy <= 0, dx <= dy */
- X dx <<= 1;
- X e = dx - dy;
- X c = dy + 2;
- X dy <<= 1;
- X
- X while (--c) {
- X uPC_PLOT(a, mask);
- X if (e >= 0) {
- X if (mask & 1) {
- X mask = uPC_HIGH_BIT;
- X a--;
- X } else
- X mask >>= 1;
- X e -= dy;
- X }
- X (Scr_kluge *)a += width;
- X e += dx;
- X }
- X }
- X }
- X }
- X}
- X
- X
- X#ifdef uPC_NOT_USED
- X/* Added by Russell Lang, eln272v@monu1.cc.monash.oz */
- X This placement to the nearest character cell worked, and I'm leaving
- X it here so the calculations involved won't be lost! (jdc)
- X*/
- XuPC_put_text(x,y,str)
- Xunsigned int x,y;
- Xchar str[];
- X{
- X/* This routine puts the text at the cursor location nearest
- X to (x,y). Obviously the exact postion would look better */
- X
- X/* Just use the ANSI escape sequence CUP (iswind said that was ok!) */
- X printf ("\033[%d;%dH%s\033[25;1H", (int)(24-(y-uPC_VCHAR/2)*25/uPC_YMAX),
- X (int)(x*80/uPC_XMAX), str);
- X fflush (stdout);
- X}
- X#endif
- X
- X
- XuPC_put_text(x,y,str)
- Xunsigned int x,y;
- Xchar str[];
- X{
- X if (uPC_angle == 1)
- X x += uPC_VCHAR/2;
- X else
- X y -= uPC_VCHAR/2;
- X
- X switch (uPC_angle) {
- X case 0:
- X for (; *str; ++str, x += uPC_HCHAR)
- X uPC_putc (x, y, *str, uPC_angle);
- X break;
- X case 1:
- X for (; *str; ++str, y += uPC_HCHAR)
- X uPC_putc (x, y, *str, uPC_angle);
- X break;
- X }
- X}
- X
- X
- XuPC_putc (x, y, c, angle)
- Xunsigned int x, y;
- Xint c, angle;
- X/*
- X Put a character at an x,y location in the bit map (using the font5x7
- X array. This is mostly just copied from the epson driver.
- X*/
- X{
- X int i, j, k;
- X register Scr_type mask, *a;
- X char fc;
- X unsigned int pixelon;
- X
- X i = c - ' ';
- X for(j=0; j < 9; j++) {
- X fc = font5x7[i][j];
- X for (k=0; k < 5; k++) {
- X pixelon = ((unsigned int)(fc))>>k & 1;
- X if (pixelon) {
- X switch (angle) {
- X case 0:
- X mask = lookup[x+k+1 & 0x0f];
- X a = &uPC_display[(uPC_YSIZE - 1) - (y+j)][(x+k+1) >> 4];
- X break;
- X case 1:
- X mask = lookup[x-j & 0x0f];
- X a = &uPC_display[(uPC_YSIZE - 1) - (y+k+1)][(x-j) >> 4];
- X break;
- X }
- X *(a) |= (mask); /* see uPC_PLOT macro */
- X }
- X }
- X }
- X}
- X
- X
- XuPC_text_angle (ang)
- Xint ang;
- X{
- X uPC_angle = ang;
- X return TRUE;
- X}
- X
- X
- XuPC_reset()
- X{
- X/* Reset window to normal size. */
- X uPC_fixwind (0);
- X}
- X
- X
- X
- XuPC_fixwind(signo)
- Xint signo;
- X{
- X static struct uwdata wreset = { 0, 12, 720, 288, 0x1};
- X struct utdata ut;
- X
- X/* Reset the window to the right size. */
- X ioctl(0, WIOCSETD, &wreset); /* 0, not wncur here! */
- X
- X/* Scroll the screen once. (avoids typing over the same line) */
- X fprintf (stderr, "\n");
- X
- X if (signo) {
- X if (signo == SIGILL || signo == SIGTRAP || signo == SIGPWR)
- X signal (signo, SIG_DFL);
- X kill (0,signo); /* Redo the signal (as if we never trapped it). */
- X }
- X}
- *-*-END-of-term/unixpc.trm-*-*
- echo x - term/unixplot.trm
- sed 's/^X//' >term/unixplot.trm <<'*-*-END-of-term/unixplot.trm-*-*'
- X/* GNUPLOT -- unixplot.trm */
- X/*
- 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 * Unix plot(5) graphics language
- X *
- X * AUTHORS
- X * Colin Kelley, Thomas Williams, Russell Lang
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X/*
- XUnixplot library writes to stdout. A fix was put in place by
- X..!arizona!naucse!jdc to let set term and set output redirect
- Xstdout. All other terminals write to outfile.
- X*/
- X
- X#define UP_XMAX 4096
- X#define UP_YMAX 4096
- X
- X#define UP_XLAST (UP_XMAX - 1)
- X#define UP_YLAST (UP_YMAX - 1)
- X
- X#define UP_VCHAR (UP_YMAX/30) /* just a guess--no way to know this! */
- X#define UP_HCHAR (UP_XMAX/60) /* just a guess--no way to know this! */
- X#define UP_VTIC (UP_YMAX/80)
- X#define UP_HTIC (UP_XMAX/80)
- X
- XUP_init()
- X{
- X openpl();
- X space(0, 0, UP_XMAX, UP_YMAX);
- X}
- X
- X
- XUP_graphics()
- X{
- X erase();
- X}
- X
- X
- XUP_text()
- X{
- X}
- X
- X
- XUP_linetype(linetype)
- Xint linetype;
- X{
- Xstatic 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
- X
- XUP_move(x,y)
- Xunsigned int x,y;
- X{
- X move(x,y);
- X}
- X
- X
- XUP_vector(x,y)
- Xunsigned int x,y;
- X{
- X cont(x,y);
- X}
- X
- X
- XUP_put_text(x,y,str)
- Xunsigned int x,y;
- Xchar str[];
- X{
- X UP_move(x+UP_HCHAR/2,y+UP_VCHAR/5);
- X label(str);
- X}
- X
- XUP_reset()
- X{
- X closepl();
- X}
- X
- *-*-END-of-term/unixplot.trm-*-*
- echo x - term/v384.trm
- sed 's/^X//' >term/v384.trm <<'*-*-END-of-term/v384.trm-*-*'
- X/* GNUPLOT - v384.trm */
- X/*
- 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/*
- 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
- X#define V384_XMAX 630
- X#define V384_YMAX 480
- X
- X#define V384_XLAST (V384_XMAX - 1)
- X#define V384_YLAST (V384_YMAX - 1)
- X
- X#define V384_VCHAR 12
- X#define V384_HCHAR 7
- X#define V384_VTIC 8
- X#define V384_HTIC 7
- X
- X
- XV384_init()
- X{
- 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
- X
- XV384_graphics()
- X{
- X fprintf(outfile,"%c%c E0 RE N 65535\n",27,18);
- X}
- X
- X
- XV384_text()
- X{
- X fprintf(outfile,"%c%c\n",27,17);
- X}
- X
- X
- XV384_linetype(linetype)
- Xint linetype;
- X{
- Xstatic 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
- X
- XV384_move(x,y)
- Xunsigned int x,y;
- X{
- X fprintf(outfile,"M %d %d\n",x+20,y);
- X}
- X
- X
- XV384_vector(x,y)
- Xunsigned int x,y;
- X{
- X fprintf(outfile,"L %d %d\n",x+20,y);
- X}
- X
- X
- XV384_put_text (x, y, str)
- Xunsigned int x, y;
- Xchar str[];
- X{
- X V384_move (x, y + V384_VCHAR/2);
- X fprintf (outfile, "$%s\n", str);
- X}
- X
- X
- XV384_reset()
- X{
- X}
- X
- *-*-END-of-term/v384.trm-*-*
- exit
-
-
-