home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / Gnuplot / Source / term.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-17  |  65.9 KB  |  2,196 lines

  1. #ifndef lint
  2. static char *RCSid = "$Id: term.c,v 1.1.1.1 1993/03/18 03:41:44 davis Exp $";
  3. #endif
  4.  
  5.  
  6. /* GNUPLOT - term.c */
  7. /*
  8.  * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software is provided "as is" without express or implied warranty.
  21.  * 
  22.  *
  23.  * AUTHORS
  24.  * 
  25.  *   Original Software:
  26.  *     Thomas Williams,  Colin Kelley.
  27.  * 
  28.  *   Gnuplot 2.0 additions:
  29.  *       Russell Lang, Dave Kotz, John Campbell.
  30.  *
  31.  *   Gnuplot 3.0 additions:
  32.  *       Gershon Elber and many others.
  33.  * 
  34.  * Send your comments or suggestions to 
  35.  *  info-gnuplot@dartmouth.edu.
  36.  * This is a mailing list; to join it send a note to 
  37.  *  info-gnuplot-request@dartmouth.edu.  
  38.  * Send bug reports to
  39.  *  bug-gnuplot@dartmouth.edu.
  40.  */
  41.  
  42. #include <stdio.h>
  43. #include <ctype.h>
  44. #include "plot.h"
  45. #include "setshow.h"
  46. #include "term.h"
  47. #include "bitmap.h"
  48. #ifdef NEXT
  49. #include <stdlib.h>
  50. #include "epsviewe.h"
  51. #endif /* NEXT */
  52.  
  53. #ifdef _Windows
  54. #ifdef __MSC__
  55. #include <malloc.h>
  56. #else
  57. #include <alloc.h>
  58. #endif
  59. #endif
  60.  
  61. #if defined(__TURBOC__) && defined(MSDOS)
  62. #ifndef _Windows
  63. #include <dos.h>
  64. #endif
  65. #endif
  66.  
  67. /* for use by all drivers */
  68. #define sign(x) ((x) >= 0 ? 1 : -1)
  69. #define abs(x) ((x) >= 0 ? (x) : -(x))
  70.  
  71. #ifndef max    /* GCC uses inline functions */
  72. #define max(a,b) ((a) > (b) ? (a) : (b))
  73. #endif
  74. #ifndef min
  75. #define min(a,b) ((a) < (b) ? (a) : (b))
  76. #endif
  77.  
  78. TBOOLEAN term_init;            /* true if terminal has been initialized */
  79.  
  80. extern FILE *outfile;
  81. extern char outstr[];
  82. extern TBOOLEAN term_init;
  83. extern int term;
  84. extern float xsize, ysize;
  85.  
  86. extern char input_line[];
  87. extern struct lexical_unit token[];
  88. extern int num_tokens, c_token;
  89. extern struct value *const_express();
  90.  
  91. extern TBOOLEAN interactive;
  92.  
  93. /*
  94.  * instead of <strings.h>
  95.  */
  96.  
  97. #if defined(_Windows) || ( defined(__TURBOC__) && defined(MSDOS) )
  98. # include <string.h>
  99. #else
  100. #ifdef ATARI
  101. #include <string.h>
  102. #include <math.h>
  103. #else
  104. #ifndef AMIGA_SC_6_1
  105. extern char *strcpy();
  106. extern int strlen(), strcmp(), strncmp();
  107. #endif /* !AMIGA_SC_6_1 */
  108. #endif
  109. #endif
  110.  
  111. #ifndef AMIGA_AC_5
  112. extern double sqrt();
  113. #endif
  114.  
  115. char *getenv();
  116.  
  117. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  118. char *turboc_init();
  119. #endif
  120.  
  121. #ifdef __ZTC__
  122. char *ztc_init();
  123. /* #undef TGIF */
  124. #endif
  125.  
  126.  
  127. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  128. void reopen_binary();
  129. #define REOPEN_BINARY
  130. #endif
  131. #ifdef vms
  132. char *vms_init();
  133. void vms_reset();
  134. void term_mode_tek();
  135. void term_mode_native();
  136. void term_pasthru();
  137. void term_nopasthru();
  138. void reopen_binary();
  139. void fflush_binary();
  140. #define REOPEN_BINARY
  141. #endif
  142.  
  143. /* This is needed because the unixplot library only writes to stdout. */
  144. #ifdef UNIXPLOT
  145. FILE save_stdout;
  146. #endif
  147. int unixplot=0;
  148.  
  149. #define NICE_LINE        0
  150. #define POINT_TYPES        6
  151.  
  152.  
  153. do_point(x,y,number)
  154. int x,y;
  155. int number;
  156. {
  157. register int htic,vtic;
  158. register struct termentry *t = &term_tbl[term];
  159.  
  160.      if (number < 0) {        /* do dot */
  161.         (*t->move)(x,y);
  162.         (*t->vector)(x,y);
  163.         return(0);
  164.     }
  165.  
  166.     number %= POINT_TYPES;
  167.     htic = (t->h_tic/2);    /* should be in term_tbl[] in later version */
  168.     vtic = (t->v_tic/2);    
  169.  
  170.     switch(number) {
  171.         case 0: /* do diamond */ 
  172.                 (*t->move)(x-htic,y);
  173.                 (*t->vector)(x,y-vtic);
  174.                 (*t->vector)(x+htic,y);
  175.                 (*t->vector)(x,y+vtic);
  176.                 (*t->vector)(x-htic,y);
  177.                 (*t->move)(x,y);
  178.                 (*t->vector)(x,y);
  179.                 break;
  180.         case 1: /* do plus */ 
  181.                 (*t->move)(x-htic,y);
  182.                 (*t->vector)(x-htic,y);
  183.                 (*t->vector)(x+htic,y);
  184.                 (*t->move)(x,y-vtic);
  185.                 (*t->vector)(x,y-vtic);
  186.                 (*t->vector)(x,y+vtic);
  187.                 break;
  188.         case 2: /* do box */ 
  189.                 (*t->move)(x-htic,y-vtic);
  190.                 (*t->vector)(x-htic,y-vtic);
  191.                 (*t->vector)(x+htic,y-vtic);
  192.                 (*t->vector)(x+htic,y+vtic);
  193.                 (*t->vector)(x-htic,y+vtic);
  194.                 (*t->vector)(x-htic,y-vtic);
  195.                 (*t->move)(x,y);
  196.                 (*t->vector)(x,y);
  197.                 break;
  198.         case 3: /* do X */ 
  199.                 (*t->move)(x-htic,y-vtic);
  200.                 (*t->vector)(x-htic,y-vtic);
  201.                 (*t->vector)(x+htic,y+vtic);
  202.                 (*t->move)(x-htic,y+vtic);
  203.                 (*t->vector)(x-htic,y+vtic);
  204.                 (*t->vector)(x+htic,y-vtic);
  205.                 break;
  206.         case 4: /* do triangle */ 
  207.                 (*t->move)(x,y+(4*vtic/3));
  208.                 (*t->vector)(x-(4*htic/3),y-(2*vtic/3));
  209.                 (*t->vector)(x+(4*htic/3),y-(2*vtic/3));
  210.                 (*t->vector)(x,y+(4*vtic/3));
  211.                 (*t->move)(x,y);
  212.                 (*t->vector)(x,y);
  213.                 break;
  214.         case 5: /* do star */ 
  215.                 (*t->move)(x-htic,y);
  216.                 (*t->vector)(x-htic,y);
  217.                 (*t->vector)(x+htic,y);
  218.                 (*t->move)(x,y-vtic);
  219.                 (*t->vector)(x,y-vtic);
  220.                 (*t->vector)(x,y+vtic);
  221.                 (*t->move)(x-htic,y-vtic);
  222.                 (*t->vector)(x-htic,y-vtic);
  223.                 (*t->vector)(x+htic,y+vtic);
  224.                 (*t->move)(x-htic,y+vtic);
  225.                 (*t->vector)(x-htic,y+vtic);
  226.                 (*t->vector)(x+htic,y-vtic);
  227.                 break;
  228.     }
  229. }
  230.  
  231.  
  232. /*
  233.  * general point routine
  234.  */
  235. line_and_point(x,y,number)
  236. int x,y,number;
  237. {
  238.     /* temporary(?) kludge to allow terminals with bad linetypes 
  239.         to make nice marks */
  240.  
  241.     (*term_tbl[term].linetype)(NICE_LINE);
  242.     do_point(x,y,number);
  243. }
  244.  
  245. /* 
  246.  * general arrow routine
  247.  */
  248. #define ROOT2 (1.41421)        /* sqrt of 2 */
  249.  
  250. do_arrow(sx, sy, ex, ey, head)
  251.     int sx,sy;            /* start point */
  252.     int ex, ey;            /* end point (point of arrowhead) */
  253.     TBOOLEAN head;
  254. {
  255.     register struct termentry *t = &term_tbl[term];
  256.     int len = (t->h_tic + t->v_tic)/2; /* arrowhead size = avg of tic sizes */
  257.  
  258.     /* draw the line for the arrow. That's easy. */
  259.     (*t->move)(sx, sy);
  260.     (*t->vector)(ex, ey);
  261.  
  262.     if (head) {
  263.     /* now draw the arrow head. */
  264.     /* we put the arrowhead marks at 45 degrees to line */
  265.        if (sx == ex) {
  266.        /* vertical line, special case */
  267.           int delta = ((float)len / ROOT2 + 0.5);
  268.           if (sy < ey)
  269.               delta = -delta;    /* up arrow goes the other way */
  270.           (*t->move)(ex - delta, ey + delta);
  271.           (*t->vector)(ex,ey);
  272.           (*t->vector)(ex + delta, ey + delta);
  273.        } else {
  274.           int dx = sx - ex;
  275.           int dy = sy - ey;
  276.           double coeff = len / sqrt(2.0*((double)dx*(double)dx 
  277.                    + (double)dy*(double)dy));
  278.           int x,y;            /* one endpoint */
  279.  
  280.           x = (int)( ex + (dx + dy) * coeff );
  281.           y = (int)( ey + (dy - dx) * coeff );
  282.           (*t->move)(x,y);
  283.           (*t->vector)(ex,ey);
  284.  
  285.           x = (int)( ex + (dx - dy) * coeff );
  286.           y = (int)( ey + (dy + dx) * coeff );
  287.           (*t->vector)(x,y);
  288.        }
  289.     }
  290. }
  291.  
  292. #ifdef DUMB                    /* paper or glass dumb terminal */
  293. #include "term/dumb.trm"
  294. #endif
  295.  
  296.  
  297. #ifndef _Windows
  298. # ifdef PC            /* all PC types except MS WINDOWS*/
  299. #  include "term/pc.trm"
  300. # endif
  301. #else
  302. #  include "term/win.trm"
  303. #endif
  304.  
  305. #ifdef __ZTC__
  306. #include "term/fg.trm"
  307. #endif
  308.  
  309. #ifdef DJSVGA
  310. #include "term/djsvga.trm"    /* DJGPP SVGA */
  311. #endif
  312.  
  313. #ifdef EMXVGA
  314. #include "term/emxvga.trm"    /* EMX VGA */
  315. #endif
  316.  
  317. #ifdef OS2PM                    /* os/2 presentation manager */
  318. #include "term/pm.trm"
  319. #endif
  320.  
  321. #ifdef ATARI            /* ATARI-ST */
  322. #include "term/atari.trm"
  323. #endif
  324.  
  325. /*
  326.    all TEK types (TEK,BITGRAPH,KERMIT,VTTEK,SELANAR) are ifdef'd in tek.trm,
  327.    but most require various TEK routines.  Hence TEK must be defined for
  328.    the others to compile.
  329. */
  330. #ifdef BITGRAPH
  331. # ifndef TEK
  332. #  define TEK
  333. # endif
  334. #endif
  335.  
  336. #ifdef SELENAR
  337. # ifndef TEK
  338. #  define TEK
  339. # endif
  340. #endif
  341.  
  342. #ifdef KERMIT
  343. # ifndef TEK
  344. #  define TEK
  345. # endif
  346. #endif
  347.  
  348. #ifdef LN03P
  349. # ifndef TEK
  350. #  define TEK
  351. # endif
  352. #endif
  353.  
  354. #ifdef VTTEK
  355. # ifndef TEK
  356. #  define TEK
  357. # endif
  358. #endif
  359.  
  360. #ifdef T410X        /* Tektronix 4106, 4107, 4109 and 420x terminals */
  361. #include "term/t410x.trm"
  362. #endif
  363.  
  364. #ifdef TEK            /* all TEK types, TEK, BBN, SELANAR, KERMIT, VTTEK */
  365. #include "term/tek.trm"
  366. #endif
  367.  
  368. #ifdef EPSONP    /* bit map types, EPSON, NEC, PROPRINTER, STAR Color */
  369. #include "term/epson.trm"
  370. #endif
  371.  
  372. #ifdef HP500C  /* HP 500 deskjet Colour */
  373. #include "term/hp500c.trm"
  374. #endif
  375.  
  376. #ifdef HPLJII        /* HP LaserJet II */
  377. #include "term/hpljii.trm"
  378. #endif
  379.  
  380. #ifdef PCL /* HP LaserJet III in HPGL mode */
  381. #  ifndef HPGL
  382. #    define HPGL
  383. #  endif
  384. #endif
  385.  
  386. #ifdef HPPJ        /* HP PaintJet */
  387. #include "term/hppj.trm"
  388. #endif
  389.  
  390. #ifdef FIG                /* Fig 1.4FS Interactive graphics program */
  391. #include "term/fig.trm"
  392. #include "term/bigfig.trm"
  393. #endif
  394.   
  395. #ifdef GPR              /* Apollo Graphics Primitive Resource (fixed-size window) */
  396. #include "term/gpr.trm"
  397. #endif /* GPR */
  398.  
  399. #ifdef GRASS              /* GRASS (geographic info system) monitor */
  400. #include "term/grass.trm"
  401. #endif /* GRASS */
  402.  
  403. #ifdef APOLLO           /* Apollo Graphics Primitive Resource (resizable window) */
  404. #include "term/apollo.trm"
  405. #endif /* APOLLO */
  406.  
  407. #ifdef IMAGEN        /* IMAGEN printer */
  408. #include "term/imagen.trm"
  409. #endif
  410.  
  411. #ifdef MIF            /* Framemaker MIF  driver */
  412. #include "term/mif.trm"
  413. #endif
  414.  
  415. #ifdef MF            /* METAFONT driver */
  416. #include "term/metafont.trm"
  417. #endif
  418.  
  419. #ifdef TEXDRAW
  420. #include "term/texdraw.trm"
  421. #endif
  422.  
  423. #ifdef EEPIC        /* EEPIC (LATEX) type */
  424. #include "term/eepic.trm"
  425. # ifndef LATEX
  426. #  define LATEX
  427. # endif
  428. #endif
  429.  
  430. #ifdef EMTEX        /* EMTEX (LATEX for PC) type */
  431. # ifndef LATEX
  432. #  define LATEX
  433. # endif
  434. #endif
  435.  
  436. #ifdef LATEX        /* LATEX type */
  437. #include "term/latex.trm"
  438. #endif
  439.  
  440. #ifdef GPIC        /* GPIC (groff) type */ 
  441. #include "term/gpic.trm"
  442. #endif
  443.  
  444. #ifdef PBM        /* PBMPLUS portable bitmap */
  445. #include "term/pbm.trm"
  446. #endif
  447.  
  448. #ifdef POSTSCRIPT    /* POSTSCRIPT type */
  449. #include "term/post.trm"
  450. #endif
  451.  
  452. #ifdef PRESCRIBE    /* PRESCRIBE type */
  453. #include "term/kyo.trm"
  454. #endif
  455.  
  456. /* note: this must come after term/post.trm */
  457. #ifdef PSLATEX        /* LaTeX with embedded PostScript */
  458. #include "term/pslatex.trm"
  459. #endif
  460.  
  461. #ifdef PSTRICKS
  462. #include "term/pstricks.trm"
  463. #endif
  464.  
  465. #ifdef TPIC        /* TPIC (LATEX) type */
  466. #include "term/tpic.trm"
  467. # ifndef LATEX
  468. #  define LATEX
  469. # endif
  470. #endif
  471.  
  472. #ifdef UNIXPC     /* unix-PC  ATT 7300 or 3b1 machine */
  473. #include "term/unixpc.trm"
  474. #endif /* UNIXPC */
  475.  
  476. #ifdef AED
  477. #include "term/aed.trm"
  478. #endif /* AED */
  479.  
  480. #ifdef AIFM
  481. #include "term/ai.trm"
  482. #endif /* AIFM */
  483.  
  484. #ifdef COREL
  485. #include "term/corel.trm"
  486. #endif /* COREL */
  487.  
  488. #ifdef CGI
  489. #include "term/cgi.trm"
  490. #endif /* CGI */
  491.  
  492. #ifdef DEBUG
  493. #include "term/debug.trm"
  494. #endif /* DEBUG */
  495.  
  496. #ifdef EXCL
  497. #include "term/excl.trm"
  498. #endif /* EXCL */
  499.  
  500. #ifdef HP2648
  501. /* also works for HP2647 */
  502. #include "term/hp2648.trm"
  503. #endif /* HP2648 */
  504.  
  505. #ifdef HP26
  506. #include "term/hp26.trm"
  507. #endif /* HP26 */
  508.  
  509. #ifdef HP75
  510. #ifndef HPGL
  511. #define HPGL
  512. #endif
  513. #endif
  514.  
  515. /* HPGL - includes HP75 and HPLJIII in HPGL mode */
  516. #ifdef HPGL
  517. #include "term/hpgl.trm"
  518. #endif /* HPGL */
  519.  
  520. /* Roland DXY800A plotter driver by Martin Yii, eln557h@monu3.OZ 
  521.     and Russell Lang, rjl@monu1.cc.monash.oz */
  522. #ifdef DXY800A
  523. #include "term/dxy.trm"
  524. #endif /* DXY800A */
  525.  
  526. #ifdef IRIS4D
  527. #include "term/iris4d.trm"
  528. #endif /* IRIS4D */
  529.  
  530. #ifdef NEXT
  531. #include "term/next.trm"
  532. #endif /* NEXT */
  533.  
  534. #ifdef NEXTFE
  535. #include "term/nextfe.trm"
  536. #endif /* NEXT Front End */
  537.  
  538. #ifdef QMS
  539. #include "term/qms.trm"
  540. #endif /* QMS */
  541.  
  542. #ifdef REGIS
  543. #include "term/regis.trm"
  544. #endif /* REGIS */
  545.  
  546. #ifdef RGIP
  547. #include "term/rgip.trm"
  548. #endif /* RGIP UNIPLEX */
  549.  
  550. #ifdef SUN
  551. #include "term/sun.trm"
  552. #endif /* SUN */
  553.  
  554. #ifdef VWS
  555. #include "term/vws.trm"
  556. #endif /* VWS */
  557.  
  558. #ifdef V384
  559. #include "term/v384.trm"
  560. #endif /* V384 */
  561.  
  562. #ifdef TGIF
  563. #include "term/tgif.trm"
  564. #endif /* TGIF */
  565.  
  566. #ifdef UNIXPLOT
  567. #ifdef GNUGRAPH
  568. #include "term/gnugraph.trm"
  569. #else
  570. #include "term/unixplot.trm"
  571. #endif /* GNUGRAPH */
  572. #endif /* UNIXPLOT */
  573.  
  574. #ifdef X11
  575. #include "term/x11.trm"
  576. #include "term/xlib.trm"
  577. #endif /* X11 */
  578.  
  579. #ifdef DXF
  580. #include "term/dxf.trm"
  581. #endif /* DXF */
  582.   
  583. #ifdef AMIGASCREEN
  584. #include "term/amiga.trm"
  585. #endif /* AMIGASCREEN */
  586.  
  587. /* Dummy functions for unavailable features */
  588.  
  589. /* change angle of text.  0 is horizontal left to right.
  590. * 1 is vertical bottom to top (90 deg rotate)  
  591. */
  592. static int null_text_angle()
  593. {
  594. return FALSE ;    /* can't be done */
  595. }
  596.  
  597. /* change justification of text.  
  598.  * modes are LEFT (flush left), CENTRE (centred), RIGHT (flush right)
  599.  */
  600. static int null_justify_text()
  601. {
  602. return FALSE ;    /* can't be done */
  603. }
  604.  
  605.  
  606. /* Change scale of plot.
  607.  * Parameters are x,y scaling factors for this plot.
  608.  * Some terminals (eg latex) need to do scaling themselves.
  609.  */
  610. static int null_scale()
  611. {
  612. return FALSE ;    /* can't be done */
  613. }
  614.  
  615. static int do_scale()
  616. {
  617. return TRUE ;    /* can be done */
  618. }
  619.  
  620. options_null()
  621. {
  622.     term_options[0] = '\0';    /* we have no options */
  623. }
  624.  
  625. static UNKNOWN_null()
  626. {
  627. }
  628.  
  629. /*
  630.  * term_tbl[] contains an entry for each terminal.  "unknown" must be the
  631.  *   first, since term is initialized to 0.
  632.  */
  633. struct termentry term_tbl[] = {
  634.     {"unknown", "Unknown terminal type - not a plotting device",
  635.       100, 100, 1, 1,
  636.       1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  637.       UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  638.       UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  639.       null_justify_text, UNKNOWN_null, UNKNOWN_null}
  640.  
  641.     ,{"table", "Dump ASCII table of X Y [Z] values to output",
  642.       100, 100, 1, 1,
  643.       1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  644.       UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  645.       UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  646.       null_justify_text, UNKNOWN_null, UNKNOWN_null}
  647.  
  648. #ifdef AMIGASCREEN
  649.     ,{"amiga", "Amiga Custom Screen",
  650.        AMIGA_XMAX, AMIGA_YMAX, AMIGA_VCHAR, AMIGA_HCHAR, 
  651.        AMIGA_VTIC, AMIGA_HTIC, options_null, AMIGA_init, AMIGA_reset, 
  652.        AMIGA_text, null_scale, AMIGA_graphics, AMIGA_move, AMIGA_vector,
  653.        AMIGA_linetype, AMIGA_put_text, null_text_angle, 
  654.        AMIGA_justify_text, do_point, do_arrow}
  655. #endif
  656.  
  657. #ifdef ATARI
  658.     ,{"atari", "Atari ST/TT",
  659.        ATARI_XMAX, ATARI_YMAX, ATARI_VCHAR, ATARI_HCHAR, 
  660.        ATARI_VTIC, ATARI_HTIC, ATARI_options, ATARI_init, ATARI_reset, 
  661.        ATARI_text, null_scale, ATARI_graphics, ATARI_move, ATARI_vector, 
  662.        ATARI_linetype, ATARI_put_text, ATARI_text_angle, 
  663.        null_justify_text, ATARI_point, do_arrow}
  664. #endif
  665.  
  666. #ifdef DUMB
  667.     ,{"dumb", "printer or glass dumb terminal",
  668.          DUMB_XMAX, DUMB_YMAX, 1, 1,
  669.          1, 1, DUMB_options, DUMB_init, DUMB_reset,
  670.          DUMB_text, null_scale, DUMB_graphics, DUMB_move, DUMB_vector,
  671.          DUMB_linetype, DUMB_put_text, null_text_angle,
  672.          null_justify_text, DUMB_point, DUMB_arrow}
  673. #endif
  674.  
  675. #ifdef PC
  676. #ifndef _Windows
  677. # ifdef __TURBOC__
  678. #ifdef ATT6300
  679.     ,{"att", "IBM PC/Clone with AT&T 6300 graphics board",
  680.        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  681.        ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  682.        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  683.        ATT_linetype, ATT_put_text, ATT_text_angle, 
  684.        ATT_justify_text, line_and_point, do_arrow}
  685. #endif
  686.  
  687.     ,{"cga", "IBM PC/Clone with CGA graphics board",
  688.        CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  689.        CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  690.        CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  691.        CGA_linetype, CGA_put_text, MCGA_text_angle, 
  692.        CGA_justify_text, line_and_point, do_arrow}
  693.  
  694.     ,{"egalib", "IBM PC/Clone with EGA graphics board",
  695.        EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  696.        EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  697.        EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  698.        EGALIB_linetype, EGALIB_put_text, EGALIB_text_angle, 
  699.        EGALIB_justify_text, do_point, do_arrow}
  700.  
  701.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  702.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  703.        HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  704.        HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  705.        HERC_linetype, HERC_put_text, MCGA_text_angle, 
  706.        HERC_justify_text, line_and_point, do_arrow}
  707.  
  708.     ,{"mcga", "IBM PC/Clone with MCGA graphics board",
  709.        MCGA_XMAX, MCGA_YMAX, MCGA_VCHAR, MCGA_HCHAR,
  710.        MCGA_VTIC, MCGA_HTIC, options_null, MCGA_init, MCGA_reset,
  711.        MCGA_text, null_scale, MCGA_graphics, MCGA_move, MCGA_vector,
  712.        MCGA_linetype, MCGA_put_text, MCGA_text_angle, 
  713.        MCGA_justify_text, line_and_point, do_arrow}
  714.  
  715.     ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  716.        SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  717.        SVGA_VTIC, SVGA_HTIC, options_null, SVGA_init, SVGA_reset,
  718.        SVGA_text, null_scale, SVGA_graphics, SVGA_move, SVGA_vector,
  719.        SVGA_linetype, SVGA_put_text, SVGA_text_angle, 
  720.        SVGA_justify_text, do_point, do_arrow}
  721.  
  722.     ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  723.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  724.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  725.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  726.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  727.        VGA_justify_text, do_point, do_arrow}
  728.  
  729.     ,{"vgamono", "IBM PC/Clone with VGA Monochrome graphics board",
  730.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  731.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  732.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  733.        VGAMONO_linetype, VGA_put_text, VGA_text_angle, 
  734.        VGA_justify_text, line_and_point, do_arrow}
  735. #else                    /* TURBO */
  736.  
  737. #ifdef ATT6300
  738.     ,{"att", "AT&T PC/6300 graphics",
  739.        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  740.        ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  741.        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  742.        ATT_linetype, ATT_put_text, ATT_text_angle, 
  743.        null_justify_text, line_and_point, do_arrow}
  744. #endif
  745.  
  746.     ,{"cga", "IBM PC/Clone with CGA graphics board",
  747.        CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  748.        CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  749.        CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  750.        CGA_linetype, CGA_put_text, CGA_text_angle, 
  751.        null_justify_text, line_and_point, do_arrow}
  752.  
  753. #ifdef CORONA
  754.     ,{"corona325", "Corona graphics ???",
  755.        COR_XMAX, COR_YMAX, COR_VCHAR, COR_HCHAR,
  756.        COR_VTIC, COR_HTIC, options_null, COR_init, COR_reset,
  757.        COR_text, null_scale, COR_graphics, COR_move, COR_vector,
  758.        COR_linetype, COR_put_text, COR_text_angle, 
  759.        null_justify_text, line_and_point, do_arrow}
  760. #endif                    /* CORONA */
  761.  
  762.     ,{"egabios", "IBM PC/Clone with EGA graphics board (BIOS)",
  763.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  764.        EGA_VTIC, EGA_HTIC, options_null, EGA_init, EGA_reset,
  765.        EGA_text, null_scale, EGA_graphics, EGA_move, EGA_vector,
  766.        EGA_linetype, EGA_put_text, EGA_text_angle, 
  767.        null_justify_text, do_point, do_arrow}
  768.  
  769. #ifdef EGALIB
  770.     ,{"egalib", "IBM PC/Clone with EGA graphics board (LIB)",
  771.        EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  772.        EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  773.        EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  774.        EGALIB_linetype, EGALIB_put_text, null_text_angle, 
  775.        null_justify_text, do_point, do_arrow}
  776. #endif
  777.  
  778. #ifdef HERCULES
  779.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  780.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  781.        HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  782.        HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  783.        HERC_linetype, HERC_put_text, HERC_text_angle, 
  784.        null_justify_text, line_and_point, do_arrow}
  785. #endif                    /* HERCULES */
  786.  
  787.     ,{"vgabios", "IBM PC/Clone with VGA graphics board (BIOS)",
  788.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  789.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  790.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  791.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  792.        null_justify_text, do_point, do_arrow}
  793.  
  794. #endif                    /* TURBO */
  795. #endif                    /* _Windows */
  796. #endif                    /* PC */
  797.  
  798. #ifdef __ZTC__         /* zortech C flashgraphics for 386 */
  799.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  800.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  801.        HERC_VTIC, HERC_HTIC, options_null, VGA_init, VGA_reset,
  802.        VGA_text, null_scale, HERC_graphics, VGA_move, VGA_vector,
  803.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  804.        VGA_justify_text, do_point, do_arrow}
  805.  
  806.     ,{"egamono", "IBM PC/Clone with monochrome EGA graphics board",
  807.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  808.        EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
  809.        VGA_text, null_scale, EGAMONO_graphics, VGA_move, VGA_vector,
  810.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  811.        VGA_justify_text, do_point, do_arrow}
  812.  
  813.     ,{"egalib", "IBM PC/Clone with color EGA graphics board",
  814.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  815.        EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
  816.        VGA_text, null_scale, EGA_graphics, VGA_move, VGA_vector,
  817.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  818.        VGA_justify_text, do_point, do_arrow}
  819.  
  820.     ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  821.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  822.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  823.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  824.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  825.        VGA_justify_text, do_point, do_arrow}
  826.  
  827.     ,{"vgamono", "IBM PC/Clone with monochrome VGA graphics board",
  828.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  829.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  830.        VGA_text, null_scale, VGAMONO_graphics, VGA_move, VGA_vector,
  831.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  832.        VGA_justify_text, do_point, do_arrow}
  833.  
  834.     ,{"svgalib", "IBM PC/Clone with VESA Super VGA graphics board",
  835.        SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  836.        SVGA_VTIC, SVGA_HTIC, options_null, VGA_init, VGA_reset,
  837.        VGA_text, null_scale, SVGA_graphics, VGA_move, VGA_vector,
  838.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  839.        VGA_justify_text, do_point, do_arrow}
  840.  
  841.     ,{"ssvgalib", "IBM PC/Clone with VESA 256 color 1024 by 768 super VGA",
  842.        SSVGA_XMAX, SSVGA_YMAX, SSVGA_VCHAR, SSVGA_HCHAR,
  843.        SSVGA_VTIC, SSVGA_HTIC, options_null, VGA_init, VGA_reset,
  844.        VGA_text, null_scale, SSVGA_graphics, VGA_move, VGA_vector,
  845.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  846.        VGA_justify_text, do_point, do_arrow}
  847. #endif __ZTC__
  848.  
  849. #ifdef AED
  850.     ,{"aed512", "AED 512 Terminal",
  851.        AED5_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  852.        AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  853.        AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  854.        AED_linetype, AED_put_text, null_text_angle, 
  855.        null_justify_text, do_point, do_arrow}
  856.     ,{"aed767", "AED 767 Terminal",
  857.        AED_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  858.        AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  859.        AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  860.        AED_linetype, AED_put_text, null_text_angle, 
  861.        null_justify_text, do_point, do_arrow}
  862. #endif
  863.  
  864. #ifdef AIFM
  865.     ,{"aifm", "Adobe Illustrator 3.0 Format",
  866.        AI_XMAX, AI_YMAX, AI_VCHAR, AI_HCHAR, 
  867.        AI_VTIC, AI_HTIC, AI_options, AI_init, AI_reset, 
  868.        AI_text, null_scale, AI_graphics, AI_move, AI_vector, 
  869.        AI_linetype, AI_put_text, AI_text_angle, 
  870.        AI_justify_text, do_point, do_arrow}
  871. #endif
  872.  
  873. #ifdef APOLLO
  874.        ,{"apollo", "Apollo Graphics Primitive Resource, rescaling of subsequent plots after window resizing",
  875.        0, 0, 0, 0, /* APOLLO_XMAX, APOLLO_YMAX, APOLLO_VCHAR, APOLLO_HCHAR, are filled in at run-time */
  876.        APOLLO_VTIC, APOLLO_HTIC, options_null, APOLLO_init, APOLLO_reset,
  877.        APOLLO_text, null_scale, APOLLO_graphics, APOLLO_move, APOLLO_vector,
  878.        APOLLO_linetype, APOLLO_put_text, APOLLO_text_angle,
  879.        APOLLO_justify_text, line_and_point, do_arrow}
  880. #endif
  881.  
  882. #ifdef GPR
  883.        ,{"gpr", "Apollo Graphics Primitive Resource, fixed-size window",
  884.        GPR_XMAX, GPR_YMAX, GPR_VCHAR, GPR_HCHAR,
  885.        GPR_VTIC, GPR_HTIC, options_null, GPR_init, GPR_reset,
  886.        GPR_text, null_scale, GPR_graphics, GPR_move, GPR_vector,
  887.        GPR_linetype, GPR_put_text, GPR_text_angle,
  888.        GPR_justify_text, line_and_point, do_arrow}
  889. #endif
  890.  
  891. #ifdef BITGRAPH
  892.     ,{"bitgraph", "BBN Bitgraph Terminal",
  893.        BG_XMAX,BG_YMAX,BG_VCHAR, BG_HCHAR, 
  894.        BG_VTIC, BG_HTIC, options_null, BG_init, BG_reset, 
  895.        BG_text, null_scale, BG_graphics, BG_move, BG_vector,
  896.        BG_linetype, BG_put_text, null_text_angle, 
  897.        null_justify_text, line_and_point, do_arrow}
  898. #endif
  899.  
  900. #ifdef COREL
  901.     ,{"corel","EPS format for CorelDRAW",
  902.      CORELD_XMAX, CORELD_YMAX, CORELD_VCHAR, CORELD_HCHAR,
  903.      CORELD_VTIC, CORELD_HTIC, COREL_options, COREL_init, COREL_reset,
  904.      COREL_text, null_scale, COREL_graphics, COREL_move, COREL_vector,
  905.      COREL_linetype, COREL_put_text, COREL_text_angle,
  906.      COREL_justify_text, do_point, do_arrow}
  907. #endif
  908.  
  909. #ifdef CGI
  910.     ,{"cgi", "SCO CGI drivers (requires CGIDISP or CGIPRNT env variable)",
  911.        CGI_XMAX, CGI_YMAX, 0, 0, 
  912.        CGI_VTIC, 0, options_null, CGI_init, CGI_reset, 
  913.        CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  914.        CGI_linetype, CGI_put_text, CGI_text_angle, 
  915.        CGI_justify_text, CGI_point, do_arrow}
  916.  
  917.     ,{"hcgi", "SCO CGI drivers (hardcopy, requires CGIPRNT env variable)",
  918.        CGI_XMAX, CGI_YMAX, 0, 0, 
  919.        CGI_VTIC, 0, options_null, HCGI_init, CGI_reset, 
  920.        CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  921.        CGI_linetype, CGI_put_text, CGI_text_angle, 
  922.        CGI_justify_text, CGI_point, do_arrow}
  923. #endif
  924.  
  925. #ifdef DEBUG
  926.     ,{"debug", "debugging driver",
  927.        DEBUG_XMAX, DEBUG_YMAX, DEBUG_VCHAR, DEBUG_HCHAR,
  928.        DEBUG_VTIC, DEBUG_HTIC, options_null, DEBUG_init, DEBUG_reset,
  929.        DEBUG_text, null_scale, DEBUG_graphics, DEBUG_move, DEBUG_vector,
  930.        DEBUG_linetype, DEBUG_put_text, null_text_angle, 
  931.        DEBUG_justify_text, line_and_point, do_arrow}
  932. #endif
  933.  
  934. #ifdef DJSVGA
  935.     ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  936.        DJSVGA_XMAX, DJSVGA_YMAX, DJSVGA_VCHAR, DJSVGA_HCHAR,
  937.        DJSVGA_VTIC, DJSVGA_HTIC, options_null, DJSVGA_init, DJSVGA_reset,
  938.        DJSVGA_text, null_scale, DJSVGA_graphics, DJSVGA_move, DJSVGA_vector,
  939.        DJSVGA_linetype, DJSVGA_put_text, null_text_angle, 
  940.        null_justify_text, do_point, do_arrow}
  941. #endif
  942.  
  943. #ifdef DXF
  944.     ,{"dxf", "dxf-file for AutoCad (default size 120x80)",
  945.        DXF_XMAX,DXF_YMAX,DXF_VCHAR, DXF_HCHAR,
  946.        DXF_VTIC, DXF_HTIC, options_null,DXF_init, DXF_reset,
  947.        DXF_text, null_scale, DXF_graphics, DXF_move, DXF_vector,
  948.        DXF_linetype, DXF_put_text, DXF_text_angle,
  949.        DXF_justify_text, do_point, do_arrow}
  950. #endif
  951.  
  952. #ifdef DXY800A
  953.     ,{"dxy800a", "Roland DXY800A plotter",
  954.        DXY_XMAX, DXY_YMAX, DXY_VCHAR, DXY_HCHAR,
  955.        DXY_VTIC, DXY_HTIC, options_null, DXY_init, DXY_reset,
  956.        DXY_text, null_scale, DXY_graphics, DXY_move, DXY_vector,
  957.        DXY_linetype, DXY_put_text, DXY_text_angle, 
  958.        null_justify_text, do_point, do_arrow}
  959. #endif
  960.  
  961. #ifdef EEPIC
  962.     ,{"eepic", "EEPIC -- extended LaTeX picture environment",
  963.        EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR, 
  964.        EEPIC_VTIC, EEPIC_HTIC, options_null, EEPIC_init, EEPIC_reset, 
  965.        EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector, 
  966.        EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle, 
  967.        EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
  968. #endif
  969.  
  970. #ifdef EMTEX
  971.     ,{"emtex", "LaTeX picture environment with emTeX specials",
  972.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  973.        LATEX_VTIC, LATEX_HTIC, LATEX_options, EMTEX_init, EMTEX_reset, 
  974.        EMTEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  975.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  976.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  977. #endif
  978.  
  979. #ifdef EPS60
  980.     ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
  981.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  982.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  983.        EPS60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  984.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  985.        null_justify_text, do_point, do_arrow}
  986. #endif
  987.  
  988. #ifdef EPSONP
  989.     ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
  990.        EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  991.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset, 
  992.        EPSONtext, null_scale, EPSONgraphics, EPSONmove, EPSONvector, 
  993.        EPSONlinetype, EPSONput_text, EPSON_text_angle, 
  994.        null_justify_text, line_and_point, do_arrow}
  995. #endif
  996.  
  997. #ifdef EXCL
  998.     ,{"excl", "Talaris EXCL Laser printer (also Talaris 1590 and others)",
  999.        EXCL_XMAX,EXCL_YMAX, EXCL_VCHAR, EXCL_HCHAR, 
  1000.        EXCL_VTIC, EXCL_HTIC, options_null, EXCL_init,EXCL_reset, 
  1001.        EXCL_text, null_scale, EXCL_graphics, EXCL_move, EXCL_vector,
  1002.        EXCL_linetype,EXCL_put_text, null_text_angle, 
  1003.        null_justify_text, line_and_point, do_arrow}
  1004. #endif
  1005.  
  1006.  
  1007. #ifdef FIG
  1008.     ,{"fig", "FIG graphics language: SunView or X graphics editor",
  1009.        FIG_XMAX, FIG_YMAX, FIG_VCHAR, FIG_HCHAR, 
  1010.        FIG_VTIC, FIG_HTIC, options_null, FIG_init, FIG_reset, 
  1011.        FIG_text, null_scale, FIG_graphics, FIG_move, FIG_vector, 
  1012.        FIG_linetype, FIG_put_text, FIG_text_angle, 
  1013.        FIG_justify_text, do_point, FIG_arrow}
  1014.     ,{"bfig", "FIG language: SunView or X graphics editor. Large Graph",
  1015.        BFIG_XMAX, BFIG_YMAX, BFIG_VCHAR, BFIG_HCHAR, 
  1016.        BFIG_VTIC, BFIG_HTIC, options_null, FIG_init, FIG_reset, 
  1017.        FIG_text, null_scale, FIG_graphics, FIG_move, BFIG_vector, 
  1018.        FIG_linetype, BFIG_put_text, FIG_text_angle, 
  1019.        FIG_justify_text, do_point, BFIG_arrow}
  1020. #endif
  1021.  
  1022. #ifdef GRASS
  1023.     ,{"grass", "GRASS Graphics Monitor",
  1024.            GRASS_XMAX, GRASS_YMAX, GRASS_VCHAR, GRASS_HCHAR,
  1025.            GRASS_VTIC, GRASS_HTIC, GRASS_options, GRASS_init, GRASS_reset,
  1026.            GRASS_text, null_scale, GRASS_graphics, GRASS_move, GRASS_vector,
  1027.            GRASS_linetype, GRASS_put_text, GRASS_text_angle,
  1028.            GRASS_justify_text, GRASS_point, GRASS_arrow}
  1029. #endif
  1030.  
  1031. #ifdef HP26
  1032.     ,{"hp2623A", "HP2623A and maybe others",
  1033.        HP26_XMAX, HP26_YMAX, HP26_VCHAR, HP26_HCHAR,
  1034.        HP26_VTIC, HP26_HTIC, options_null, HP26_init, HP26_reset,
  1035.        HP26_text, null_scale, HP26_graphics, HP26_move, HP26_vector,
  1036.        HP26_linetype, HP26_put_text, HP26_text_angle, 
  1037.        null_justify_text, HP26_line_and_point, do_arrow}
  1038. #endif
  1039.  
  1040. #ifdef HP2648
  1041.     ,{"hp2648", "HP2648 and HP2647",
  1042.        HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR, 
  1043.        HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset, 
  1044.        HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector, 
  1045.        HP2648linetype, HP2648put_text, HP2648_text_angle, 
  1046.        null_justify_text, line_and_point, do_arrow}
  1047. #endif
  1048.  
  1049. #ifdef HP75
  1050.     ,{"hp7580B", "HP7580, and probably other HPs (4 pens)",
  1051.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1052.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1053.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1054.        HP75_linetype, HPGL_put_text, HPGL_text_angle, 
  1055.        null_justify_text, do_point, do_arrow}
  1056. #endif
  1057.  
  1058. #ifdef HP500C
  1059.       ,{"hp500c", "HP DeskJet 500c, [75 100 150 300] [rle tiff]",
  1060.        HP500C_75PPI_XMAX, HP500C_75PPI_YMAX, HP500C_75PPI_VCHAR,
  1061.        HP500C_75PPI_HCHAR, HP500C_75PPI_VTIC, HP500C_75PPI_HTIC, HP500Coptions,
  1062.        HP500Cinit, HP500Creset, HP500Ctext, null_scale,
  1063.        HP500Cgraphics, HP500Cmove, HP500Cvector, HP500Clinetype,
  1064.        HP500Cput_text, HP500Ctext_angle, null_justify_text, do_point,
  1065.        do_arrow}
  1066. #endif
  1067.  
  1068. #ifdef HPGL
  1069.     ,{"hpgl", "HP7475 and (hopefully) lots of others (6 pens)",
  1070.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1071.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1072.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1073.        HPGL_linetype, HPGL_put_text, HPGL_text_angle, 
  1074.        null_justify_text, do_point, do_arrow}
  1075. #endif
  1076.  
  1077. #ifdef HPLJII
  1078.     ,{"hpljii", "HP Laserjet series II, [75 100 150 300]",
  1079.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1080.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1081.        HPLJIIinit, HPLJIIreset, HPLJIItext, null_scale,
  1082.        HPLJIIgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1083.        HPLJIIput_text, HPLJIItext_angle, null_justify_text, line_and_point,
  1084.        do_arrow}
  1085.     ,{"hpdj", "HP DeskJet 500, [75 100 150 300]",
  1086.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1087.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1088.        HPLJIIinit, HPLJIIreset, HPDJtext, null_scale,
  1089.        HPDJgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1090.        HPDJput_text, HPDJtext_angle, null_justify_text, line_and_point,
  1091.        do_arrow}
  1092. #endif
  1093.  
  1094. #ifdef HPPJ
  1095.     ,{"hppj", "HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]",
  1096.        HPPJ_XMAX, HPPJ_YMAX,
  1097.        HPPJ_9x17_VCHAR, HPPJ_9x17_HCHAR, HPPJ_9x17_VTIC, HPPJ_9x17_HTIC,
  1098.        HPPJoptions, HPPJinit, HPPJreset, HPPJtext, null_scale, HPPJgraphics,
  1099.        HPPJmove, HPPJvector, HPPJlinetype, HPPJput_text, HPPJtext_angle,
  1100.        null_justify_text, do_point, do_arrow}
  1101. #endif
  1102.  
  1103. #ifdef IMAGEN
  1104.     ,{"imagen", "Imagen laser printer",
  1105.        IMAGEN_XMAX, IMAGEN_YMAX, IMAGEN_VCHAR, IMAGEN_HCHAR, 
  1106.        IMAGEN_VTIC, IMAGEN_HTIC, options_null, IMAGEN_init, IMAGEN_reset, 
  1107.        IMAGEN_text, null_scale, IMAGEN_graphics, IMAGEN_move, 
  1108.        IMAGEN_vector, IMAGEN_linetype, IMAGEN_put_text, IMAGEN_text_angle,
  1109.        IMAGEN_justify_text, line_and_point, do_arrow}
  1110. #endif
  1111.  
  1112. #ifdef IRIS4D
  1113.     ,{"iris4d", "Silicon Graphics IRIS 4D Series Computer",
  1114.        IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR, 
  1115.        IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset, 
  1116.        IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
  1117.        IRIS4D_linetype, IRIS4D_put_text, null_text_angle, 
  1118.        null_justify_text, do_point, do_arrow}
  1119. #endif
  1120.  
  1121. #ifdef KERMIT
  1122.     ,{"kc_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - color",
  1123.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1124.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1125.        KTEK40Ctext, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1126.        KTEK40Clinetype, TEK40put_text, null_text_angle, 
  1127.        null_justify_text, do_point, do_arrow}
  1128.     ,{"km_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - monochrome",
  1129.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1130.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1131.        TEK40text, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1132.        KTEK40Mlinetype, TEK40put_text, null_text_angle, 
  1133.        null_justify_text, line_and_point, do_arrow}
  1134. #endif
  1135.  
  1136. #ifdef LATEX
  1137.     ,{"latex", "LaTeX picture environment",
  1138.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  1139.        LATEX_VTIC, LATEX_HTIC, LATEX_options, LATEX_init, LATEX_reset, 
  1140.        LATEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  1141.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  1142.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  1143. #endif
  1144.  
  1145. #ifdef LN03P
  1146.      ,{"ln03", "LN03-plus laser printer in tektronix (EGM) mode",
  1147.     LN03PXMAX, LN03PYMAX, LN03PVCHAR, LN03PHCHAR,
  1148.     LN03PVTIC, LN03PHTIC, options_null, LN03Pinit, LN03Preset,
  1149.     LN03Ptext, null_scale, TEK40graphics, LN03Pmove, LN03Pvector,
  1150.     LN03Plinetype, LN03Pput_text, null_text_angle,
  1151.     null_justify_text, line_and_point, do_arrow}
  1152. #endif
  1153.  
  1154. #ifdef MF
  1155.     ,{"mf", "Metafont plotting standard",
  1156.        MF_XMAX, MF_YMAX, MF_VCHAR, MF_HCHAR, 
  1157.        MF_VTIC, MF_HTIC, options_null, MF_init, MF_reset, 
  1158.        MF_text, MF_scale, MF_graphics, MF_move, MF_vector, 
  1159.        MF_linetype, MF_put_text, MF_text_angle, 
  1160.        MF_justify_text, line_and_point, MF_arrow}
  1161. #endif
  1162.  
  1163. #ifdef MIF
  1164.     ,{"mif", "Frame maker MIF 3.00 format",
  1165.        MIF_XMAX, MIF_YMAX, MIF_VCHAR, MIF_HCHAR, 
  1166.        MIF_VTIC, MIF_HTIC, MIF_options, MIF_init, MIF_reset, 
  1167.        MIF_text, null_scale, MIF_graphics, MIF_move, MIF_vector, 
  1168.        MIF_linetype, MIF_put_text, null_text_angle, 
  1169.        MIF_justify_text, line_and_point, do_arrow}
  1170. #endif
  1171.  
  1172. #ifdef NEC
  1173.     ,{"nec_cp6", "NEC printer CP6, Epson LQ-800 [monocrome color draft]",
  1174.        NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  1175.        NECVTIC, NECHTIC, NECoptions, NECinit, NECreset, 
  1176.        NECtext, null_scale, NECgraphics, NECmove, NECvector, 
  1177.        NEClinetype, NECput_text, NEC_text_angle, 
  1178.        null_justify_text, line_and_point, do_arrow}
  1179. #endif
  1180.  
  1181. #ifdef NEXT
  1182.     ,{"next", "NeXTstep window system",
  1183.        NEXT_XMAX, NEXT_YMAX, NEXT_VCHAR, NEXT_HCHAR, 
  1184.        NEXT_VTIC, NEXT_HTIC, NEXT_options, NEXT_init, NEXT_reset, 
  1185.        NEXT_text, do_scale, NEXT_graphics, NEXT_move, NEXT_vector, 
  1186.        NEXT_linetype, NEXT_put_text, NEXT_text_angle, 
  1187.        NEXT_justify_text, NEXT_point, do_arrow}
  1188. #endif /* The PostScript driver with NXImage displaying the PostScript on screen */
  1189.  
  1190. #ifdef NEXTFE
  1191.     ,{"nextfe", "NeXTSTEP Front End",
  1192.            NEXTFE_XMAX, NEXTFE_YMAX, NEXTFE_VCHAR, NEXTFE_HCHAR, 
  1193.            NEXTFE_VTIC, NEXTFE_HTIC, NEXTFE_options, NEXTFE_init, NEXTFE_reset,
  1194.            NEXTFE_text, null_scale, NEXTFE_graphics, NEXTFE_move,NEXTFE_vector,
  1195.            NEXTFE_linetype, NEXTFE_put_text, NEXTFE_text_angle, 
  1196.            NEXTFE_justify_text, NEXTFE_point, do_arrow}
  1197. #endif
  1198.  
  1199. #ifdef OS2PM
  1200.     ,{"pm", "OS/2 Presentation Manager",
  1201.        PM_XMAX, PM_YMAX, PM_VCHAR, PM_HCHAR, 
  1202.        PM_VTIC, PM_HTIC, PM_args, PM_init, PM_reset, 
  1203.        PM_text, null_scale, PM_graphics, PM_move, PM_vector,
  1204.        PM_linetype, PM_put_text, PM_text_angle, 
  1205.        PM_justify_text, PM_point, do_arrow}
  1206. #endif
  1207.  
  1208. #ifdef PBM
  1209.     ,{"pbm", "Portable bitmap [small medium large] [monochrome gray color]",
  1210.        PBM_XMAX, PBM_YMAX, PBM_VCHAR,
  1211.        PBM_HCHAR, PBM_VTIC, PBM_HTIC, PBMoptions,
  1212.        PBMinit, PBMreset, PBMtext, null_scale,
  1213.        PBMgraphics, PBMmove, PBMvector, PBMlinetype,
  1214.        PBMput_text, PBMtext_angle, null_justify_text, PBMpoint,
  1215.        do_arrow}
  1216. #endif
  1217.  
  1218. #ifdef PCL
  1219.  ,{"pcl5", "HP LaserJet III [mode] [font] [point]",
  1220.    PCL_XMAX, PCL_YMAX, HPGL2_VCHAR, HPGL2_HCHAR,
  1221.    PCL_VTIC, PCL_HTIC, PCL_options, PCL_init, PCL_reset,
  1222.    PCL_text, null_scale, PCL_graphics, HPGL2_move, HPGL2_vector,
  1223.    HPGL2_linetype, HPGL2_put_text, HPGL2_text_angle,
  1224.    HPGL2_justify_text, do_point, do_arrow}
  1225. #endif
  1226.  
  1227. #ifdef PIC
  1228.     ,{"gpic", "GPIC -- Produce graphs in groff using the gpic preprocessor",
  1229.        PIC_XMAX, PIC_YMAX, PIC_VCHAR, PIC_HCHAR, 
  1230.        PIC_VTIC, PIC_HTIC, PIC_options, PIC_init, PIC_reset, 
  1231.        PIC_text, PIC_scale, PIC_graphics, PIC_move, PIC_vector, 
  1232.        PIC_linetype, PIC_put_text, PIC_text_angle, 
  1233.        PIC_justify_text, line_and_point, PIC_arrow}
  1234. #endif
  1235.  
  1236. #ifdef POSTSCRIPT
  1237.     ,{"postscript", "PostScript graphics language [mode \042fontname\042 font_size]",
  1238.        PS_XMAX, PS_YMAX, PS_VCHAR, PS_HCHAR, 
  1239.        PS_VTIC, PS_HTIC, PS_options, PS_init, PS_reset, 
  1240.        PS_text, null_scale, PS_graphics, PS_move, PS_vector, 
  1241.        PS_linetype, PS_put_text, PS_text_angle, 
  1242.        PS_justify_text, PS_point, do_arrow}
  1243. #endif
  1244.  
  1245. #ifdef PRESCRIBE
  1246.     ,{"prescribe", "Prescribe - for the Kyocera Laser Printer",
  1247.     PRE_XMAX, PRE_YMAX, PRE_VCHAR, PRE_HCHAR, 
  1248.     PRE_VTIC, PRE_HTIC, options_null, PRE_init, PRE_reset, 
  1249.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1250.     PRE_linetype, PRE_put_text, null_text_angle, 
  1251.     PRE_justify_text, line_and_point, do_arrow}
  1252.     ,{"kyo", "Kyocera Laser Printer with Courier font",
  1253.     PRE_XMAX, PRE_YMAX, KYO_VCHAR, KYO_HCHAR, 
  1254.     PRE_VTIC, PRE_HTIC, options_null, KYO_init, PRE_reset, 
  1255.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1256.     PRE_linetype, PRE_put_text, null_text_angle, 
  1257.     PRE_justify_text, line_and_point, do_arrow}
  1258. #endif /* PRESCRIBE */
  1259.  
  1260. #ifdef PSLATEX
  1261.     ,{"pslatex", "LaTeX picture environment with PostScript \\specials",
  1262.     PS_XMAX, PS_YMAX, PSLATEX_VCHAR, PSLATEX_HCHAR,
  1263.     PS_VTIC, PS_HTIC, PSLATEX_options, PSLATEX_init, PSLATEX_reset,
  1264.     PSLATEX_text, PSLATEX_scale, PSLATEX_graphics, PS_move, PS_vector,
  1265.     PS_linetype, PSLATEX_put_text, PSLATEX_text_angle,
  1266.     PSLATEX_justify_text, PS_point, do_arrow}
  1267. #endif
  1268.  
  1269. #ifdef    PSTRICKS
  1270.     ,{"pstricks", "LaTeX picture environment with PSTricks macros",
  1271.        PSTRICKS_XMAX, PSTRICKS_YMAX, PSTRICKS_VCHAR, PSTRICKS_HCHAR, 
  1272.        PSTRICKS_VTIC, PSTRICKS_HTIC, options_null, PSTRICKS_init, PSTRICKS_reset, 
  1273.        PSTRICKS_text, PSTRICKS_scale, PSTRICKS_graphics, PSTRICKS_move, PSTRICKS_vector, 
  1274.        PSTRICKS_linetype, PSTRICKS_put_text, PSTRICKS_text_angle, 
  1275.        PSTRICKS_justify_text, PSTRICKS_point, PSTRICKS_arrow}
  1276. #endif
  1277.     
  1278. #ifdef QMS
  1279.     ,{"qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
  1280.        QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR, 
  1281.        QMS_VTIC, QMS_HTIC, options_null, QMS_init,QMS_reset, 
  1282.        QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
  1283.        QMS_linetype,QMS_put_text, null_text_angle, 
  1284.        null_justify_text, line_and_point, do_arrow}
  1285. #endif
  1286.  
  1287. #ifdef REGIS
  1288.     ,{"regis", "REGIS graphics language",
  1289.        REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR, 
  1290.        REGISVTIC, REGISHTIC, options_null, REGISinit, REGISreset, 
  1291.        REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
  1292.        REGISlinetype, REGISput_text, REGIStext_angle, 
  1293.        null_justify_text, line_and_point, do_arrow}
  1294. #endif
  1295.  
  1296. #ifdef RGIP
  1297.     ,{"rgip", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1298.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1299.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1300.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1301.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1302.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1303.     ,{"uniplex", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1304.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1305.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1306.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1307.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1308.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1309. #endif
  1310.  
  1311. #ifdef SELANAR
  1312.     ,{"selanar", "Selanar",
  1313.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1314.        TEK40VTIC, TEK40HTIC, options_null, SEL_init, SEL_reset, 
  1315.        SEL_text, null_scale, SEL_graphics, TEK40move, TEK40vector, 
  1316.        TEK40linetype, TEK40put_text, null_text_angle, 
  1317.        null_justify_text, line_and_point, do_arrow}
  1318. #endif
  1319.  
  1320. #ifdef STARC
  1321.     ,{"starc", "Star Color Printer",
  1322.        STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR, 
  1323.        STARCVTIC, STARCHTIC, options_null, STARCinit, STARCreset, 
  1324.        STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector, 
  1325.        STARClinetype, STARCput_text, STARC_text_angle, 
  1326.        null_justify_text, line_and_point, do_arrow}
  1327. #endif
  1328.  
  1329. #ifdef SUN
  1330.     ,{"sun", "SunView window system",
  1331.        SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR, 
  1332.        SUN_VTIC, SUN_HTIC, options_null, SUN_init, SUN_reset, 
  1333.        SUN_text, null_scale, SUN_graphics, SUN_move, SUN_vector,
  1334.        SUN_linetype, SUN_put_text, null_text_angle, 
  1335.        SUN_justify_text, line_and_point, do_arrow}
  1336. #endif
  1337.  
  1338. #ifdef VWS
  1339.     ,{"VWS", "VAX Windowing System (UIS)",
  1340.            VWS_XMAX, VWS_YMAX, VWS_VCHAR, VWS_HCHAR,
  1341.            VWS_VTIC, VWS_HTIC, options_null, VWS_init, VWS_reset,
  1342.            VWS_text, null_scale, VWS_graphics, VWS_move, VWS_vector,
  1343.            VWS_linetype, VWS_put_text, VWS_text_angle,
  1344.            VWS_justify_text, do_point, do_arrow}
  1345. #endif
  1346.  
  1347. #ifdef TANDY60
  1348.     ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
  1349.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1350.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1351.        TANDY60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1352.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1353.        null_justify_text, do_point, do_arrow}
  1354. #endif
  1355.  
  1356. #ifdef T410X
  1357.     ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
  1358.        T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR, 
  1359.        T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset, 
  1360.        T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector, 
  1361.        T410X_linetype, T410X_put_text, T410X_text_angle, 
  1362.        null_justify_text, T410X_point, do_arrow}
  1363. #endif
  1364.  
  1365. #ifdef TEK
  1366.     ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
  1367.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1368.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, TEK40reset, 
  1369.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector, 
  1370.        TEK40linetype, TEK40put_text, null_text_angle, 
  1371.        null_justify_text, line_and_point, do_arrow}
  1372. #endif
  1373.  
  1374. #ifdef TEXDRAW
  1375.     ,{"texdraw", "LaTeX texdraw environment",
  1376.        TEXDRAW_XMAX, TEXDRAW_YMAX, TEXDRAW_VCHAR, TEXDRAW_HCHAR,
  1377.     TEXDRAW_VTIC, TEXDRAW_HTIC, options_null, TEXDRAW_init, TEXDRAW_reset,
  1378.     TEXDRAW_text, TEXDRAW_scale, TEXDRAW_graphics, TEXDRAW_move, TEXDRAW_vector,
  1379.     TEXDRAW_linetype, TEXDRAW_put_text, TEXDRAW_text_angle,
  1380.     TEXDRAW_justify_text, TEXDRAW_point, TEXDRAW_arrow}
  1381. #endif
  1382.   
  1383. #ifdef TGIF
  1384.     ,{"tgif", "TGIF X-Window draw tool (file version 10)",
  1385.        TGIF_XMAX, TGIF_YMAX, TGIF_VCHAR1, TGIF_HCHAR1, 
  1386.        TGIF_VTIC, TGIF_HTIC, options_null, TGIF_init, TGIF_reset, 
  1387.        TGIF_text, null_scale, TGIF_graphics, TGIF_move, TGIF_vector, 
  1388.        TGIF_linetype, TGIF_put_text, TGIF_text_angle, 
  1389.        TGIF_justify_text, line_and_point, TGIF_arrow}
  1390. #endif
  1391.  
  1392. #ifdef TPIC
  1393.     ,{"tpic", "TPIC -- LaTeX picture environment with tpic \\specials",
  1394.        TPIC_XMAX, TPIC_YMAX, TPIC_VCHAR, TPIC_HCHAR, 
  1395.        TPIC_VTIC, TPIC_HTIC, TPIC_options, TPIC_init, TPIC_reset, 
  1396.        TPIC_text, TPIC_scale, TPIC_graphics, TPIC_move, TPIC_vector, 
  1397.        TPIC_linetype, TPIC_put_text, TPIC_text_angle, 
  1398.        TPIC_justify_text, TPIC_point, TPIC_arrow}
  1399. #endif
  1400.  
  1401. #ifdef UNIXPLOT
  1402. #ifdef GNUGRAPH
  1403.     ,{"unixplot", "GNU plot(1) format [\042fontname\042 font_size]",
  1404.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR,
  1405.        UP_VTIC, UP_HTIC, UP_options, UP_init, UP_reset,
  1406.        UP_text, null_scale, UP_graphics, UP_move, UP_vector,
  1407.        UP_linetype, UP_put_text, UP_text_angle,
  1408.        UP_justify_text, line_and_point, do_arrow}
  1409. #else
  1410.     ,{"unixplot", "Unix plotting standard (see plot(1))",
  1411.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, 
  1412.        UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset, 
  1413.        UP_text, null_scale, UP_graphics, UP_move, UP_vector, 
  1414.        UP_linetype, UP_put_text, null_text_angle, 
  1415.        null_justify_text, line_and_point, do_arrow}
  1416. #endif /* GNUGRAPH */
  1417. #endif
  1418.     
  1419. #ifdef UNIXPC
  1420.     ,{"unixpc", "AT&T 3b1 or AT&T 7300 Unix PC",
  1421.        uPC_XMAX, uPC_YMAX, uPC_VCHAR, uPC_HCHAR, 
  1422.        uPC_VTIC, uPC_HTIC, options_null, uPC_init, uPC_reset, 
  1423.        uPC_text, null_scale, uPC_graphics, uPC_move, uPC_vector,
  1424.        uPC_linetype, uPC_put_text, uPC_text_angle, 
  1425.        null_justify_text, line_and_point, do_arrow}
  1426. #endif
  1427.  
  1428. #ifdef EMXVGA
  1429.     ,{"vgal", "IBM PC/Clone with VGA graphics board",
  1430.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1431.        EMXVGA_VTIC, EMXVGA_HTIC, options_null, EMXVGA_init, EMXVGA_reset,
  1432.        EMXVGA_text, null_scale, EMXVGA_graphics, EMXVGA_move, EMXVGA_vector,
  1433.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1434.        null_justify_text, do_point, do_arrow}
  1435. #endif
  1436.  
  1437. #ifdef V384
  1438.     ,{"vx384", "Vectrix 384 and Tandy color printer",
  1439.        V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR, 
  1440.        V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset, 
  1441.        V384_text, null_scale, V384_graphics, V384_move, V384_vector, 
  1442.        V384_linetype, V384_put_text, null_text_angle, 
  1443.        null_justify_text, do_point, do_arrow}
  1444. #endif
  1445.  
  1446. #ifdef VTTEK
  1447.     ,{"vttek", "VT-like tek40xx terminal emulator",
  1448.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, TEK40HCHAR,
  1449.        TEK40VTIC, TEK40HTIC, options_null, VTTEK40init, VTTEK40reset,
  1450.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
  1451.        VTTEK40linetype, VTTEK40put_text, null_text_angle,
  1452.        null_justify_text, line_and_point, do_arrow}
  1453. #endif
  1454.  
  1455. #ifdef _Windows
  1456.     ,{"windows", "Microsoft Windows",
  1457.        WIN_XMAX, WIN_YMAX, WIN_VCHAR, WIN_HCHAR, 
  1458.        WIN_VTIC, WIN_HTIC, WIN_options, WIN_init, WIN_reset, 
  1459.        WIN_text, WIN_scale, WIN_graphics, WIN_move, WIN_vector,
  1460.        WIN_linetype, WIN_put_text, WIN_text_angle, 
  1461.        WIN_justify_text, WIN_point, do_arrow}
  1462. #endif
  1463.  
  1464. #ifdef X11
  1465.     ,{"x11", "X11 Window System",
  1466.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1467.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1468.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1469.        X11_linetype, X11_put_text, null_text_angle, 
  1470.        X11_justify_text, X11_point, do_arrow}
  1471.    ,{"xlib", "X11 Window System (gnulib_x11 dump)",
  1472.        Xlib_XMAX, Xlib_YMAX, Xlib_VCHAR, Xlib_HCHAR, 
  1473.        Xlib_VTIC, Xlib_HTIC, options_null, Xlib_init, Xlib_reset, 
  1474.        Xlib_text, null_scale, Xlib_graphics, Xlib_move, Xlib_vector, 
  1475.        Xlib_linetype, Xlib_put_text, null_text_angle, 
  1476.        Xlib_justify_text, line_and_point, do_arrow}
  1477. #endif
  1478. };
  1479.  
  1480. #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
  1481.  
  1482.  
  1483. list_terms()
  1484. {
  1485. register int i;
  1486.  
  1487.     fprintf(stderr,"\nAvailable terminal types:\n");
  1488.     for (i = 0; i < TERMCOUNT; i++)
  1489.         fprintf(stderr,"  %15s  %s\n",
  1490.                term_tbl[i].name, term_tbl[i].description);
  1491.     (void) putc('\n',stderr);
  1492. }
  1493.  
  1494.  
  1495. /* set_term: get terminal number from name on command line */
  1496. /* will change 'term' variable if successful */
  1497. int                        /* term number */
  1498. set_term(c_token)
  1499. int c_token;
  1500. {
  1501.     register int t;
  1502.     char *input_name;
  1503.  
  1504.     if (!token[c_token].is_token)
  1505.      int_error("terminal name expected",c_token);
  1506.     t = -1;
  1507.     input_name = input_line + token[c_token].start_index;
  1508.     t = change_term(input_name, token[c_token].length);
  1509.     if (t == -1)
  1510.      int_error("unknown terminal type; type just 'set terminal' for a list",
  1511.              c_token);
  1512.     if (t == -2)
  1513.      int_error("ambiguous terminal name; type just 'set terminal' for a list",
  1514.              c_token);
  1515.  
  1516.     /* otherwise the type was changed */
  1517.  
  1518.     return(t);
  1519. }
  1520.  
  1521. /* change_term: get terminal number from name and set terminal type */
  1522. /* returns -1 if unknown, -2 if ambiguous, >=0 is terminal number */
  1523. int
  1524. change_term(name, length)
  1525.     char *name;
  1526.     int length;
  1527. {
  1528.     int i, t = -1;
  1529.  
  1530.     for (i = 0; i < TERMCOUNT; i++) {
  1531.        if (!strncmp(name,term_tbl[i].name,length)) {
  1532.           if (t != -1)
  1533.             return(-2);    /* ambiguous */
  1534.           t = i;
  1535.        }
  1536.     }
  1537.  
  1538.     if (t == -1)            /* unknown */
  1539.      return(t);
  1540.  
  1541.     /* Success: set terminal type now */
  1542.  
  1543.     term = t;
  1544.     term_init = FALSE;
  1545.     name = term_tbl[term].name;
  1546.  
  1547.     /* Special handling for unixplot term type */
  1548.     if (!strncmp("unixplot",name,8)) {
  1549.        UP_redirect (2);  /* Redirect actual stdout for unixplots */
  1550.     } else if (unixplot) {
  1551.        UP_redirect (3);  /* Put stdout back together again. */
  1552.     }
  1553.  
  1554.     if (interactive)
  1555.      fprintf(stderr, "Terminal type set to '%s'\n", name);
  1556.  
  1557.     return(t);
  1558. }
  1559.  
  1560. /*
  1561.    Routine to detect what terminal is being used (or do anything else
  1562.    that would be nice).  One anticipated (or allowed for) side effect
  1563.    is that the global ``term'' may be set. 
  1564.    The environment variable GNUTERM is checked first; if that does
  1565.    not exist, then the terminal hardware is checked, if possible, 
  1566.    and finally, we can check $TERM for some kinds of terminals.
  1567.    A default can be set with -DDEFAULTTERM=myterm in the Makefile
  1568.    or #define DEFAULTTERM myterm in term.h
  1569. */
  1570. /* thanks to osupyr!alden (Dave Alden) for the original GNUTERM code */
  1571. init_terminal()
  1572. {
  1573.     int t;
  1574. #ifdef DEFAULTTERM
  1575.     char *term_name = DEFAULTTERM;
  1576. #else
  1577.     char *term_name = NULL;
  1578. #endif /* DEFAULTTERM */
  1579.     char *term = NULL;        /* from TERM environment var */
  1580. #ifdef X11
  1581.     char *display = NULL;
  1582. #endif
  1583.     char *gnuterm = NULL;
  1584.  
  1585.     /* GNUTERM environment variable is primary */
  1586.     gnuterm = getenv("GNUTERM");
  1587.     if (gnuterm != (char *)NULL) {
  1588.      term_name = gnuterm;
  1589. #ifndef _Windows
  1590. #if defined(__TURBOC__) && defined(MSDOS)
  1591.          get_path();   /* So *_init() can find the BGI driver */
  1592. # endif
  1593. #endif
  1594.     }
  1595.     else {
  1596. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  1597.        term_name = turboc_init();
  1598.        term = (char *)NULL; /* shut up turbo C */
  1599. #endif
  1600.        
  1601. #ifdef __ZTC__
  1602.       term_name = ztc_init();
  1603. #endif
  1604.  
  1605. #ifdef vms
  1606.        term_name = vms_init();
  1607. #endif
  1608.  
  1609. #ifdef NEXT
  1610.     term = getenv("TERM");
  1611.     if (term_name == (char *)NULL
  1612.         && term != (char *)NULL && strcmp(term,"next") == 0)
  1613.           term_name = "next";
  1614. #endif /* NeXT */
  1615.        
  1616. #ifdef SUN
  1617.        term = getenv("TERM");    /* try $TERM */
  1618.        if (term_name == (char *)NULL
  1619.           && term != (char *)NULL && strcmp(term, "sun") == 0)
  1620.         term_name = "sun";
  1621. #endif /* sun */
  1622.  
  1623. #ifdef _Windows
  1624.         term_name = "win";
  1625. #endif /* _Windows */
  1626.  
  1627. #ifdef GPR
  1628.    if (gpr_isa_pad()) term_name = "gpr";       /* find out whether stdout is a DM pad. See term/gpr.trm */
  1629. #else
  1630. #ifdef APOLLO
  1631.    if (apollo_isa_pad()) term_name = "apollo"; /* find out whether stdout is a DM pad. See term/apollo.trm */
  1632. #endif /* APOLLO */
  1633. #endif /* GPR    */
  1634.  
  1635. #ifdef X11
  1636.        term = getenv("TERM");    /* try $TERM */
  1637.        if (term_name == (char *)NULL
  1638.           && term != (char *)NULL && strcmp(term, "xterm") == 0)
  1639.         term_name = "x11";
  1640.        display = getenv("DISPLAY");
  1641.        if (term_name == (char *)NULL && display != (char *)NULL)
  1642.         term_name = "x11";
  1643.        if (X11_Display)
  1644.         term_name = "x11";
  1645. #endif /* x11 */
  1646.  
  1647. #ifdef AMIGASCREEN
  1648.        term_name = "amiga";
  1649. #endif
  1650.  
  1651. #ifdef ATARI
  1652.        term_name = "atari";
  1653. #endif
  1654.  
  1655. #ifdef UNIXPC
  1656.            if (iswind() == 0) {
  1657.               term_name = "unixpc";
  1658.            }
  1659. #endif /* unixpc */
  1660.  
  1661. #ifdef CGI
  1662.        if (getenv("CGIDISP") || getenv("CGIPRNT"))
  1663.          term_name = "cgi";
  1664. #endif /*CGI */
  1665.  
  1666. #if defined(MSDOS) && defined(__EMX__)
  1667.        term_name = "vgal";
  1668. #endif
  1669.  
  1670. #ifdef DJGPP
  1671.         term_name = "svga";
  1672. #endif
  1673.  
  1674. #ifdef GRASS
  1675.         term_name = "grass";
  1676. #endif
  1677.  
  1678. #ifdef OS2
  1679.            term_name = "pm" ;
  1680.             /* EMX compiler has getcwd that can return drive */
  1681.            if( PM_path[0]=='\0' ) _getcwd2( PM_path, 256 ) ;
  1682. #endif /*OS2 */           
  1683.     }
  1684.  
  1685.     /* We have a name, try to set term type */
  1686.     if (term_name != NULL && *term_name != '\0') {
  1687.        t = change_term(term_name, (int)strlen(term_name));
  1688.        if (t == -1)
  1689.         fprintf(stderr, "Unknown terminal name '%s'\n", term_name);
  1690.        else if (t == -2)
  1691.         fprintf(stderr, "Ambiguous terminal name '%s'\n", term_name);
  1692.        else                /* successful */
  1693.         ;
  1694.     }
  1695. }
  1696.  
  1697.  
  1698. #ifndef _Windows
  1699. #if defined (__TURBOC__) && defined (MSDOS)
  1700. char *
  1701. turboc_init()
  1702. {
  1703.   int g_driver,g_mode;
  1704.   char far *c1,*c2;
  1705.   char *term_name = NULL;
  1706.   struct text_info tinfo;       /* So we can restore starting text mode. */
  1707.  
  1708. /* Some of this code including BGI drivers is copyright Borland Intl. */
  1709.     g_driver=DETECT;
  1710.           get_path();
  1711.     gettextinfo(&tinfo);
  1712.         initgraph(&g_driver,&g_mode,path);
  1713.         c1=getdrivername();
  1714.         c2=getmodename(g_mode);
  1715.           switch (g_driver){
  1716.             case -2: fprintf(stderr,"Graphics card not detected.\n");
  1717.                      break;
  1718.             case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
  1719.                      break;
  1720.             case -4: fprintf(stderr,"Invalid BGI driver file.\n");
  1721.                      break;
  1722.             case -5: fprintf(stderr,"Insufficient memory to load ",
  1723.                              "graphics driver.");
  1724.                      break;
  1725.             case 1 : term_name = "cga";
  1726.                      break;
  1727.             case 2 : term_name = "mcga";
  1728.                      break;
  1729.             case 3 : 
  1730.             case 4 : term_name = "egalib";
  1731.                      break;
  1732.             case 7 : term_name = "hercules";
  1733.                      break;
  1734.             case 8 : term_name = "att";
  1735.                      break;
  1736.             case 9 : term_name = "vgalib";
  1737.                      break;
  1738.             }
  1739.         closegraph();
  1740.         textmode(tinfo.currmode);
  1741.     clrscr();
  1742.     fprintf(stderr,"\tTC Graphics, driver %s  mode %s\n",c1,c2);
  1743.   return(term_name);
  1744. }
  1745. # endif /* __TURBOC__ */
  1746. #endif
  1747.  
  1748. #if defined(__ZTC__)
  1749. char *
  1750. ztc_init()
  1751. {
  1752.   int g_mode;
  1753.   char *term_name = NULL;
  1754.  
  1755.     g_mode = fg_init();
  1756.  
  1757.           switch (g_mode){
  1758.             case FG_NULL      :  fprintf(stderr,"Graphics card not detected or not supported.\n");
  1759.                                  exit(1);
  1760.             case FG_HERCFULL  :  term_name = "hercules";
  1761.                                  break;
  1762.             case FG_EGAMONO   :  term_name = "egamono";
  1763.                                  break;
  1764.             case FG_EGAECD      :  term_name = "egalib";
  1765.                                  break;
  1766.             case FG_VGA11      :  term_name = "vgamono";
  1767.                                  break;
  1768.             case FG_VGA12      :  term_name = "vgalib";
  1769.                                  break;
  1770.             case FG_VESA6A      :  term_name = "svgalib";
  1771.                                  break;
  1772.             case FG_VESA5      :  term_name = "ssvgalib";
  1773.                                  break;
  1774.             }
  1775.         fg_term();
  1776.   return(term_name);
  1777. }
  1778. #endif /* __ZTC__ */
  1779.  
  1780.  
  1781. /*
  1782.     This is always defined so we don't have to have command.c know if it
  1783.     is there or not.
  1784. */
  1785. #ifndef UNIXPLOT
  1786. UP_redirect(caller) int caller; 
  1787. {
  1788.     caller = caller;    /* to stop Turbo C complaining 
  1789.                          * about caller not being used */
  1790. }
  1791. #else
  1792. UP_redirect (caller)
  1793. int caller;
  1794. /*
  1795.     Unixplot can't really write to outfile--it wants to write to stdout.
  1796.     This is normally ok, but the original design of gnuplot gives us
  1797.     little choice.  Originally users of unixplot had to anticipate
  1798.     their needs and redirect all I/O to a file...  Not very gnuplot-like.
  1799.  
  1800.     caller:  1 - called from SET OUTPUT "FOO.OUT"
  1801.              2 - called from SET TERM UNIXPLOT
  1802.              3 - called from SET TERM other
  1803.              4 - called from SET OUTPUT
  1804. */
  1805. {
  1806.     switch (caller) {
  1807.     case 1:
  1808.     /* Don't save, just replace stdout w/outfile (save was already done). */
  1809.         if (unixplot)
  1810.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1811.     break;
  1812.     case 2:
  1813.         if (!unixplot) {
  1814.             fflush(stdout);
  1815.             save_stdout = *(stdout);
  1816.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1817.             unixplot = 1;
  1818.         }
  1819.     break;
  1820.     case 3:
  1821.     /* New terminal in use--put stdout back to original. */
  1822.         /* closepl(); */  /* This is called by the term. */
  1823.         fflush(stdout);
  1824.         *(stdout) = save_stdout;  /* Copy FILE structure */
  1825.         unixplot = 0;
  1826.     break;
  1827.     case 4:
  1828.     /*  User really wants to go to normal output... */
  1829.         if (unixplot) {
  1830.             fflush(stdout);
  1831.             *(stdout) = save_stdout;  /* Copy FILE structure */
  1832.         }
  1833.     break;
  1834.     }
  1835. }
  1836. #endif
  1837.  
  1838.  
  1839. /* test terminal by drawing border and text */
  1840. /* called from command test */
  1841. test_term()
  1842. {
  1843.     register struct termentry *t = &term_tbl[term];
  1844.     char *str;
  1845.     int x,y, xl,yl, i;
  1846.     unsigned int xmax, ymax;
  1847.     char label[MAX_ID_LEN];
  1848.     int scaling;
  1849.  
  1850.     if (!term_init) {
  1851.        (*t->init)();
  1852.        term_init = TRUE;
  1853.     }
  1854.     screen_ok = FALSE;
  1855.     scaling = (*t->scale)(xsize, ysize);
  1856.     xmax = (unsigned int)(t->xmax * (scaling ? 1 : xsize));
  1857.     ymax = (unsigned int)(t->ymax * (scaling ? 1 : ysize));
  1858.     (*t->graphics)();
  1859.     /* border linetype */
  1860.     (*t->linetype)(-2);
  1861.     (*t->move)(0,0);
  1862.     (*t->vector)(xmax-1,0);
  1863.     (*t->vector)(xmax-1,ymax-1);
  1864.     (*t->vector)(0,ymax-1);
  1865.     (*t->vector)(0,0);
  1866.     (void) (*t->justify_text)(LEFT);
  1867.     (*t->put_text)(t->h_char*5,ymax-t->v_char*3,"Terminal Test");
  1868.     /* axis linetype */
  1869.     (*t->linetype)(-1);
  1870.     (*t->move)(xmax/2,0);
  1871.     (*t->vector)(xmax/2,ymax-1);
  1872.     (*t->move)(0,ymax/2);
  1873.     (*t->vector)(xmax-1,ymax/2);
  1874.     /* test width and height of characters */
  1875.     (*t->linetype)(-2);
  1876.     (*t->move)(  xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1877.     (*t->vector)(xmax/2+t->h_char*10,ymax/2+t->v_char/2);
  1878.     (*t->vector)(xmax/2+t->h_char*10,ymax/2-t->v_char/2);
  1879.     (*t->vector)(xmax/2-t->h_char*10,ymax/2-t->v_char/2);
  1880.     (*t->vector)(xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1881.     (*t->put_text)(xmax/2-t->h_char*10,ymax/2,
  1882.         "12345678901234567890");
  1883.     /* test justification */
  1884.     (void) (*t->justify_text)(LEFT);
  1885.     (*t->put_text)(xmax/2,ymax/2+t->v_char*6,"left justified");
  1886.     str = "centre+d text";
  1887.     if ((*t->justify_text)(CENTRE))
  1888.         (*t->put_text)(xmax/2,
  1889.                 ymax/2+t->v_char*5,str);
  1890.     else
  1891.         (*t->put_text)(xmax/2-strlen(str)*t->h_char/2,
  1892.                 ymax/2+t->v_char*5,str);
  1893.     str = "right justified";
  1894.     if ((*t->justify_text)(RIGHT))
  1895.         (*t->put_text)(xmax/2,
  1896.                 ymax/2+t->v_char*4,str);
  1897.     else
  1898.         (*t->put_text)(xmax/2-strlen(str)*t->h_char,
  1899.                 ymax/2+t->v_char*4,str);
  1900.     /* test text angle */
  1901.     str = "rotated ce+ntred text";
  1902.     if ((*t->text_angle)(1)) {
  1903.         if ((*t->justify_text)(CENTRE))
  1904.             (*t->put_text)(t->v_char,
  1905.                 ymax/2,str);
  1906.         else
  1907.             (*t->put_text)(t->v_char,
  1908.                 ymax/2-strlen(str)*t->h_char/2,str);
  1909.     }
  1910.     else {
  1911.         (void) (*t->justify_text)(LEFT);
  1912.         (*t->put_text)(t->h_char*2,ymax/2-t->v_char*2,"Can't rotate text");
  1913.     }
  1914.     (void) (*t->justify_text)(LEFT);
  1915.     (void) (*t->text_angle)(0);
  1916.     /* test tic size */
  1917.     (*t->move)(xmax/2+t->h_tic*2,0);
  1918.     (*t->vector)(xmax/2+t->h_tic*2,t->v_tic);
  1919.     (*t->move)(xmax/2,t->v_tic*2);
  1920.     (*t->vector)(xmax/2+t->h_tic,t->v_tic*2);
  1921.     (*t->put_text)(xmax/2+t->h_tic*2,t->v_tic*2+t->v_char/2,"test tics");
  1922.     /* test line and point types */
  1923.     x = xmax - t->h_char*4 - t->h_tic*4;
  1924.     y = ymax - t->v_char;
  1925.     for ( i = -2; y > t->v_char; i++ ) {
  1926.         (*t->linetype)(i);
  1927.         /*    (void) sprintf(label,"%d",i);  Jorgen Lippert
  1928.         lippert@risoe.dk */
  1929.         (void) sprintf(label,"%d",i+1);
  1930.         if ((*t->justify_text)(RIGHT))
  1931.             (*t->put_text)(x,y,label);
  1932.         else
  1933.             (*t->put_text)(x-strlen(label)*t->h_char,y,label);
  1934.         (*t->move)(x+t->h_char,y);
  1935.         (*t->vector)(x+t->h_char*4,y);
  1936.         if ( i >= -1 )
  1937.             (*t->point)(x+t->h_char*4+t->h_tic*2,y,i);
  1938.         y -= t->v_char;
  1939.     }
  1940.     /* test some arrows */
  1941.     (*t->linetype)(0);
  1942.     x = xmax/4;
  1943.     y = ymax/4;
  1944.     xl = t->h_tic*5;
  1945.     yl = t->v_tic*5;
  1946.     (*t->arrow)(x,y,x+xl,y,TRUE);
  1947.     (*t->arrow)(x,y,x+xl/2,y+yl,TRUE);
  1948.     (*t->arrow)(x,y,x,y+yl,TRUE);
  1949.     (*t->arrow)(x,y,x-xl/2,y+yl,FALSE);
  1950.     (*t->arrow)(x,y,x-xl,y,TRUE);
  1951.     (*t->arrow)(x,y,x-xl,y-yl,TRUE);
  1952.     (*t->arrow)(x,y,x,y-yl,TRUE);
  1953.     (*t->arrow)(x,y,x+xl,y-yl,TRUE);
  1954.     /* and back into text mode */
  1955.     (*t->text)();
  1956. }
  1957.  
  1958.  
  1959. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  1960. /* output for some terminal types must be binary to stop non Unix computers
  1961.    changing \n to \r\n. 
  1962.    If the output is not STDOUT, the following code reopens outfile 
  1963.    with binary mode. */
  1964. void
  1965. reopen_binary()
  1966. {
  1967. char filename[MAX_ID_LEN+1];
  1968.  
  1969.     if (outfile!=stdout) {
  1970.         (void) fclose(outfile);
  1971.         (void) strcpy(filename,outstr+1);    /* remove quotes */
  1972.         filename[strlen(filename)-1] = '\0';
  1973. #ifdef _Windows
  1974.         if ( !stricmp(outstr,"'PRN'") )
  1975.             (void) strcpy(filename,win_prntmp);    /* use temp file for windows */
  1976. #endif
  1977.         if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
  1978.             if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  1979.                 os_error("cannot reopen file with binary type; output unknown",
  1980.                     NO_CARET);
  1981.             } 
  1982.             else {
  1983.     os_error("cannot reopen file with binary type; output reset to ascii", 
  1984.                     NO_CARET);
  1985.             }
  1986.         }
  1987. #if defined(__TURBOC__) && defined(MSDOS)
  1988. #ifndef _Windows
  1989.         if ( !stricmp(outstr,"'PRN'") )
  1990.         {
  1991.         /* Put the printer into binary mode. */
  1992.         union REGS regs;
  1993.             regs.h.ah = 0x44;    /* ioctl */
  1994.             regs.h.al = 0;        /* get device info */
  1995.             regs.x.bx = fileno(outfile);
  1996.             intdos(®s, ®s);
  1997.             regs.h.dl |= 0x20;    /* binary (no ^Z intervention) */
  1998.             regs.h.dh = 0;
  1999.             regs.h.ah = 0x44;    /* ioctl */
  2000.             regs.h.al = 1;        /* set device info */
  2001.             intdos(®s, ®s);
  2002.         }
  2003. #endif
  2004. #endif
  2005.     }
  2006. }
  2007. #endif
  2008.  
  2009. #ifdef vms
  2010. /* these are needed to modify terminal characteristics */
  2011. #include <descrip.h>
  2012. #include <iodef.h>
  2013. #include <ttdef.h>
  2014. #include <tt2def.h>
  2015. #include <dcdef.h>
  2016. #include <ssdef.h>
  2017. #include <stat.h>
  2018. #include <fab.h>
  2019. static unsigned short   chan;
  2020. static int  old_char_buf[3], cur_char_buf[3];
  2021. $DESCRIPTOR(sysoutput_desc,"SYS$OUTPUT");
  2022.  
  2023. char *vms_init()
  2024. /*
  2025.  * Determine if we have a regis terminal
  2026.  * and save terminal characteristics
  2027. */
  2028. {
  2029.    /* Save terminal characteristics in old_char_buf and
  2030.    initialise cur_char_buf to current settings. */
  2031.    int i;
  2032.    sys$assign(&sysoutput_desc,&chan,0,0);
  2033.    sys$qiow(0,chan,IO$_SENSEMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2034.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2035.    sys$dassgn(chan);
  2036.  
  2037.    /* Test if terminal is regis */
  2038.    if ((cur_char_buf[2] & TT2$M_REGIS) == TT2$M_REGIS) return("regis");
  2039.    return(NULL);
  2040. }
  2041.  
  2042. void
  2043. vms_reset()
  2044. /* set terminal to original state */
  2045. {
  2046.    int i;
  2047.    sys$assign(&sysoutput_desc,&chan,0,0);
  2048.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2049.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2050.    sys$dassgn(chan);
  2051. }
  2052.  
  2053. void
  2054. term_mode_tek()
  2055. /* set terminal mode to tektronix */
  2056. {
  2057.    long status;
  2058.    if (outfile != stdout) return; /* don't modify if not stdout */
  2059.    sys$assign(&sysoutput_desc,&chan,0,0);
  2060.    cur_char_buf[0] = 0x004A0000 | DC$_TERM | (TT$_TEK401X<<8);
  2061.    cur_char_buf[1] = (cur_char_buf[1] & 0x00FFFFFF) | 0x18000000;
  2062.  
  2063.    cur_char_buf[1] &= ~TT$M_CRFILL;
  2064.    cur_char_buf[1] &= ~TT$M_ESCAPE;
  2065.    cur_char_buf[1] &= ~TT$M_HALFDUP;
  2066.    cur_char_buf[1] &= ~TT$M_LFFILL;
  2067.    cur_char_buf[1] &= ~TT$M_MECHFORM;
  2068.    cur_char_buf[1] &= ~TT$M_NOBRDCST;
  2069.    cur_char_buf[1] &= ~TT$M_NOECHO;
  2070.    cur_char_buf[1] &= ~TT$M_READSYNC;
  2071.    cur_char_buf[1] &= ~TT$M_REMOTE;
  2072.    cur_char_buf[1] |= TT$M_LOWER;
  2073.    cur_char_buf[1] |= TT$M_TTSYNC;
  2074.    cur_char_buf[1] |= TT$M_WRAP;
  2075.    cur_char_buf[1] &= ~TT$M_EIGHTBIT;
  2076.    cur_char_buf[1] &= ~TT$M_MECHTAB;
  2077.    cur_char_buf[1] &= ~TT$M_SCOPE;
  2078.    cur_char_buf[1] |= TT$M_HOSTSYNC;
  2079.  
  2080.    cur_char_buf[2] &= ~TT2$M_APP_KEYPAD;
  2081.    cur_char_buf[2] &= ~TT2$M_BLOCK;
  2082.    cur_char_buf[2] &= ~TT2$M_DECCRT3;
  2083.    cur_char_buf[2] &= ~TT2$M_LOCALECHO;
  2084.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2085.    cur_char_buf[2] &= ~TT2$M_REGIS;
  2086.    cur_char_buf[2] &= ~TT2$M_SIXEL;
  2087.    cur_char_buf[2] |= TT2$M_BRDCSTMBX;
  2088.    cur_char_buf[2] |= TT2$M_EDITING;
  2089.    cur_char_buf[2] |= TT2$M_INSERT;
  2090.    cur_char_buf[2] |= TT2$M_PRINTER;
  2091.    cur_char_buf[2] &= ~TT2$M_ANSICRT;
  2092.    cur_char_buf[2] &= ~TT2$M_AVO;
  2093.    cur_char_buf[2] &= ~TT2$M_DECCRT;
  2094.    cur_char_buf[2] &= ~TT2$M_DECCRT2;
  2095.    cur_char_buf[2] &= ~TT2$M_DRCS;
  2096.    cur_char_buf[2] &= ~TT2$M_EDIT;
  2097.    cur_char_buf[2] |= TT2$M_FALLBACK;
  2098.  
  2099.    status = sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2100.    if (status == SS$_BADPARAM) {
  2101.       /* terminal fallback utility not installed on system */
  2102.       cur_char_buf[2] &= ~TT2$M_FALLBACK;
  2103.       sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2104.    }
  2105.    else {
  2106.       if (status != SS$_NORMAL)
  2107.          lib$signal(status,0,0);
  2108.    }
  2109.    sys$dassgn(chan);
  2110. }
  2111.  
  2112. void
  2113. term_mode_native()
  2114. /* set terminal mode back to native */
  2115. {
  2116.    int i;
  2117.    if (outfile != stdout) return; /* don't modify if not stdout */
  2118.    sys$assign(&sysoutput_desc,&chan,0,0);
  2119.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2120.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2121.    sys$dassgn(chan);
  2122. }
  2123.  
  2124. void
  2125. term_pasthru()
  2126. /* set terminal mode pasthru */
  2127. {
  2128.    if (outfile != stdout) return; /* don't modify if not stdout */
  2129.    sys$assign(&sysoutput_desc,&chan,0,0);
  2130.    cur_char_buf[2] |= TT2$M_PASTHRU;
  2131.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2132.    sys$dassgn(chan);
  2133. }
  2134.  
  2135. void
  2136. term_nopasthru()
  2137. /* set terminal mode nopasthru */
  2138. {
  2139.    if (outfile != stdout) return; /* don't modify if not stdout */
  2140.    sys$assign(&sysoutput_desc,&chan,0,0);
  2141.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2142.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2143.    sys$dassgn(chan);
  2144. }
  2145.  
  2146. void
  2147. reopen_binary()
  2148. /* close the file outfile outfile and reopen it with binary type
  2149.    if not already done or outfile == stdout */
  2150. {
  2151.    stat_t stat_buf;
  2152.    char filename[MAX_ID_LEN+1];
  2153.    if (outfile != stdout) { /* don't modify if not stdout */
  2154.       if (!fstat(fileno(outfile),&stat_buf)) {
  2155.          if (stat_buf.st_fab_rfm != FAB$C_FIX) {
  2156.             /* modify only if not already done */
  2157.             (void) fclose(outfile);
  2158.             (void) strcpy(filename,outstr+1);   /* remove quotes */
  2159.             filename[strlen(filename)-1] = '\0';
  2160.             (void) delete(filename);
  2161.             if ((outfile = fopen(filename,"wb","rfm=fix","bls=512","mrs=512"))
  2162.                 == (FILE *)NULL ) {
  2163.                if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2164.                  os_error("cannot reopen file with binary type; output unknown",
  2165.                            NO_CARET);
  2166.                }
  2167.                else {
  2168.           os_error("cannot reopen file with binary type; output reset to ascii",
  2169.                            NO_CARET);
  2170.                }
  2171.             }
  2172.          }
  2173.       }
  2174.       else{
  2175.          os_error("cannot reopen file with binary type; output remains ascii",
  2176.                   NO_CARET);
  2177.       }
  2178.    }
  2179. }
  2180.  
  2181. void
  2182. fflush_binary()
  2183. {
  2184.    typedef short int INT16;     /* signed 16-bit integers */
  2185.    register INT16 k;            /* loop index */
  2186.    if (outfile != stdout) {
  2187.        /* Stupid VMS fflush() raises error and loses last data block
  2188.           unless it is full for a fixed-length record binary file.
  2189.           Pad it here with NULL characters. */
  2190.        for (k = (INT16)((*outfile)->_cnt); k > 0; --k)
  2191.           putc('\0',outfile);
  2192.        fflush(outfile);
  2193.    }
  2194. }
  2195. #endif
  2196.