home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-25 | 55.3 KB | 2,339 lines |
- Newsgroups: comp.sources.misc
- organization: Pixar -- Marin County, California
- subject: v11i074: Gnuplot 2.0 - 9 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 74
- Submitted-by: thaw@ucbvax.Berkeley.EDU@pixar.UUCP (Tom Williams)
- Archive-name: gnuplot2/part09
-
- This is gnuplot.sh09
-
- --- CUT HERE ---
- #! /bin/sh
- echo x - term/aed.trm
- sed 's/^X//' >term/aed.trm <<'*-*-END-of-term/aed.trm-*-*'
- X/* GNUPLOT - aed.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 * AED terminals
- 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 AED_XMAX 768
- X#define AED_YMAX 575
- X
- X#define AED_XLAST (AED_XMAX - 1)
- X#define AED_YLAST (AED_YMAX - 1)
- X
- X#define AED_VCHAR 13
- X#define AED_HCHAR 8
- X#define AED_VTIC 8
- X#define AED_HTIC 7
- X
- X/* slightly different for AED 512 */
- X#define AED5_XMAX 512
- X#define AED5_XLAST (AED5_XMAX - 1)
- X
- XAED_init()
- X{
- X fprintf(outfile,
- X "\033SEN3DDDN.SEC.7.SCT.0.1.80.80.90.SBC.0.AAV2.MOV.0.9.CHR.0.FFD");
- X/* 2 3 4 5 7 6 1
- X 1. Clear Screen
- X 2. Set Encoding
- X 3. Set Default Color
- X 4. Set Backround Color Table Entry
- X 5. Set Backround Color
- X 6. Move to Bottom Lefthand Corner
- X 7. Anti-Alias Vectors
- X*/
- X}
- X
- X
- XAED_graphics()
- X{
- X fprintf(outfile,"\033FFD\033");
- X}
- X
- X
- XAED_text()
- X{
- X fprintf(outfile,"\033MOV.0.9.SEC.7.XXX");
- X}
- X
- X
- X
- XAED_linetype(linetype)
- Xint linetype;
- X{
- Xstatic int color[2+9] = { 7, 1, 6, 2, 3, 5, 1, 6, 2, 3, 5 };
- Xstatic int type[2+9] = { 85, 85, 255, 255, 255, 255, 255, 85, 85, 85, 85 };
- X
- X if (linetype >= 10)
- X linetype %= 10;
- X fprintf(outfile,"\033SLS%d.255.",type[linetype+2]);
- X fprintf(outfile,"\033SEC%d.",color[linetype+2]);
- X}
- X
- X
- X
- XAED_move(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"\033MOV%d.%d.",x,y);
- X}
- X
- X
- XAED_vector(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"\033DVA%d.%d.",x,y);
- X}
- X
- X
- XAED_put_text(x,y,str)
- Xint x,y;
- Xchar str[];
- X{
- X AED_move(x,y - AED_VCHAR/2 + 2);
- X fprintf(outfile,"\033XXX%s\033",str);
- X}
- X
- X
- X#define hxt (AED_HTIC/2)
- X#define hyt (AED_VTIC/2)
- X
- XAED_reset()
- X{
- X fprintf(outfile,"\033SCT0.1.0.0.0.SBC.0.FFD");
- X}
- X
- *-*-END-of-term/aed.trm-*-*
- echo x - term/dxy.trm
- sed 's/^X//' >term/dxy.trm <<'*-*-END-of-term/dxy.trm-*-*'
- X/* GNUPLOT - dxy.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 * Roland DXY800A plotter
- X *
- X * AUTHORS
- X * Martin Yii, eln557h@monu3.OZ
- X * Further modified Jan 1990 by Russell Lang, rjl@monu1.cc.monash.oz
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X#define DXY_XMAX 2470
- X#define DXY_YMAX 1700
- X
- X#define DXY_XLAST (DXY_XMAX - 1)
- X#define DXY_YLAST (DXY_XMAX - 1)
- X
- X#define DXY_VCHAR (56) /* double actual height of characters */
- X#define DXY_HCHAR (28) /* actual width including spacing */
- X#define DXY_VTIC (28)
- X#define DXY_HTIC (28)
- X
- Xint dxy_angle = 0;
- X
- XDXY_init()
- X{
- X/*
- X No initialisation sequences for DXY 800A
- X*/
- X}
- X
- X
- XDXY_graphics()
- X{
- X /* HOME, Character size 3 */
- X fprintf(outfile,"H\nS3\n");
- X}
- X
- X
- XDXY_text()
- X{
- X/*
- X No sequences needed
- X*/
- X}
- X
- X
- XDXY_linetype(linetype)
- Xint linetype;
- X{
- X /* select pen */
- X fprintf(outfile,"J%d\n",(linetype+2)%8+1);
- X switch(linetype) {
- X case -1 : /* use dotted line for axis */
- X fprintf(outfile,"L1\nB50\n");
- X break;
- X default : /* use solid line for all others */
- X fprintf(outfile,"L0\n");
- X break;
- X }
- X}
- X
- X
- XDXY_move(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"M%d,%d\n",x,y);
- X}
- X
- X
- XDXY_vector(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"D%d,%d\n",x,y);
- X}
- X
- X
- XDXY_put_text(x,y,str)
- Xint x, y;
- Xchar *str;
- X{
- X if (dxy_angle == 1 )
- X /* vertical */
- X DXY_move(x + DXY_VCHAR/4,y);
- X else
- X /* horiz */
- X DXY_move(x,y - DXY_VCHAR/4);
- X fprintf(outfile,"P%s\n",str);
- X}
- X
- X
- Xint DXY_text_angle(ang)
- Xint ang;
- X{
- X dxy_angle = ang;
- X fprintf(outfile,"Q%d\n",ang);
- X return TRUE;
- X}
- X
- X
- XDXY_reset()
- X{
- X /* Home pen */
- X fprintf(outfile,"H\n");
- X}
- X
- *-*-END-of-term/dxy.trm-*-*
- echo x - term/epson.trm
- sed 's/^X//' >term/epson.trm <<'*-*-END-of-term/epson.trm-*-*'
- X/* GNUPLOT - epson.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 file contains generic bit map graphics drivers,
- X * and epson_lx800, nec_cp6c, nec_cp6d, nec_cp6b, and proprinter
- X *
- X * AUTHORS
- X * Russell Lang
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X/* The following epson lx800 driver uses generic bit mapped graphics
- X routines to build up a bit map in memory. */
- X/* by Russell Lang, eln272v@monu1.cc.monash.oz */
- X/* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
- X/* EPSON_init changes outfile to binary mode on PC's */
- X
- X#ifdef EPSON
- X
- Xunsigned int bm_planes = 1; /* number of bit planes ( must be < sizeof(int) )*/
- Xunsigned int bm_psize; /* plane size */
- Xunsigned int bm_bpi; /* bits (pixels) per int */
- Xunsigned int bm_ipc; /* int per column */
- Xunsigned int bm_xmax; /* pixels */
- Xunsigned int bm_ymax; /* pixels (must be multiple of bits per int)
- X and (must be multiple of 8) */
- Xunsigned int *bm_array; /* pointer to bit map array of unsigned int */
- Xchar *bm_free;
- Xunsigned int bm_value = 1; /* this can be used for colour if bm_planes>1 */
- Xunsigned int bm_line_mask = 0xffff; /* 16 bit mask for dotted lines */
- Xstatic unsigned int bm_pattern[] = {0xffff, 0x1111,
- X 0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
- Xint bm_mask_count = 0;
- Xunsigned int bm_lastx, bm_lasty; /* last pixel set - used by bm_line */
- X
- X
- X#define EPSONXMAX 512
- X#define EPSONYMAX 384
- X
- X#define EPSONXLAST (EPSONXMAX - 1)
- X#define EPSONYLAST (EPSONYMAX - 1)
- X
- X#define EPSONVCHAR 11
- X#define EPSONHCHAR 7
- X#define EPSONVTIC 6
- X#define EPSONHTIC 6
- X
- Xunsigned int epson_x=0, epson_y=0;
- Xint epson_angle=0;
- X
- XEPSONinit()
- X{
- Xchar filename[MAX_ID_LEN+1];
- X bm_xmax=EPSONXMAX;
- X bm_ymax=EPSONYMAX;
- X bm_planes=1; /* one plane */
- X bm_value=1;
- X bm_setup();
- X /* output for EPSON must be binary to stop non Unix computers
- X changing \n to \r\n.
- X At present we only do this for PC's.
- X (Ultrix generates a run time error on the "wb" mode).
- X if the output is not STDOUT, then the following code
- X reopens outfile with binary mode. */
- X#ifdef PC
- X if (strcmp(outstr,"STDOUT")) {
- X (void) fclose(outfile);
- X (void) strcpy(filename,outstr+1); /* remove quotes */
- X filename[strlen(filename)-1] = '\0';
- X if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
- X if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
- X os_error("cannot reopen file with binary type; output unknown",
- X NO_CARET);
- X }
- X else {
- X os_error("cannot reopen file with binary type; output reset to ascii",
- X NO_CARET);
- X }
- X }
- X }
- X#endif
- X}
- X
- X
- XEPSONgraphics()
- X{
- Xunsigned int plane=0;
- Xunsigned int fill=0;
- X bm_cls(plane,fill);
- X epson_x=0;
- X epson_y=0;
- X epson_angle=0;
- X}
- X
- X
- XEPSONtext()
- X{
- X epson_dump();
- X}
- X
- X
- XEPSONlinetype(linetype)
- Xint linetype;
- X{
- X if (linetype>=7)
- X linetype %= 7;
- X bm_line_mask = bm_pattern[linetype+2];
- X bm_mask_count=0;
- X}
- X
- X
- XEPSONmove(x,y)
- Xunsigned int x,y;
- X{
- X epson_x=x;
- X epson_y=y;
- X}
- X
- X
- XEPSONvector(x,y)
- Xunsigned int x,y;
- X{
- X bm_line(epson_x,x,epson_y,y);
- X epson_x=x;
- X epson_y=y;
- X}
- X
- X
- XEPSONput_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- X if (epson_angle == 1)
- X x += EPSONVCHAR/2;
- X else
- X y -= EPSONVCHAR/2;
- X switch (epson_angle) {
- X case 0:
- X for (; *str; ++str, x += EPSONHCHAR)
- X bm_putc (x, y, *str, epson_angle);
- X break;
- X case 1:
- X for (; *str; ++str, y += EPSONHCHAR)
- X bm_putc (x, y, *str, epson_angle);
- X break;
- X }
- X}
- X
- X
- Xint EPSON_text_angle(ang)
- Xint ang;
- X{
- X epson_angle=ang;
- X return TRUE;
- X}
- X
- X
- XEPSONreset()
- X{
- X bm_release();
- X}
- X
- X
- X/* and now the generic bit map graphics routines */
- Xbm_setup()
- X{
- X bm_bpi = sizeof(unsigned int)*8; /* bits (pixels) per int */
- X bm_ipc = bm_ymax/bm_bpi; /* int per column */
- X bm_psize= bm_ipc * bm_xmax; /* plane size */
- X bm_free = alloc((unsigned int)
- X (sizeof(unsigned int) * bm_psize * bm_planes),
- X "screen bit map");
- X bm_array = (unsigned int *) bm_free;
- X}
- X
- Xbm_release()
- X{
- X (void) free(bm_free);
- X}
- X
- Xbm_cls(plane,fill)
- Xunsigned int plane, fill;
- X{
- Xunsigned int i, offset;
- X offset= plane * bm_psize;
- X for (i=0;i<bm_psize;i++)
- X bm_array[offset+i]=fill;
- X bm_lastx=0;
- X bm_lasty=0;
- X bm_mask_count=0;
- X bm_line_mask=0xffff;
- X}
- X
- Xbm_setpixel(x,y,value)
- Xunsigned int x,y,value;
- X{
- Xint i,shift,plane;
- X i = x * bm_ipc + y/bm_bpi;
- X shift = y % bm_bpi;
- X for (plane=0; plane<bm_planes; plane++) {
- X bm_array[plane*bm_psize+i] = (bm_array[plane*bm_psize+i] & ~(1<<shift) )
- X | (((value>>plane)&1)<<shift);
- X }
- X}
- X
- X
- Xbm_setmaskpixel(x,y,value)
- Xunsigned int x,y,value;
- X{
- X /* dotted line generator */
- X if ((bm_line_mask>>bm_mask_count)&(unsigned int)(1)) {
- X bm_setpixel(x,y,value);
- X }
- X bm_mask_count= (bm_mask_count+1) % 16;
- X bm_lastx= x; /* last pixel set with mask */
- X bm_lasty= y;
- X}
- X
- X
- X/* NOT USED
- Xunsigned int bm_getpixel(x,y)
- Xunsigned int x,y;
- X{
- Xint i,shift,plane;
- Xunsigned int value=0;
- X i = x * bm_ipc + y/bm_bpi;
- X shift = y % bm_bpi;
- X for (plane=bm_planes-1; plane>=0; plane--) {
- X value<<=1;
- X value = value | ((bm_array[plane*bm_psize+i]>>shift) & 1);
- X }
- X return value;
- X}
- X */
- X
- X
- Xbm_line(x1,x2,y1,y2)
- Xunsigned int x1,x2,y1,y2;
- X{
- Xint runcount;
- Xint dx,dy;
- Xint xinc,yinc;
- Xunsigned int xplot,yplot;
- X
- X runcount=0;
- X dx = abs((int)(x1)-(int)(x2));
- X if (x2>x1) xinc= 1;
- X if (x2==x1) xinc= 0;
- X if (x2<x1) xinc= -1;
- X dy = abs((int)(y1)-(int)(y2));
- X if (y2>y1) yinc= 1;
- X if (y2==y1) yinc= 0;
- X if (y2<y1) yinc= -1;
- X xplot=x1;
- X yplot=y1;
- X if (dx>dy) {
- X /* iterate x */
- X if ( (bm_line_mask==0xffff) ||
- X ((xplot!=bm_lastx) && (yplot!=bm_lasty)) )
- X bm_setmaskpixel(xplot,yplot,bm_value);
- X while (xplot!=x2) {
- X xplot+=xinc;
- X runcount+=dy;
- X if (runcount>=(dx-runcount)) {
- X yplot+=yinc;
- X runcount-=dx;
- X }
- X bm_setmaskpixel(xplot,yplot,bm_value);
- X }
- X } else {
- X /* iterate y */
- X if ( (bm_line_mask==0xffff) ||
- X ((xplot!=bm_lastx) && (yplot!=bm_lasty)) )
- X bm_setmaskpixel(xplot,yplot,bm_value);
- X while (yplot!=y2) {
- X yplot+=yinc;
- X runcount+=dx;
- X if (runcount>=(dy-runcount)) {
- X xplot+=xinc;
- X runcount-=dy;
- X }
- X bm_setmaskpixel(xplot,yplot,bm_value);
- X }
- X }
- X}
- X
- Xbm_putc(x,y,c,angle)
- Xunsigned int x,y;
- Xint angle;
- Xchar c;
- X{
- Xint i,j,k;
- Xchar fc;
- Xunsigned int pixelon;
- X i = (int)(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 : bm_setpixel(x+k+1,y+j,bm_value);
- X break;
- X case 1 : bm_setpixel(x-j,y+k+1,bm_value);
- X break;
- X }
- X }
- X }
- X }
- X}
- X
- X
- X/* output file must be binary mode for epson_dump */
- Xepson_dump()
- X{
- Xunsigned int x;
- Xint j,k;
- Xint num_bits = (sizeof(unsigned int)-1)*8;
- X#ifdef PC
- X fprintf(stderr,"Dumping EPSON graphics (24kbytes)\n");
- X#endif
- X fprintf(outfile,"\033A\010"); /* set line spacing to 8/72" = 8 dots */
- X for (j=bm_ipc-1;j>=0;j--) {
- X for (k=num_bits;k>=0;k-=8) {
- X /* select plotter graphics mode (square pixels) */
- X fprintf(outfile,"\r\n\033*\005");
- X (void) fputc((char)(bm_xmax%256),outfile);
- X (void) fputc((char)(bm_xmax/256),outfile);
- X for (x=0; x<bm_xmax; x++) {
- X (void) fputc( (char)((bm_array[x*bm_ipc+j] >>k) &0xff), outfile );
- X }
- X }
- X }
- X fprintf(outfile,"\033A\014\r\n"); /* setline spacing to 12/72" */
- X#ifdef PC
- X fprintf(stderr,"Print using: COPY /B\n");
- X#endif
- X}
- X
- X
- X#endif /* EPSON */
- X
- X
- X#ifdef PROPRINTER
- X
- X/* This is an output routine for the IBM Proprinter. Author Maurice Castro */
- X/* This driver is based on the Epson driver by Russell Lang */
- X
- X/* EPSON must be defined */
- X
- X
- XPROPRINTERtext()
- X{
- X proprinter_dump();
- X}
- X
- X
- X/* output file must be binary mode for proprinter_dump */
- Xproprinter_dump()
- X{
- Xunsigned int x;
- Xint j,k;
- Xint num_bits = (sizeof(unsigned int)-1)*8;
- X#ifdef PC
- X fprintf(stderr,"Dumping PROPRINTER graphics (24kbytes)\n");
- X#endif
- X for (j=bm_ipc-1;j>=0;j--) {
- X for (k=num_bits;k>=0;k-=8) {
- X /* select plotter graphics mode (square pixels) */
- X fprintf(outfile,"\033\0112\030");
- X fprintf(outfile,"\r\033*\005");
- X (void) fputc((char)(bm_xmax%256),outfile);
- X (void) fputc((char)(bm_xmax/256),outfile);
- X for (x=0; x<bm_xmax; x++) {
- X (void) fputc( (char)((bm_array[x*bm_ipc+j] >>k) &0xff), outfile );
- X }
- X }
- X }
- X#ifdef PC
- X fprintf(stderr,"Print using: COPY /B\n");
- X#endif
- X}
- X
- X
- X#endif /* PROPRINTER */
- X
- X/* The following NEC CP6 Pinwriter driver uses generic bit mapped graphics
- X routines to build up a bit map in memory. */
- X/* by Russell Lang, eln272v@monu1.cc.monash.oz */
- X/* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
- X/* NECinit changes outfile to binary mode for PC's */
- X
- X/* Add a Monochrome NEC printer (for faster speed and line types) jdc */
- X
- X#ifdef NEC
- X/* EPSON must be defined */
- X
- X#define NECXMAX 400
- X#define NECYMAX 320
- X
- X#define NECXLAST (NECXMAX - 1)
- X#define NECYLAST (NECYMAX - 1)
- X
- X#define NECVCHAR 11
- X#define NECHCHAR 7
- X#define NECVTIC 6
- X#define NECHTIC 6
- X
- X/* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
- Xstatic unsigned int neccolor[] = {1,8,4,2,10,12,6,14};
- Xstatic unsigned int necpcolor[]= {0,2,1,4};
- Xunsigned int nec_x=0, nec_y=0;
- Xint nec_angle=0;
- X
- XNECMinit()
- X/* Monochrome only NEC CP6 printer (set term nec_cp6m or nec_cp6d). */
- X/* will probably work with NEC P6 printer */
- X{
- X bm_planes = 1; /* One plane only */
- X nec_init();
- X}
- X
- X
- XNECCinit()
- X/* Color ribbon in NEC CP6 printer (set term nec_cp6c) */
- X{
- X bm_planes=4; /* four planes */
- X nec_init();
- X}
- X
- X
- Xnec_init()
- X{
- Xchar filename[MAX_ID_LEN+1];
- X bm_xmax=NECXMAX;
- X bm_ymax=NECYMAX;
- X bm_value=1; /* black */
- X bm_line_mask=0xffff; /* solid lines */
- X bm_setup();
- X /* output for NEC must be binary to stop non Unix computers
- X changing \n to \r\n.
- X At present we only do this for PC's.
- X (Ultrix generates a run time error on the "wb" mode).
- X if the output is not STDOUT, then the following code
- X reopens outfile with binary mode. */
- X#ifdef PC
- X if (strcmp(outstr,"STDOUT")) {
- X (void) fclose(outfile);
- X (void) strcpy(filename,outstr+1); /* remove quotes */
- X filename[strlen(filename)-1] = '\0';
- X if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL) {
- X if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
- X os_error("cannot reopen file with binary type; output unknown",
- X NO_CARET);
- X }
- X else {
- X os_error("cannot reopen file with binary type; output reset to ascii",
- X NO_CARET);
- X }
- X }
- X }
- X#endif
- X}
- X
- X
- XNECgraphics()
- X{
- Xunsigned int plane;
- Xunsigned int fill=0;
- X for (plane=0; plane<bm_planes; plane++)
- X bm_cls(plane,fill);
- X nec_x=0;
- X nec_y=0;
- X nec_angle=0;
- X}
- X
- X
- XNECdraft_text()
- X{
- X nec_draft_dump();
- X}
- X
- XNECtext()
- X{
- X nec_dump();
- X}
- X
- X
- XNECMlinetype(linetype)
- Xint linetype;
- X{
- X if (linetype>=7)
- X linetype %= 7;
- X bm_line_mask = bm_pattern[linetype+2];
- X bm_mask_count=0;
- X}
- X
- X
- XNECClinetype(linetype)
- Xint linetype;
- X{
- X if (linetype>=6)
- X linetype %= 6;
- X bm_value=neccolor[linetype+2];
- X}
- X
- X
- XNECmove(x,y)
- Xunsigned int x,y;
- X{
- X nec_x=x;
- X nec_y=y;
- X}
- X
- X
- XNECvector(x,y)
- Xunsigned int x,y;
- X{
- X bm_line(nec_x,x,nec_y,y);
- X nec_x=x;
- X nec_y=y;
- X}
- X
- X
- XNECput_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- X if (nec_angle == 1)
- X x += NECVCHAR/2;
- X else
- X y -= NECVCHAR/2;
- X switch (nec_angle) {
- X case 0:
- X for (; *str; ++str, x += NECHCHAR)
- X bm_putc (x, y, *str, nec_angle);
- X break;
- X case 1:
- X for (; *str; ++str, y += NECHCHAR)
- X bm_putc (x, y, *str, nec_angle);
- X break;
- X }
- X}
- X
- X
- Xint NEC_text_angle(ang)
- Xint ang;
- X{
- X nec_angle=ang;
- X return TRUE;
- X}
- X
- X
- XNECreset()
- X{
- X bm_release();
- X}
- X
- X
- X/* output file must be binary mode for nec_dump */
- Xnec_dump()
- X{
- Xunsigned int x;
- Xunsigned int plane,offset;
- Xint j,k;
- Xint num_bits = (sizeof(unsigned int)-1)*8;
- Xunsigned int column8;
- Xunsigned long column24;
- Xchar column3, column2, column1;
- X#ifdef PC
- X if (bm_planes==1)
- X fprintf(stderr,"Dumping NEC CP6 graphics (142kbytes)\n");
- X if (bm_planes==4)
- X fprintf(stderr,"Dumping NEC CP6 graphics (565kbytes)\n");
- X#endif
- X fprintf(outfile,"\033A\010"); /* set line spacing to 8/60" = 24 dots */
- X fprintf(outfile,"\033P\033l\005"); /* 10cpi, left margin 5 char */
- X for (j=bm_ipc-1;j>=0;j--) {
- X for (k=num_bits;k>=0;k-=8) {
- X fprintf(outfile,"\n");
- X for (plane=0; plane<bm_planes; plane++) {
- X offset=plane*bm_psize;
- X if (bm_planes>1) {
- X /* select colour for plane */
- X fprintf(outfile,"\r\033r");
- X (void) fputc((char)necpcolor[plane],outfile);
- X fprintf(outfile,"\r");
- X }
- X /* select plotter graphics mode (square pixels) */
- X fprintf(outfile,"\033*\047");
- X (void) fputc((char)(bm_xmax*3%256),outfile);
- X (void) fputc((char)(bm_xmax*3/256),outfile);
- X for (x=0; x<bm_xmax; x++) {
- X column8= (bm_array[offset+x*bm_ipc+j] >>k) &0xff;
- X column24=0;
- X if (column8&0x01) column24|=(long)0x000007;
- X if (column8&0x02) column24|=(long)0x000038;
- X if (column8&0x04) column24|=(long)0x0001c0;
- X if (column8&0x08) column24|=(long)0x000e00;
- X if (column8&0x10) column24|=(long)0x007000;
- X if (column8&0x20) column24|=(long)0x038000;
- X if (column8&0x40) column24|=(long)0x1c0000;
- X if (column8&0x80) column24|=(long)0xe00000;
- X column1 = (char) ( column24 & (long)0xff);
- X column2 = (char) ((column24>>8) & (long)0xff);
- X column3 = (char) ((column24>>16) & (long)0xff);
- X (void) fputc(column3,outfile);
- X (void) fputc(column2,outfile);
- X (void) fputc(column1,outfile);
- X (void) fputc(column3,outfile);
- X (void) fputc(column2,outfile);
- X (void) fputc(column1,outfile);
- X (void) fputc(column3,outfile);
- X (void) fputc(column2,outfile);
- X (void) fputc(column1,outfile);
- X }
- X }
- X }
- X }
- X fprintf(outfile,"\r\033l");
- X (void) fputc('\0',outfile); /* set left margin to 0 */
- X if (bm_planes > 1) {
- X fprintf(outfile,"\033r");
- X (void) fputc('\0',outfile); /* set color to black */
- X }
- X fprintf(outfile,"\033A\012\r\n"); /* setline spacing to 10/60" */
- X#ifdef PC
- X fprintf(stderr,"Print using: COPY /B\n");
- X#endif
- X}
- X
- X/* output file must be binary mode for nec_dump */
- Xnec_draft_dump()
- X{
- Xunsigned int x;
- Xunsigned int plane,offset;
- Xint j,k;
- Xint num_bits = (sizeof(unsigned int)-1)*8;
- X#ifdef PC
- X if (bm_planes==1)
- X fprintf(stderr,"Dumping NEC CP6 graphics (17kbytes)\n");
- X#endif
- X fprintf(outfile,"\033A\010"); /* set line spacing to 8/60" = 8 dots */
- X fprintf(outfile,"\033P\033l\005\r"); /* 10cpi, left margin 5 char */
- X for (j=bm_ipc-1;j>=0;j--) {
- X for (k=num_bits;k>=0;k-=8) {
- X fprintf(outfile,"\n");
- X for (plane=0; plane<bm_planes; plane++) {
- X offset=plane*bm_psize;
- X if (bm_planes>1) {
- X /* select colour for plane */
- X fprintf(outfile,"\r\033r");
- X (void) fputc((char)necpcolor[plane],outfile);
- X fprintf(outfile,"\r");
- X }
- X /* select plotter graphics mode (square pixels) */
- X fprintf(outfile,"\033*");
- X (void) fputc('\0',outfile);
- X (void) fputc((char)(bm_xmax%256),outfile);
- X (void) fputc((char)(bm_xmax/256),outfile);
- X for (x=0; x<bm_xmax; x++) {
- X (void) fputc( (char)((bm_array[offset+x*bm_ipc+j] >>k)
- X &0xff), outfile);
- X }
- X }
- X }
- X }
- X fprintf(outfile,"\r\033l");
- X (void) fputc('\0',outfile); /* set left margin to 0 */
- X if (bm_planes > 1) {
- X fprintf(outfile,"\033r");
- X (void) fputc('\0',outfile); /* set color to black */
- X }
- X fprintf(outfile,"\033A\012\r\n"); /* setline spacing to 10/60" */
- X#ifdef PC
- X fprintf(stderr,"Print using: COPY /B\n");
- X#endif
- X}
- X
- X#endif /* NEC */
- X
- *-*-END-of-term/epson.trm-*-*
- echo x - term/font5x7.trm
- sed 's/^X//' >term/font5x7.trm <<'*-*-END-of-term/font5x7.trm-*-*'
- X/* GNUPLOT - font5x7.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 file includes font information, and is included for the
- X * epson driver, and when on a PC and not using TURBO C.
- X *
- X * AUTHORS
- X * Russell Lang
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X/* 5x7 font, bottom row first, left pixel in lsb */
- Xstatic char font5x7[96][9] = {
- X /* */ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
- X /*!*/ {0x00,0x00,0x04,0x00,0x04,0x04,0x04,0x04,0x04},
- X /*"*/ {0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x0A,0x0A},
- X /*#*/ {0x00,0x00,0x0A,0x0A,0x1F,0x0A,0x1F,0x0A,0x0A},
- X /*$*/ {0x00,0x00,0x04,0x0F,0x14,0x0E,0x05,0x1E,0x04},
- X /*%*/ {0x00,0x00,0x18,0x19,0x02,0x04,0x08,0x13,0x03},
- X /*&*/ {0x00,0x00,0x16,0x09,0x15,0x02,0x05,0x05,0x02},
- X /*'*/ {0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x06,0x06},
- X /*(*/ {0x00,0x00,0x08,0x04,0x02,0x02,0x02,0x04,0x08},
- X /*)*/ {0x00,0x00,0x02,0x04,0x08,0x08,0x08,0x04,0x02},
- X /***/ {0x00,0x00,0x04,0x15,0x0E,0x1F,0x0E,0x15,0x04},
- X /*+*/ {0x00,0x00,0x00,0x04,0x04,0x1F,0x04,0x04,0x00},
- X /*,*/ {0x00,0x01,0x02,0x06,0x06,0x00,0x00,0x00,0x00},
- X /*-*/ {0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00},
- X /*.*/ {0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x00},
- X /*/*/ {0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x00},
- X /*0*/ {0x00,0x00,0x0E,0x11,0x13,0x15,0x19,0x11,0x0E},
- X /*1*/ {0x00,0x00,0x0E,0x04,0x04,0x04,0x04,0x06,0x04},
- X /*2*/ {0x00,0x00,0x1F,0x01,0x01,0x0E,0x10,0x11,0x0E},
- X /*3*/ {0x00,0x00,0x0E,0x11,0x10,0x0C,0x10,0x11,0x0E},
- X /*4*/ {0x00,0x00,0x08,0x08,0x1F,0x09,0x0A,0x0C,0x08},
- X /*5*/ {0x00,0x00,0x0E,0x11,0x10,0x10,0x0E,0x01,0x1F},
- X /*6*/ {0x00,0x00,0x0E,0x11,0x11,0x0F,0x01,0x02,0x0C},
- X /*7*/ {0x00,0x00,0x01,0x01,0x02,0x04,0x08,0x10,0x1F},
- X /*8*/ {0x00,0x00,0x0E,0x11,0x11,0x0E,0x11,0x11,0x0E},
- X /*9*/ {0x00,0x00,0x06,0x08,0x10,0x1E,0x11,0x11,0x0E},
- X /*:*/ {0x00,0x00,0x00,0x06,0x06,0x00,0x06,0x06,0x00},
- X /*;*/ {0x00,0x01,0x02,0x06,0x06,0x00,0x06,0x06,0x00},
- X /*<*/ {0x00,0x00,0x08,0x04,0x02,0x01,0x02,0x04,0x08},
- X /*=*/ {0x00,0x00,0x00,0x00,0x1F,0x00,0x1F,0x00,0x00},
- X /*>*/ {0x00,0x00,0x02,0x04,0x08,0x10,0x08,0x04,0x02},
- X /*?*/ {0x00,0x00,0x04,0x00,0x04,0x08,0x10,0x11,0x0E},
- X /*@*/ {0x00,0x00,0x0E,0x15,0x15,0x16,0x10,0x11,0x0E},
- X /*A*/ {0x00,0x00,0x11,0x11,0x1F,0x11,0x11,0x0A,0x04},
- X /*B*/ {0x00,0x00,0x0F,0x12,0x12,0x0E,0x12,0x12,0x0F},
- X /*C*/ {0x00,0x00,0x0E,0x11,0x01,0x01,0x01,0x11,0x0E},
- X /*D*/ {0x00,0x00,0x0F,0x12,0x12,0x12,0x12,0x12,0x0F},
- X /*E*/ {0x00,0x00,0x1F,0x01,0x01,0x07,0x01,0x01,0x1F},
- X /*F*/ {0x00,0x00,0x01,0x01,0x01,0x07,0x01,0x01,0x1F},
- X /*G*/ {0x00,0x00,0x1E,0x11,0x11,0x19,0x01,0x01,0x1E},
- X /*H*/ {0x00,0x00,0x11,0x11,0x11,0x1F,0x11,0x11,0x11},
- X /*I*/ {0x00,0x00,0x0E,0x04,0x04,0x04,0x04,0x04,0x0E},
- X /*J*/ {0x00,0x00,0x0E,0x11,0x10,0x10,0x10,0x10,0x10},
- X /*K*/ {0x00,0x00,0x11,0x09,0x05,0x03,0x05,0x09,0x11},
- X /*L*/ {0x00,0x00,0x1F,0x01,0x01,0x01,0x01,0x01,0x01},
- X /*M*/ {0x00,0x00,0x11,0x11,0x11,0x15,0x15,0x1B,0x11},
- X /*N*/ {0x00,0x00,0x11,0x11,0x11,0x19,0x15,0x13,0x11},
- X /*O*/ {0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x11,0x0E},
- X /*P*/ {0x00,0x00,0x01,0x01,0x01,0x0F,0x11,0x11,0x0F},
- X /*Q*/ {0x00,0x00,0x16,0x09,0x15,0x11,0x11,0x11,0x0E},
- X /*R*/ {0x00,0x00,0x11,0x09,0x05,0x0F,0x11,0x11,0x0F},
- X /*S*/ {0x00,0x00,0x0E,0x11,0x10,0x0E,0x01,0x11,0x0E},
- X /*T*/ {0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x1F},
- X /*U*/ {0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x11,0x11},
- X /*V*/ {0x00,0x00,0x04,0x04,0x0A,0x0A,0x11,0x11,0x11},
- X /*W*/ {0x00,0x00,0x11,0x1B,0x15,0x11,0x11,0x11,0x11},
- X /*X*/ {0x00,0x00,0x11,0x11,0x0A,0x04,0x0A,0x11,0x11},
- X /*Y*/ {0x00,0x00,0x04,0x04,0x04,0x04,0x0A,0x11,0x11},
- X /*Z*/ {0x00,0x00,0x1F,0x01,0x02,0x04,0x08,0x10,0x1F},
- X /*[*/ {0x00,0x00,0x0E,0x02,0x02,0x02,0x02,0x02,0x0E},
- X /*\*/ {0x00,0x00,0x00,0x10,0x08,0x04,0x02,0x01,0x00},
- X /*]*/ {0x00,0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x0E},
- X /*^*/ {0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x0A,0x04},
- X /*_*/ {0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00},
- X /*`*/ {0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x0C,0x0C},
- X /*a*/ {0x00,0x00,0x1E,0x11,0x1E,0x10,0x0E,0x00,0x00},
- X /*b*/ {0x00,0x00,0x0D,0x13,0x11,0x13,0x0D,0x01,0x01},
- X /*c*/ {0x00,0x00,0x0E,0x11,0x01,0x11,0x0E,0x00,0x00},
- X /*d*/ {0x00,0x00,0x16,0x19,0x11,0x19,0x16,0x10,0x10},
- X /*e*/ {0x00,0x00,0x0E,0x01,0x1F,0x11,0x0E,0x00,0x00},
- X /*f*/ {0x00,0x00,0x04,0x04,0x04,0x0E,0x04,0x14,0x08},
- X /*g*/ {0x0E,0x11,0x10,0x16,0x19,0x19,0x16,0x00,0x00},
- X /*h*/ {0x00,0x00,0x11,0x11,0x11,0x13,0x0D,0x01,0x01},
- X /*i*/ {0x00,0x00,0x0E,0x04,0x04,0x04,0x06,0x00,0x04},
- X /*j*/ {0x0E,0x11,0x10,0x10,0x10,0x10,0x00,0x10,0x00},
- X /*k*/ {0x00,0x00,0x09,0x05,0x03,0x05,0x09,0x01,0x01},
- X /*l*/ {0x00,0x00,0x0E,0x04,0x04,0x04,0x04,0x04,0x06},
- X /*m*/ {0x00,0x00,0x15,0x15,0x15,0x15,0x0B,0x00,0x00},
- X /*n*/ {0x00,0x00,0x11,0x11,0x11,0x13,0x0D,0x00,0x00},
- X /*o*/ {0x00,0x00,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00},
- X /*p*/ {0x01,0x01,0x0D,0x13,0x11,0x13,0x0D,0x00,0x00},
- X /*q*/ {0x10,0x10,0x16,0x19,0x11,0x19,0x16,0x00,0x00},
- X /*r*/ {0x00,0x00,0x01,0x01,0x01,0x13,0x0D,0x00,0x00},
- X /*s*/ {0x00,0x00,0x0F,0x10,0x0E,0x01,0x1E,0x00,0x00},
- X /*t*/ {0x00,0x00,0x08,0x14,0x04,0x04,0x1F,0x04,0x04},
- X /*u*/ {0x00,0x00,0x16,0x19,0x11,0x11,0x11,0x00,0x00},
- X /*v*/ {0x00,0x00,0x04,0x0A,0x11,0x11,0x11,0x00,0x00},
- X /*w*/ {0x00,0x00,0x0A,0x15,0x15,0x11,0x11,0x00,0x00},
- X /*x*/ {0x00,0x00,0x11,0x0A,0x04,0x0A,0x11,0x00,0x00},
- X /*y*/ {0x0E,0x11,0x10,0x1E,0x11,0x11,0x11,0x00,0x00},
- X /*z*/ {0x00,0x00,0x1F,0x02,0x04,0x08,0x1F,0x00,0x00},
- X /*{*/ {0x00,0x00,0x08,0x04,0x04,0x02,0x04,0x04,0x08},
- X /*|*/ {0x00,0x00,0x04,0x04,0x04,0x00,0x04,0x04,0x04},
- X /*}*/ {0x00,0x00,0x02,0x04,0x04,0x08,0x04,0x04,0x02},
- X /*~*/ {0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x15,0x02},
- X /*DEL*/ {0x00,0x00,0x0A,0x15,0x0A,0x15,0x0A,0x15,0x0A}
- X};
- *-*-END-of-term/font5x7.trm-*-*
- echo x - term/hp26.trm
- sed 's/^X//' >term/hp26.trm <<'*-*-END-of-term/hp26.trm-*-*'
- X/* GNUPLOT - hp26.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 * HP2623A
- X *
- X * AUTHORS
- X * hplvlch!ch (Chuck Heller)
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X
- X#define HP26_XMAX 512
- X#define HP26_YMAX 390
- X
- X#define HP26_XLAST (HP26_XMAX - 1)
- X#define HP26_YLAST (HP26_XMAX - 1)
- X
- X/* Assume a character size of 1, or a 7 x 10 grid. */
- X#define HP26_VCHAR 10
- X#define HP26_HCHAR 7
- X#define HP26_VTIC (HP26_YMAX/70)
- X#define HP26_HTIC (HP26_XMAX/75)
- X
- XHP26_init()
- X{
- X /* The HP2623A needs no initialization. */
- X}
- X
- X
- XHP26_graphics()
- X{
- X /* Clear and enable the display */
- X
- X fputs("\033*daZ\033*dcZ",outfile);
- X}
- X
- X
- XHP26_text()
- X{
- X fputs("\033*dT",outfile); /* back to text mode */
- X}
- X
- X
- XHP26_linetype(linetype)
- Xint linetype;
- X{
- X#define SOLID 1
- X#define LINE4 4
- X#define LINE5 5
- X#define LINE6 6
- X#define LINE8 8
- X#define DOTS 7
- X#define LINE9 9
- X#define LINE10 10
- X
- Xstatic int map[2+9] = { SOLID, /* border */
- X SOLID, /* axes */
- X DOTS, /* plot 0 */
- X LINE4, /* plot 1 */
- X LINE5, /* plot 2 */
- X LINE6, /* plot 3 */
- X LINE8, /* plot 4 */
- X LINE9, /* plot 5 */
- X LINE10, /* plot 6 */
- X SOLID, /* plot 7 */
- X SOLID /* plot 8 */ };
- X
- X if (linetype >= 9)
- X linetype %= 9;
- X fprintf(outfile,"\033*m%dB",map[linetype + 2]);
- X}
- X
- X
- XHP26_move(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"\033*pa%d,%dZ",x,y);
- X}
- X
- X
- XHP26_vector(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"\033*pb%d,%dZ",x,y);
- X}
- X
- X
- XHP26_put_text(x,y,str)
- Xint x, y;
- Xchar *str;
- X{
- X HP26_move(x,y - HP26_VCHAR/2);
- X fputs("\033*dS",outfile);
- X fprintf(outfile,"\033*m3Q\033*l%s\n",str);
- X fputs("\033*dT",outfile);
- X}
- X
- X
- X
- XHP26_reset()
- X{
- X}
- X
- *-*-END-of-term/hp26.trm-*-*
- echo x - term/hp2648.trm
- sed 's/^X//' >term/hp2648.trm <<'*-*-END-of-term/hp2648.trm-*-*'
- X/* GNUPLOT - hp2648.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 * HP2648 and HP2647
- X *
- X * AUTHORS
- X * Russell Lang
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X#define HP2648XMAX 720
- X#define HP2648YMAX 360
- X
- X#define HP2648XLAST (HP2648XMAX - 1)
- X#define HP2648YLAST (HP2648YMAX - 1)
- X
- X#define HP2648VCHAR 12
- X#define HP2648HCHAR 7
- X#define HP2648VTIC 8
- X#define HP2648HTIC 8
- X
- X
- XHP2648init()
- X{
- X fprintf(outfile,"\033*m1m1n136,1cZ");
- X/* 1 2 3 4
- X 1. mode
- X 2. textsize=1
- X 3. textangle=1
- X 4. define line type 2 to be * * * * etc.
- X*/
- X}
- X
- X
- XHP2648graphics()
- X{
- X fprintf(outfile,"\033*dacZ");
- X/* 1 23
- X 1. mode
- X 2. clear grahics screen
- X 3. graphics video on
- X*/
- X}
- X
- X
- XHP2648text()
- X{
- X}
- X
- X
- XHP2648linetype(linetype)
- Xint linetype;
- X{
- X static int hpline[] = {1,7,1,4,5,6,8,9,10,7,2};
- X fprintf(outfile,"\033*m%dbZ",hpline[(linetype+2)%11]);
- X}
- X
- X
- XHP2648move(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"\033*paf%d,%dZ",x,y);
- X /* 1 23 4
- X 1 plot mode
- X 2 "pen up"
- X 3 goto absolute x,y
- X 4 end command
- X */
- X}
- X
- X
- XHP2648vector(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"\033*pbf%d,%dZ",x,y);
- X /* 1
- X 1 "pen down"
- X */
- X}
- X
- X
- XHP2648put_text(x,y,str)
- Xint x, y;
- Xchar *str;
- X{
- X HP2648move(x,y-HP2648VCHAR/2 + 1);
- X fprintf(outfile,"\033*l%s\n",str);
- X}
- X
- X
- Xint HP2648_text_angle(ang)
- Xint ang;
- X{
- X fprintf(outfile,"\033*m%dnZ\n",ang+1);
- X return TRUE;
- X}
- X
- XHP2648reset()
- X{
- X}
- X
- *-*-END-of-term/hp2648.trm-*-*
- echo x - term/hpgl.trm
- sed 's/^X//' >term/hpgl.trm <<'*-*-END-of-term/hpgl.trm-*-*'
- X/* GNUPLOT - hpgl.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 * hpgl, hp7580b
- 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 HPGL_XMAX 15200
- X#define HPGL_YMAX 10000
- X
- X#define HPGL_XLAST (HPGL_XMAX - 1)
- X#define HPGL_YLAST (HPGL_XMAX - 1)
- X
- X/* HPGL_VCHAR, HPGL_HCHAR are not used */
- X#define HPGL_VCHAR (int)(HPGL_YMAX*0.032+0.5) /* 3.2% */
- X#define HPGL_HCHAR (int)(HPGL_XMAX*0.012+0.5) /* 1.2% */
- X#define HPGL_VTIC (HPGL_YMAX/70)
- X#define HPGL_HTIC (HPGL_YMAX/70)
- X
- Xint HPGL_ang = 0;
- X
- XHPGL_init()
- X{
- X}
- X
- X
- XHPGL_graphics()
- X{
- X fputs("\033.Y\n",outfile);
- X/* 1
- X 1. enable eavesdropping
- X*/
- X fprintf(outfile,
- X "IN;\nSC0,%d,0,%d;\nSR%f,%f;\n",
- X HPGL_XMAX,HPGL_YMAX,
- X ((float)(HPGL_HCHAR)*200/3/HPGL_XMAX),
- X ((float)(HPGL_VCHAR)*100/2/HPGL_YMAX) );
- X/* 1 2 3
- X 1. reset to power-up defaults
- X 2. set SCaling
- X 3. set character size
- X*/
- X HPGL_ang = 0;
- X}
- X
- X
- XHPGL_text()
- X{
- X fputs("PU;\nSP0;\n\033.Z\0",outfile);
- X/* 1 2 3
- X 1. pen up
- X 2. park pen
- X 3. disable eavesdropping
- X*/
- X}
- X
- X
- XHPGL_linetype(linetype)
- Xint linetype;
- X{
- X/* allow for 6 pens */
- X fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%6+1);
- X}
- X
- X
- XHP75_linetype(linetype)
- Xint linetype;
- X{
- X/* allow for 4 pens */
- X fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%4+1);
- X}
- X
- X
- X/* some early HPGL plotters (e.g. HP7220C) require the
- X * Pen Up/Down and Pen (move) Absolute commands to be separate
- X */
- XHPGL_move(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"PU;PA%d,%d;\n",x,y);
- X}
- X
- X
- XHPGL_vector(x,y)
- Xint x,y;
- X{
- X fprintf(outfile,"PD;PA%d,%d;\n",x,y);
- X}
- X
- X
- XHPGL_put_text(x,y,str)
- Xint x, y;
- Xchar *str;
- X{
- X if (HPGL_ang == 1)
- X HPGL_move(x + HPGL_VCHAR/4,y);
- X else
- X HPGL_move(x,y - HPGL_VCHAR/4);
- X fprintf(outfile,"LB%s\003\n",str);
- X}
- X
- X
- Xint HPGL_text_angle(ang)
- Xint ang;
- X{
- X HPGL_ang = ang;
- X if (ang == 1)
- X /* vertical */
- X fprintf(outfile,"DI0,1;\n");
- X else
- X /* horizontal */
- X fprintf(outfile,"DI1,0;\n");
- X return TRUE;
- X}
- X
- X
- XHPGL_reset()
- X{
- X}
- X
- *-*-END-of-term/hpgl.trm-*-*
- echo x - term/hpljet.trm
- sed 's/^X//' >term/hpljet.trm <<'*-*-END-of-term/hpljet.trm-*-*'
- X/* GNUPLOT - hpljet.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 * Hewlett-Packard Laserjet
- X *
- X * AUTHORS
- X * Jyrki Yli-Nokari (jty@intrin.UUCP)
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X/*
- X** Hewlett-Packard Laserjet
- X** Driver written and copyrighted 1987 by
- X** Jyrki Yli-Nokari (jty@intrin.UUCP)
- X** Intrinsic, Ltd.
- X**
- X** You may use this code for anything you like as long as
- X** you are not selling it and the credit is given and
- X** this message retained.
- X*/
- X
- X/*
- X** The driver consists of two parts: general raster plotting routines
- X** (#ifdef RASTER) and the laserjet driver using them (#ifdef HPLJET).
- X**
- X** The laserjet driver contains actually three different "terminal types":
- X** laserjet1, laserjet2 and laserjet3. The difference between them is the size
- X** of the picture; "laserjet3" being the biggest.
- X*/
- X
- X
- X#ifdef HPLJET
- X#define RASTER
- X#endif /* HPLJET */
- X
- X#ifdef RASTER
- X/*
- X** General raster plotting routines.
- X** Raster routines written and copyrighted 1987 by
- X** Jyrki Yli-Nokari (jty@intrin.UUCP)
- X** Intrinsic, Ltd.
- X**
- X** You may use this code for anything you like as long as
- X** you are not selling it and the credit is given and
- X** this message retained.
- X**
- X** The plotting area is defined as a huge raster.
- X** The raster is stored in a dynamically allocated pixel array r_p
- X**
- X** The raster is allocated (and initialized to zero) with
- X** r_makeraster(xsize, ysize)
- X** and freed with r_freeraster()
- X**
- X** Valid (unsigned) coordinates range from zero to (xsize-1,ysize-1)
- X**
- X** Plotting is done via r_move(x, y) and r_draw(x, y, value) functions,
- X** where the point (x,y) is the target to go from the current point
- X** and value is the value (of type pixel) to be stored in every pixel.
- X**
- X** Internally all plotting goes through r_setpixel(x, y, val).
- X** If you want different plotting styles (like OR, XOR...), use "value"
- X** in r_draw() to mark different styles and change r_setpixel() accordingly.
- X*/
- X
- X#define IN(i,size) ((unsigned)i < (unsigned)size)
- Xtypedef char pixel; /* the type of one pixel in raster */
- Xtypedef pixel *raster[]; /* the raster */
- X
- Xstatic raster *r_p; /* global pointer to raster */
- Xstatic unsigned r_currx, r_curry; /* the current coordinates */
- Xstatic unsigned r_xsize, r_ysize; /* the size of the raster */
- X
- X/*
- X** set pixel (x, y, val) to value val (this can be 1/0 or a color number).
- X*/
- Xvoid
- Xr_setpixel(x, y, val)
- Xunsigned x, y;
- Xpixel val;
- X{
- X if (IN(x, r_xsize) && IN(y, r_ysize)) {
- X *(((*r_p)[y]) + x) = val;
- X }
- X#ifdef RASTERDEBUG
- X else {
- X fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n", x, y, val);
- X }
- X#endif
- X}
- X
- X/*
- X** get pixel (x,y) value
- X*/
- Xpixel
- Xr_getpixel(x, y)
- Xunsigned x, y;
- X{
- X if (IN(x, r_xsize) && IN(y, r_ysize)) {
- X return *(((*r_p)[y]) + x);
- X } else {
- X#ifdef RASTERDEBUG
- X fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", x, y);
- X#endif
- X return 0;
- X }
- X}
- X
- X/*
- X** allocate the raster
- X*/
- Xvoid
- Xr_makeraster(x, y)
- Xunsigned x, y;
- X{
- X register unsigned j;
- X
- X /* allocate row pointers */
- X r_p = (raster *)alloc(y * sizeof(pixel *), "raster buffer");
- X bzero(r_p, y * sizeof(pixel *));
- X for (j = 0; j < y; j++) {
- X (*r_p)[j] = (pixel *)alloc(x * sizeof(pixel), "raster buffer");
- X bzero((*r_p)[j], x * sizeof(pixel));
- X }
- X r_xsize = x; r_ysize = y;
- X r_currx = r_curry = 0;
- X}
- X
- X/*
- X** plot a line from (x0,y0) to (x1,y1) with color val.
- X*/
- Xvoid
- Xr_plot(x0, y0, x1, y1, val)
- Xunsigned x0, y0, x1, y1;
- Xpixel val;
- X{
- X unsigned hx, hy, i;
- X int e, dx, dy;
- X
- X hx = abs((int)(x1 - x0));
- X hy = abs((int)(y1 - y0));
- X dx = (x1 > x0) ? 1 : -1;
- X dy = (y1 > y0) ? 1 : -1;
- X
- X if (hx > hy) {
- X /*
- X ** loop over x-axis
- X */
- X e = hy + hy - hx;
- X for (i = 0; i <= hx; i++) {
- X r_setpixel(x0, y0, val);
- X if (e > 0) {
- X y0 += dy;
- X e += hy + hy - hx - hx;
- X } else {
- X e += hy + hy;
- X }
- X x0 += dx;
- X }
- X } else {
- X /*
- X ** loop over y-axis
- X */
- X e = hx + hx - hy;
- X for (i = 0; i <= hy; i++) {
- X r_setpixel(x0, y0, val);
- X if (e > 0) {
- X x0 += dx;
- X e += hx + hx - hy - hy;
- X } else {
- X e += hx + hx;
- X }
- X y0 += dy;
- X }
- X }
- X}
- X
- X/*
- X** move to (x,y)
- X*/
- Xvoid
- Xr_move(x, y)
- Xunsigned x, y;
- X{
- X r_currx = x;
- X r_curry = y;
- X}
- X
- X/*
- X** draw to (x,y) with color val
- X** (move pen down)
- X*/
- Xvoid
- Xr_draw(x, y, val)
- Xunsigned x, y;
- Xpixel val;
- X{
- X r_plot(r_currx, r_curry, x, y, val);
- X r_currx = x;
- X r_curry = y;
- X}
- X
- X/*
- X** free the allocated raster
- X*/
- Xvoid
- Xr_freeraster()
- X{
- X int y;
- X
- X for (y = 0; y < r_ysize; y++) {
- X (void) free((char *)(*r_p)[y]);
- X }
- X (void) free((char *)r_p);
- X}
- X#endif /* RASTER */
- X
- X
- X
- X/*
- X** NOTE:
- X** When sending the plot to the laserjet there must be absolutely
- X** NO character translation done by the operating system.
- X** Normally, in UNIX, the (operating system) terminal driver
- X** translates newlines to CR/LF pairs. This is called the "cooked mode".
- X** Some operating systems might add CR/LF pairs if they think there
- X** is a too long line. ALL THIS IS STRICTLY PROHIBITED.
- X** ALL DATA TO THE LASERJET MUST BE SENT WHEN THE LINE IS IN RAW MODE.
- X**
- X
- X/*
- X** The laserjet math is a pain since we have to deal with
- X** decipoints (720/inch), dots (300/inch), pixels (100-300/inch),
- X** characters (10/inch horiz., 6/inch vertic.) and the size of
- X** the plottable surface in A4 (about 7.8 inches horizontally).
- X** On top of this we also support different plot sizes!
- X*/
- X
- X#define HPLJET_PIXSIZE (hpljet_pixel)
- X /* Laserjet pixel size in laserjet minimum dots */
- X#define HPLJET_PPI (300/HPLJET_PIXSIZE)
- X /* Laserjet raster scaling factor, Pixels Per Inch */
- X#define HPLJET_WIDTH 5600
- X /* ~ Number of horizontal decipoints in A4 */
- X#define HPLJET_IN2DP(x) (720*(x))
- X /* convert INches TO DeciPoints */
- X#define HPLJET_PX2DP(x) (HPLJET_IN2DP(x)/HPLJET_PPI)
- X /* convert PiXels TO DeciPoints */
- X#define HPLJET_HC2DP(x) (72*(x))
- X /* convert Horizontal Characters TO DeciPoints */
- X#define HPLJET_VC2DP(x) (120*(x))
- X /* convert Vertical Characters TO DeciPoints */
- X#define HPLJET_LMARG ((HPLJET_WIDTH - HPLJET_PX2DP(HPLJETXMAX))/2)
- X /* Picture left margin in decipoints */
- X#define HPLJET_RMARG ((HPLJET_WIDTH + HPLJET_PX2DP(HPLJETXMAX))/2)
- X /* Picture right margin in decipoints */
- X#define HPLJETXMAX 640
- X /* Number of pixels in X-axis */
- X#define HPLJETYMAX 640
- X /* Number of pixels in Y-axis */
- X#define HPLJETXLAST (HPLJETXMAX - 1)
- X /* Last valid X-pixel value */
- X#define HPLJETYLAST (HPLJETYMAX - 1)
- X /* Last valid Y-pixel value */
- X
- X#define HPLJETVCHAR (HPLJET_PPI/6)
- X /* Vertical pixel size of the character font */
- X#define HPLJETHCHAR (HPLJET_PPI/10)
- X /* Horizontal pixel size of the character font */
- X#define HPLJET1VCHAR (300/6)
- X /* Vertical pixel size of the character font */
- X#define HPLJET1HCHAR (300/10)
- X /* Horizontal pixel size of the character font */
- X#define HPLJET2VCHAR (150/6)
- X /* Vertical pixel size of the character font */
- X#define HPLJET2HCHAR (150/10)
- X /* Horizontal pixel size of the character font */
- X#define HPLJET3VCHAR (100/6)
- X /* Vertical pixel size of the character font */
- X#define HPLJET3HCHAR (100/10)
- X /* Horizontal pixel size of the character font */
- X/*
- X** (I guess) VTIC and HTIC are used as
- X** "small units that look like equal length".
- X** They determine (at least) the length of "bars" in axises and
- X** the size of plotting symbols.
- X*/
- X#define HPLJETVTIC 6
- X#define HPLJETHTIC 6
- X
- X/*
- X** We use laserjet1, laserjet2 and laserjet3 for different
- X** pixel sizes of the picture (1 is the smallest).
- X** The size of the text, however, remains the same.
- X** These three terminal types use mostly the same
- X** functions, only the init-function determines the size of the picture.
- X** Also, the h_char and v_char are different, but they are
- X** not used.
- X*/
- X
- X/*
- X** Initialize (once) for graphics
- X*/
- Xstatic int hpljet_pixel = 3;
- X
- XHPLJET1init()
- X{
- X hpljet_pixel = 1;
- X}
- X
- XHPLJET2init()
- X{
- X hpljet_pixel = 2;
- X}
- X
- XHPLJET3init()
- X{
- X hpljet_pixel = 3;
- X}
- X
- XHPLJETmove(x, y)
- X{
- X r_move((unsigned)x, (unsigned)y);
- X}
- X
- XHPLJETvector(x, y)
- X{
- X r_draw((unsigned)x, (unsigned)y, (pixel)1);
- X}
- X
- X/*
- X** Enter graphics mode:
- X** - allocate raster buffer
- X** - set resolution
- X*/
- XHPLJETgraphics()
- X{
- X r_makeraster(HPLJETXMAX, HPLJETYMAX);
- X fprintf(outfile,"\033*t%dR", HPLJET_PPI);
- X/* 1
- X** 1. Set resolution pixels/inch
- X*/
- X}
- X
- X/*
- X** (re-)enter text mode,
- X** output raster and deallocate it.
- X*/
- XHPLJETtext()
- X{
- X int x, y;
- X unsigned v, i;
- X
- X fprintf(outfile, "\033&a%dH\033&a%dV", HPLJET_LMARG, HPLJET_VC2DP(2));
- X fprintf(outfile, "\033*r1A");
- X for (y = r_ysize-1; y >= 0; y--) {
- X fprintf(outfile, "\033*b%dW", r_xsize/8);
- X for (x = 0; x < r_xsize; x += 8) {
- X v = 0;
- X for (i = 0; i < 8; i++) {
- X v = (v << 1) | r_getpixel((unsigned)x + i, (unsigned)y);
- X }
- X putc((char)v, outfile);
- X }
- X }
- X r_freeraster();
- X fprintf(outfile, "\033*rB\f");
- X}
- X
- X/*
- X** Select line type [-2:8]
- X** line types:
- X** -2 = border line
- X** -1 = x/y axis line
- X** 0-8 = function plot lines.
- X** Dummy function here.
- X*/
- XHPLJETlinetype(linetype)
- Xint linetype;
- X{
- X}
- X
- X/* put_text was added by Russell Lang, eln272v@monu1.cc.monash.oz
- X * IT IS UNTESTED
- X */
- X/* Put text "str" at pixel position x,y
- X**/
- XHPLJETput_text(x,y,str)
- Xunsigned x,y;
- Xchar str[];
- X{
- X fprintf(outfile, "\033&a%dH\033&a%dV",
- X HPLJET_PX2DP(x), HPLJET_PX2DP(y) );
- X fputs(str, outfile);
- X}
- X
- X
- X/*
- X** Put text "str" to the lower right corner of the screen.
- X** "row" is the row number [0:1].
- X** Actually in the laserjet, put the text above the upper right corner.
- X*/
- XHPLJETlrput_text(row,str)
- Xunsigned int row;
- Xchar str[];
- X{
- X
- X fprintf(outfile, "\033&a%dH\033&a%dV",
- X HPLJET_RMARG - HPLJET_HC2DP(strlen(str)), HPLJET_VC2DP(row));
- X fputs(str, outfile);
- X}
- X
- X/*
- X** Put text "str" to the upper left corner of the screen.
- X** "row" is the (serial) number of function to be plotted.
- X** Actually in the laserjet, put the text under the lower left corner.
- X*/
- XHPLJETulput_text(row,str)
- Xunsigned int row;
- Xchar str[];
- X{
- X fprintf(outfile, "\033&a%dH\033&a%dV",
- X HPLJET_LMARG,
- X HPLJET_VC2DP(row+3)+HPLJET_PX2DP(HPLJETYMAX));
- X fputs(str, outfile);
- X}
- X
- X/*
- X** RETURN to normal mode (exit gnuplot)
- X*/
- XHPLJETreset()
- X{
- X}
- X
- *-*-END-of-term/hpljet.trm-*-*
- echo x - term/iris4d.trm
- sed 's/^X//' >term/iris4d.trm <<'*-*-END-of-term/iris4d.trm-*-*'
- X/* GNUPLOT - iris4d.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 * IRIS terminals
- X *
- X * AUTHORS
- X * John H. Merritt
- X * (Applied Research Corporation) 7/1/89
- X * INTERNET: merritt@iris613.gsfc.nasa.gov
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X#include <gl.h>
- X#define IRIS4D_XMAX 1024
- X#define IRIS4D_YMAX 1024
- X
- X#define IRIS4D_XLAST (IRIS4D_XMAX - 1)
- X#define IRIS4D_YLAST (IRIS4D_YMAX - 1)
- X
- X#define IRIS4D_VCHAR (IRIS4D_YMAX/30)
- X#define IRIS4D_HCHAR (IRIS4D_XMAX/72)
- X#define IRIS4D_VTIC (IRIS4D_YMAX/80)
- X#define IRIS4D_HTIC (IRIS4D_XMAX/80)
- X
- XIRIS4D_init()
- X{
- X foreground();
- X winopen("Gnuplot");
- X deflinestyle(1, 0x3FFF); /* Long dash */
- X deflinestyle(2, 0x5555); /* dotted */
- X deflinestyle(3, 0x3333); /* short dash */
- X deflinestyle(4, 0xB5AD); /* dotdashed */
- X return;
- X}
- X
- XIRIS4D_graphics()
- X{
- X reshapeviewport();
- X ortho2((Coord)0, (Coord)IRIS4D_XMAX, (Coord)0, (Coord)IRIS4D_YMAX);
- X color(WHITE);
- X clear();
- X
- X return;
- X}
- X
- XIRIS4D_text()
- X{
- X return; /* enter text from another window!!! */
- X}
- X
- XIRIS4D_linetype(linetype)
- Xint linetype;
- X{
- X static int pen_color[5] = {1, 2, 3, 4, 5};
- X
- X linetype = linetype % 5;
- X color((Colorindex) pen_color[linetype]);
- X setlinestyle(linetype);
- X return;
- X}
- X
- XIRIS4D_move(x, y)
- Xunsigned int x, y;
- X{
- X move2i(x, y);
- X return;
- X}
- X
- XIRIS4D_cmove(x, y)
- Xunsigned int x, y;
- X{
- X cmov2i(x, y);
- X return;
- X}
- X
- XIRIS4D_vector(x, y)
- Xunsigned x, y;
- X{
- X draw2i(x, y);
- X return;
- X}
- X
- X
- XIRIS4D_put_text(x,y,str)
- Xint x, y;
- Xchar *str;
- X{
- X IRIS4D_cmove(x,y - IRIS4D_VCHAR/2);
- X charstr(str);
- X return;
- X}
- X
- X
- XIRIS4D_reset()
- X{
- X return;
- X}
- X
- *-*-END-of-term/iris4d.trm-*-*
- echo x - term/sun.trm
- sed 's/^X//' >term/sun.trm <<'*-*-END-of-term/sun.trm-*-*'
- X/* GNUPLOT - sun.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 * SUNview windowing system
- X *
- X * AUTHORS
- X * Maurice Castro
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X#include <suntool/sunview.h>
- X#include <suntool/canvas.h>
- X#include <suntool/scrollbar.h>
- X#include <suntool/panel.h>
- X#include <pixrect/pixrect_hs.h>
- X
- X#define SUN_XMAX 600
- X#define SUN_YMAX 512
- X
- X#define SUN_VCHAR (12) /* default, will be changed */
- X#define SUN_HCHAR (8) /* default, will be changed */
- X#define SUN_VTIC (SUN_YMAX/80)
- X#define SUN_HTIC (SUN_XMAX/80)
- X#define MARGIN 5
- X#define MINWIN 128
- X
- Xstatic Frame frame;
- Xstatic Canvas canvas;
- Xstatic Pixwin *pw;
- Xstatic struct pixfont *sun_font = NULL;
- X
- Xstatic enum JUSTIFY sun_justify=LEFT;
- X
- Xstatic Notify_value local_notice_destroy();
- X
- Xextern Notify_error notify_dispatch();
- X
- X/* dotted line generator */
- Xunsigned int sun_value = 1; /* this can be used for colour */
- Xunsigned int sun_line_mask = 0xffff; /* 16 bit mask for dotted lines */
- Xstatic unsigned int sun_pattern[] = {0xffff, 0x1111,
- X 0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
- Xint sun_mask_count = 0;
- Xunsigned int sun_lastx, sun_lasty; /* last pixel set - used by sun_line */
- X
- X
- XSUN_init()
- X{
- X struct termentry *t = &term_tbl[term];
- X struct pr_subregion bound;
- X
- X frame = window_create(NULL, FRAME,
- X FRAME_LABEL, "Gnuplot",
- X 0);
- X notify_interpose_destroy_func(frame,local_notice_destroy);
- X canvas = window_create(frame, CANVAS,
- X CANVAS_AUTO_EXPAND, TRUE,
- X CANVAS_AUTO_SHRINK, TRUE,
- X CANVAS_MARGIN, MARGIN,
- X 0);
- X notify_do_dispatch();
- X pw = canvas_pixwin(canvas);
- X window_set(frame, WIN_SHOW, TRUE, 0);
- X
- X /* figure out font and rough size */
- X sun_font = pf_default();
- X pf_textbound(&bound, 1, sun_font, "M");
- X t->v_char = bound.size.y;
- X t->h_char = bound.size.x;
- X
- X return;
- X}
- X
- XSUN_graphics()
- X{
- X term_tbl[term].xmax = (int) window_get(canvas,CANVAS_WIDTH);
- X term_tbl[term].ymax = (int) window_get(canvas,CANVAS_HEIGHT);
- X pw_writebackground(pw,0,0,term_tbl[term].xmax, term_tbl[term].ymax, PIX_SRC );
- X notify_dispatch();
- X /* do not let the user make the window too small */
- X if ((term_tbl[term].xmax)<MINWIN)
- X {
- X window_set(frame,
- X WIN_WIDTH, MINWIN+2*MARGIN+24,
- X 0);
- X notify_dispatch();
- X SUN_graphics();
- X }
- X if ((term_tbl[term].ymax) <MINWIN)
- X {
- X window_set(frame,
- X WIN_HEIGHT, MINWIN+2*MARGIN+24,
- X 0);
- X notify_dispatch();
- X SUN_graphics();
- X }
- X notify_dispatch();
- X return;
- X}
- X
- XSUN_text()
- X{
- X notify_dispatch();
- X return; /* enter text from another window!!! */
- X}
- X
- XSUN_linetype(linetype)
- Xint linetype;
- X{
- X if (linetype>=7)
- X linetype %= 7;
- X sun_line_mask = sun_pattern[linetype+2];
- X sun_mask_count=0;
- X}
- X
- X
- XSUN_move(x, y)
- Xunsigned int x, y;
- X{
- X sun_lastx = x;
- X sun_lasty = y;
- X notify_dispatch();
- X return;
- X}
- X
- XSUN_vector(x, y)
- Xunsigned int x, y;
- X{
- X if ( (x>=term_tbl[term].xmax) || (y>=term_tbl[term].ymax) )
- X return;
- X sun_line(sun_lastx,x,sun_lasty,y);
- X canvas_pixwin(canvas);
- X notify_dispatch();
- X return;
- X}
- X
- X
- XSUN_put_text(x,y,str)
- Xunsigned int x, y;
- Xchar *str;
- X{
- X struct pr_subregion bound;
- X
- X if ( (x>=term_tbl[term].xmax) || (y>=term_tbl[term].ymax) )
- X return;
- X
- X pf_textbound(&bound, strlen(str), sun_font, str);
- X y = term_tbl[term].ymax-1-y + bound.size.y/3; /* vertical centering */
- X
- X switch(sun_justify) {
- X case LEFT: break;
- X case CENTRE: x -= bound.size.x/2; break;
- X case RIGHT: x -= bound.size.x; break;
- X }
- X pw_text(pw, x,y, PIX_SRC | PIX_DST, 0, str);
- X canvas_pixwin(canvas);
- X notify_dispatch();
- X return;
- X}
- X
- X
- Xint SUN_justify_text(mode)
- X enum JUSTIFY mode;
- X{
- X sun_justify = mode;
- X return (TRUE);
- X}
- X
- X
- X
- X
- XSUN_reset()
- X{
- X
- X term_tbl[term].xmax = SUN_XMAX;
- X term_tbl[term].ymax = SUN_YMAX;
- X window_set(frame, WIN_SHOW, FALSE, 0);
- X return;
- X}
- X
- X
- X
- Xsun_setmaskpixel(x,y,value)
- Xunsigned int x,y,value;
- X{
- X /* dotted line generator */
- X if ((sun_line_mask>>sun_mask_count)&(unsigned int)(1)) {
- X pw_put(pw,x,term_tbl[term].ymax-1-y,sun_value);
- X }
- X sun_mask_count= (sun_mask_count+1) % 16;
- X sun_lastx= x; /* last pixel set with mask */
- X sun_lasty= y;
- X}
- X
- X
- X
- X
- Xsun_line(x1,x2,y1,y2)
- Xunsigned int x1,x2,y1,y2;
- X{
- Xint runcount;
- Xint dx,dy;
- Xint xinc,yinc;
- Xunsigned int xplot,yplot;
- X
- X runcount=0;
- X dx = abs((int)(x1)-(int)(x2));
- X if (x2>x1) xinc= 1;
- X if (x2==x1) xinc= 0;
- X if (x2<x1) xinc= -1;
- X dy = abs((int)(y1)-(int)(y2));
- X if (y2>y1) yinc= 1;
- X if (y2==y1) yinc= 0;
- X if (y2<y1) yinc= -1;
- X xplot=x1;
- X yplot=y1;
- X if (dx>dy) {
- X /* iterate x */
- X if ( (sun_line_mask==0xffff) ||
- X ((xplot!=sun_lastx) && (yplot!=sun_lasty)) )
- X sun_setmaskpixel(xplot,yplot,sun_value);
- X while (xplot!=x2) {
- X xplot+=xinc;
- X runcount+=dy;
- X if (runcount>=(dx-runcount)) {
- X yplot+=yinc;
- X runcount-=dx;
- X }
- X sun_setmaskpixel(xplot,yplot,sun_value);
- X }
- X } else {
- X /* iterate y */
- X if ( (sun_line_mask==0xffff) ||
- X ((xplot!=sun_lastx) && (yplot!=sun_lasty)) )
- X sun_setmaskpixel(xplot,yplot,sun_value);
- X while (yplot!=y2) {
- X yplot+=yinc;
- X runcount+=dx;
- X if (runcount>=(dy-runcount)) {
- X xplot+=xinc;
- X runcount-=dy;
- X }
- X sun_setmaskpixel(xplot,yplot,sun_value);
- X }
- X }
- X}
- X
- X
- Xstatic Notify_value local_notice_destroy(frame, status)
- X Frame frame;
- X Destroy_status status;
- X{
- X if (status != DESTROY_CHECKING)
- X {
- X SUN_reset();
- X term_init = FALSE;
- X }
- X return(NOTIFY_DONE);
- X }
- X
- *-*-END-of-term/sun.trm-*-*
- exit
-
-
-