home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Plotting / aa_Intel_Only / Gnuplot / GnuplotSource / term.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-12  |  67.2 KB  |  2,225 lines

  1. #ifndef lint
  2. static char *RCSid = "$Id: term.c,v 1.5 1993/05/18 03:55:54 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 2.1 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 /* NeXTSTEP 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 EPS180
  980.     ,{"epson_180dpi", "Epson LQ-style 180-dot per inch (24 pin) printers",
  981.        EPS180XMAX, EPS180YMAX, EPSON180VCHAR, EPSON180HCHAR,
  982.        EPSON180VTIC, EPSON180HTIC, options_null, EPSONinit, EPSONreset,
  983.        EPS180text, null_scale, EPS180graphics, EPSONmove, EPSONvector,
  984.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  985.        null_justify_text, do_point, do_arrow}
  986. #endif
  987.  
  988. #ifdef EPS60
  989.     ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
  990.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  991.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  992.        EPS60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  993.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  994.        null_justify_text, do_point, do_arrow}
  995. #endif
  996.  
  997. #ifdef EPSONP
  998.     ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
  999.        EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  1000.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset, 
  1001.        EPSONtext, null_scale, EPSONgraphics, EPSONmove, EPSONvector, 
  1002.        EPSONlinetype, EPSONput_text, EPSON_text_angle, 
  1003.        null_justify_text, line_and_point, do_arrow}
  1004. #endif
  1005.  
  1006. #ifdef EXCL
  1007.     ,{"excl", "Talaris EXCL Laser printer (also Talaris 1590 and others)",
  1008.        EXCL_XMAX,EXCL_YMAX, EXCL_VCHAR, EXCL_HCHAR, 
  1009.        EXCL_VTIC, EXCL_HTIC, options_null, EXCL_init,EXCL_reset, 
  1010.        EXCL_text, null_scale, EXCL_graphics, EXCL_move, EXCL_vector,
  1011.        EXCL_linetype,EXCL_put_text, null_text_angle, 
  1012.        null_justify_text, line_and_point, do_arrow}
  1013. #endif
  1014.  
  1015.  
  1016. #ifdef FIG
  1017.     ,{"fig", "FIG 2.1 graphics language: SunView or X graphics editor",
  1018.        FIG_XMAX, FIG_YMAX, FIG_VCHAR, FIG_HCHAR, 
  1019.        FIG_VTIC, FIG_HTIC, FIG_options, FIG_init, FIG_reset, 
  1020.        FIG_text, null_scale, FIG_graphics, FIG_move, FIG_vector, 
  1021.        FIG_linetype, FIG_put_text, FIG_text_angle, 
  1022.        FIG_justify_text, do_point, FIG_arrow}
  1023.     ,{"bfig", "FIG 2.1 graphics lang: SunView or X graphics editor. Large Graph",
  1024.        BFIG_XMAX, BFIG_YMAX, BFIG_VCHAR, BFIG_HCHAR, 
  1025.        BFIG_VTIC, BFIG_HTIC, FIG_options, FIG_init, FIG_reset, 
  1026.        FIG_text, null_scale, FIG_graphics, FIG_move, BFIG_vector, 
  1027.        FIG_linetype, BFIG_put_text, FIG_text_angle, 
  1028.        FIG_justify_text, do_point, BFIG_arrow}
  1029. #endif
  1030.  
  1031. #ifdef GPIC
  1032.     ,{"gpic", "GPIC -- Produce graphs in groff using the gpic preprocessor",
  1033.        GPIC_XMAX, GPIC_YMAX, GPIC_VCHAR, GPIC_HCHAR, 
  1034.        GPIC_VTIC, GPIC_HTIC, GPIC_options, GPIC_init, GPIC_reset, 
  1035.        GPIC_text, GPIC_scale, GPIC_graphics, GPIC_move, GPIC_vector, 
  1036.        GPIC_linetype, GPIC_put_text, GPIC_text_angle, 
  1037.        GPIC_justify_text, line_and_point, GPIC_arrow}
  1038. #endif
  1039.  
  1040. #ifdef GRASS
  1041.     ,{"grass", "GRASS Graphics Monitor",
  1042.            GRASS_XMAX, GRASS_YMAX, GRASS_VCHAR, GRASS_HCHAR,
  1043.            GRASS_VTIC, GRASS_HTIC, GRASS_options, GRASS_init, GRASS_reset,
  1044.            GRASS_text, null_scale, GRASS_graphics, GRASS_move, GRASS_vector,
  1045.            GRASS_linetype, GRASS_put_text, GRASS_text_angle,
  1046.            GRASS_justify_text, GRASS_point, GRASS_arrow}
  1047. #endif
  1048.  
  1049. #ifdef HP26
  1050.     ,{"hp2623A", "HP2623A and maybe others",
  1051.        HP26_XMAX, HP26_YMAX, HP26_VCHAR, HP26_HCHAR,
  1052.        HP26_VTIC, HP26_HTIC, options_null, HP26_init, HP26_reset,
  1053.        HP26_text, null_scale, HP26_graphics, HP26_move, HP26_vector,
  1054.        HP26_linetype, HP26_put_text, HP26_text_angle, 
  1055.        null_justify_text, HP26_line_and_point, do_arrow}
  1056. #endif
  1057.  
  1058. #ifdef HP2648
  1059.     ,{"hp2648", "HP2648 and HP2647",
  1060.        HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR, 
  1061.        HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset, 
  1062.        HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector, 
  1063.        HP2648linetype, HP2648put_text, HP2648_text_angle, 
  1064.        null_justify_text, line_and_point, do_arrow}
  1065. #endif
  1066.  
  1067. #ifdef HP75
  1068.     ,{"hp7580B", "HP7580, and probably other HPs (4 pens)",
  1069.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1070.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1071.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1072.        HP75_linetype, HPGL_put_text, HPGL_text_angle, 
  1073.        null_justify_text, do_point, do_arrow}
  1074. #endif
  1075.  
  1076. #ifdef HP500C
  1077.       ,{"hp500c", "HP DeskJet 500c, [75 100 150 300] [rle tiff]",
  1078.        HP500C_75PPI_XMAX, HP500C_75PPI_YMAX, HP500C_75PPI_VCHAR,
  1079.        HP500C_75PPI_HCHAR, HP500C_75PPI_VTIC, HP500C_75PPI_HTIC, HP500Coptions,
  1080.        HP500Cinit, HP500Creset, HP500Ctext, null_scale,
  1081.        HP500Cgraphics, HP500Cmove, HP500Cvector, HP500Clinetype,
  1082.        HP500Cput_text, HP500Ctext_angle, null_justify_text, do_point,
  1083.        do_arrow}
  1084. #endif
  1085.  
  1086. #ifdef HPGL
  1087.     ,{"hpgl", "HP7475 and (hopefully) lots of others (6 pens)",
  1088.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1089.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1090.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1091.        HPGL_linetype, HPGL_put_text, HPGL_text_angle, 
  1092.        null_justify_text, do_point, do_arrow}
  1093. #endif
  1094.  
  1095. #ifdef HPLJII
  1096.     ,{"hpljii", "HP Laserjet series II, [75 100 150 300]",
  1097.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1098.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1099.        HPLJIIinit, HPLJIIreset, HPLJIItext, null_scale,
  1100.        HPLJIIgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1101.        HPLJIIput_text, HPLJIItext_angle, null_justify_text, line_and_point,
  1102.        do_arrow}
  1103.     ,{"hpdj", "HP DeskJet 500, [75 100 150 300]",
  1104.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1105.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1106.        HPLJIIinit, HPLJIIreset, HPDJtext, null_scale,
  1107.        HPDJgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1108.        HPDJput_text, HPDJtext_angle, null_justify_text, line_and_point,
  1109.        do_arrow}
  1110. #endif
  1111.  
  1112. #ifdef HPPJ
  1113.     ,{"hppj", "HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]",
  1114.        HPPJ_XMAX, HPPJ_YMAX,
  1115.        HPPJ_9x17_VCHAR, HPPJ_9x17_HCHAR, HPPJ_9x17_VTIC, HPPJ_9x17_HTIC,
  1116.        HPPJoptions, HPPJinit, HPPJreset, HPPJtext, null_scale, HPPJgraphics,
  1117.        HPPJmove, HPPJvector, HPPJlinetype, HPPJput_text, HPPJtext_angle,
  1118.        null_justify_text, do_point, do_arrow}
  1119. #endif
  1120.  
  1121. #ifdef IMAGEN
  1122.     ,{"imagen", "Imagen laser printer",
  1123.        IMAGEN_XMAX, IMAGEN_YMAX, IMAGEN_VCHAR, IMAGEN_HCHAR, 
  1124.        IMAGEN_VTIC, IMAGEN_HTIC, options_null, IMAGEN_init, IMAGEN_reset, 
  1125.        IMAGEN_text, null_scale, IMAGEN_graphics, IMAGEN_move, 
  1126.        IMAGEN_vector, IMAGEN_linetype, IMAGEN_put_text, IMAGEN_text_angle,
  1127.        IMAGEN_justify_text, line_and_point, do_arrow}
  1128. #endif
  1129.  
  1130. #ifdef IRIS4D
  1131.     ,{"iris4d", "Silicon Graphics IRIS 4D Series Computer",
  1132.        IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR, 
  1133.        IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset, 
  1134.        IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
  1135.        IRIS4D_linetype, IRIS4D_put_text, null_text_angle, 
  1136.        null_justify_text, do_point, do_arrow}
  1137. #endif
  1138.  
  1139. #ifdef KERMIT
  1140.     ,{"kc_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - color",
  1141.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1142.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1143.        KTEK40Ctext, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1144.        KTEK40Clinetype, TEK40put_text, null_text_angle, 
  1145.        null_justify_text, do_point, do_arrow}
  1146.     ,{"km_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - monochrome",
  1147.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1148.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1149.        TEK40text, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1150.        KTEK40Mlinetype, TEK40put_text, null_text_angle, 
  1151.        null_justify_text, line_and_point, do_arrow}
  1152. #endif
  1153.  
  1154. #ifdef LATEX
  1155.     ,{"latex", "LaTeX picture environment",
  1156.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  1157.        LATEX_VTIC, LATEX_HTIC, LATEX_options, LATEX_init, LATEX_reset, 
  1158.        LATEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  1159.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  1160.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  1161. #endif
  1162.  
  1163. #ifdef LN03P
  1164.      ,{"ln03", "LN03-plus laser printer in tektronix (EGM) mode",
  1165.     LN03PXMAX, LN03PYMAX, LN03PVCHAR, LN03PHCHAR,
  1166.     LN03PVTIC, LN03PHTIC, options_null, LN03Pinit, LN03Preset,
  1167.     LN03Ptext, null_scale, TEK40graphics, LN03Pmove, LN03Pvector,
  1168.     LN03Plinetype, LN03Pput_text, null_text_angle,
  1169.     null_justify_text, line_and_point, do_arrow}
  1170. #endif
  1171.  
  1172. #ifdef MF
  1173.     ,{"mf", "Metafont plotting standard",
  1174.        MF_XMAX, MF_YMAX, MF_VCHAR, MF_HCHAR, 
  1175.        MF_VTIC, MF_HTIC, options_null, MF_init, MF_reset, 
  1176.        MF_text, MF_scale, MF_graphics, MF_move, MF_vector, 
  1177.        MF_linetype, MF_put_text, MF_text_angle, 
  1178.        MF_justify_text, line_and_point, MF_arrow}
  1179. #endif
  1180.  
  1181. #ifdef MIF
  1182.     ,{"mif", "Frame maker MIF 3.00 format",
  1183.        MIF_XMAX, MIF_YMAX, MIF_VCHAR, MIF_HCHAR, 
  1184.        MIF_VTIC, MIF_HTIC, MIF_options, MIF_init, MIF_reset, 
  1185.        MIF_text, null_scale, MIF_graphics, MIF_move, MIF_vector, 
  1186.        MIF_linetype, MIF_put_text, null_text_angle, 
  1187.        MIF_justify_text, line_and_point, do_arrow}
  1188. #endif
  1189.  
  1190. #ifdef NEC
  1191.     ,{"nec_cp6", "NEC printer CP6, Epson LQ-800 [monocrome color draft]",
  1192.        NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  1193.        NECVTIC, NECHTIC, NECoptions, NECinit, NECreset, 
  1194.        NECtext, null_scale, NECgraphics, NECmove, NECvector, 
  1195.        NEClinetype, NECput_text, NEC_text_angle, 
  1196.        null_justify_text, line_and_point, do_arrow}
  1197. #endif
  1198.  
  1199. #ifdef NEXT
  1200.     ,{"next", "NeXTstep window system",
  1201.        NEXT_XMAX, NEXT_YMAX, NEXT_VCHAR, NEXT_HCHAR, 
  1202.        NEXT_VTIC, NEXT_HTIC, NEXT_options, NEXT_init, NEXT_reset, 
  1203.        NEXT_text, do_scale, NEXT_graphics, NEXT_move, NEXT_vector, 
  1204.        NEXT_linetype, NEXT_put_text, NEXT_text_angle, 
  1205.        NEXT_justify_text, NEXT_point, do_arrow}
  1206. #endif /* The PostScript driver with NXImage displaying the PostScript on screen */
  1207.  
  1208. #ifdef NEXTFE
  1209.     ,{"_nextfe", "NeXTSTEP Front End (use in application only)",
  1210.            NEXTFE_XMAX, NEXTFE_YMAX, NEXTFE_VCHAR, NEXTFE_HCHAR, 
  1211.            NEXTFE_VTIC, NEXTFE_HTIC, NEXTFE_options, NEXTFE_init, NEXTFE_reset,
  1212.            NEXTFE_text, null_scale, NEXTFE_graphics, NEXTFE_move,NEXTFE_vector,
  1213.            NEXTFE_linetype, NEXTFE_put_text, NEXTFE_text_angle, 
  1214.            NEXTFE_justify_text, NEXTFE_point, do_arrow}
  1215. #endif
  1216.  
  1217. #ifdef OS2PM
  1218.     ,{"pm", "OS/2 Presentation Manager",
  1219.        PM_XMAX, PM_YMAX, PM_VCHAR, PM_HCHAR, 
  1220.        PM_VTIC, PM_HTIC, PM_args, PM_init, PM_reset, 
  1221.        PM_text, null_scale, PM_graphics, PM_move, PM_vector,
  1222.        PM_linetype, PM_put_text, PM_text_angle, 
  1223.        PM_justify_text, PM_point, do_arrow}
  1224. #endif
  1225.  
  1226. #ifdef PBM
  1227.     ,{"pbm", "Portable bitmap [small medium large] [monochrome gray color]",
  1228.        PBM_XMAX, PBM_YMAX, PBM_VCHAR,
  1229.        PBM_HCHAR, PBM_VTIC, PBM_HTIC, PBMoptions,
  1230.        PBMinit, PBMreset, PBMtext, null_scale,
  1231.        PBMgraphics, PBMmove, PBMvector, PBMlinetype,
  1232.        PBMput_text, PBMtext_angle, null_justify_text, PBMpoint,
  1233.        do_arrow}
  1234. #endif
  1235.  
  1236. #ifdef PCL
  1237.  ,{"pcl5", "HP LaserJet III [mode] [font] [point]",
  1238.    PCL_XMAX, PCL_YMAX, HPGL2_VCHAR, HPGL2_HCHAR,
  1239.    PCL_VTIC, PCL_HTIC, PCL_options, PCL_init, PCL_reset,
  1240.    PCL_text, null_scale, PCL_graphics, HPGL2_move, HPGL2_vector,
  1241.    HPGL2_linetype, HPGL2_put_text, HPGL2_text_angle,
  1242.    HPGL2_justify_text, do_point, do_arrow}
  1243. #endif
  1244.  
  1245. #ifdef POSTSCRIPT
  1246.     ,{"postscript", "PostScript graphics language [mode \042fontname\042 font_size]",
  1247.        PS_XMAX, PS_YMAX, PS_VCHAR, PS_HCHAR, 
  1248.        PS_VTIC, PS_HTIC, PS_options, PS_init, PS_reset, 
  1249.        PS_text, null_scale, PS_graphics, PS_move, PS_vector, 
  1250.        PS_linetype, PS_put_text, PS_text_angle, 
  1251.        PS_justify_text, PS_point, do_arrow}
  1252. #endif
  1253.  
  1254. #ifdef PRESCRIBE
  1255.     ,{"prescribe", "Prescribe - for the Kyocera Laser Printer",
  1256.     PRE_XMAX, PRE_YMAX, PRE_VCHAR, PRE_HCHAR, 
  1257.     PRE_VTIC, PRE_HTIC, options_null, PRE_init, PRE_reset, 
  1258.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1259.     PRE_linetype, PRE_put_text, null_text_angle, 
  1260.     PRE_justify_text, line_and_point, do_arrow}
  1261.     ,{"kyo", "Kyocera Laser Printer with Courier font",
  1262.     PRE_XMAX, PRE_YMAX, KYO_VCHAR, KYO_HCHAR, 
  1263.     PRE_VTIC, PRE_HTIC, options_null, KYO_init, PRE_reset, 
  1264.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1265.     PRE_linetype, PRE_put_text, null_text_angle, 
  1266.     PRE_justify_text, line_and_point, do_arrow}
  1267. #endif /* PRESCRIBE */
  1268.  
  1269. #ifdef PSLATEX
  1270.     ,{"pslatex", "LaTeX picture environment with PostScript \\specials",
  1271.     PS_XMAX, PS_YMAX, PSLATEX_VCHAR, PSLATEX_HCHAR,
  1272.     PS_VTIC, PS_HTIC, PSLATEX_options, PSLATEX_init, PSLATEX_reset,
  1273.     PSLATEX_text, PSLATEX_scale, PSLATEX_graphics, PS_move, PS_vector,
  1274.     PS_linetype, PSLATEX_put_text, PSLATEX_text_angle,
  1275.     PSLATEX_justify_text, PS_point, do_arrow}
  1276. #endif
  1277.  
  1278. #ifdef    PSTRICKS
  1279.     ,{"pstricks", "LaTeX picture environment with PSTricks macros",
  1280.        PSTRICKS_XMAX, PSTRICKS_YMAX, PSTRICKS_VCHAR, PSTRICKS_HCHAR, 
  1281.        PSTRICKS_VTIC, PSTRICKS_HTIC, options_null, PSTRICKS_init, PSTRICKS_reset, 
  1282.        PSTRICKS_text, PSTRICKS_scale, PSTRICKS_graphics, PSTRICKS_move, PSTRICKS_vector, 
  1283.        PSTRICKS_linetype, PSTRICKS_put_text, PSTRICKS_text_angle, 
  1284.        PSTRICKS_justify_text, PSTRICKS_point, PSTRICKS_arrow}
  1285. #endif
  1286.     
  1287. #ifdef QMS
  1288.     ,{"qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
  1289.        QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR, 
  1290.        QMS_VTIC, QMS_HTIC, options_null, QMS_init,QMS_reset, 
  1291.        QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
  1292.        QMS_linetype,QMS_put_text, null_text_angle, 
  1293.        null_justify_text, line_and_point, do_arrow}
  1294. #endif
  1295.  
  1296. #ifdef REGIS
  1297.     ,{"regis", "REGIS graphics language",
  1298.        REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR, 
  1299.        REGISVTIC, REGISHTIC, REGISoptions, REGISinit, REGISreset, 
  1300.        REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
  1301.        REGISlinetype, REGISput_text, REGIStext_angle, 
  1302.        null_justify_text, line_and_point, do_arrow}
  1303. #endif
  1304.  
  1305. #ifdef RGIP
  1306.     ,{"rgip", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1307.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1308.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1309.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1310.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1311.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1312.     ,{"uniplex", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1313.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1314.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1315.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1316.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1317.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1318. #endif
  1319.  
  1320. #ifdef SELANAR
  1321.     ,{"selanar", "Selanar",
  1322.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1323.        TEK40VTIC, TEK40HTIC, options_null, SEL_init, SEL_reset, 
  1324.        SEL_text, null_scale, SEL_graphics, TEK40move, TEK40vector, 
  1325.        TEK40linetype, TEK40put_text, null_text_angle, 
  1326.        null_justify_text, line_and_point, do_arrow}
  1327. #endif
  1328.  
  1329. #ifdef STARC
  1330.     ,{"starc", "Star Color Printer",
  1331.        STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR, 
  1332.        STARCVTIC, STARCHTIC, options_null, STARCinit, STARCreset, 
  1333.        STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector, 
  1334.        STARClinetype, STARCput_text, STARC_text_angle, 
  1335.        null_justify_text, line_and_point, do_arrow}
  1336. #endif
  1337.  
  1338. #ifdef SUN
  1339.     ,{"sun", "SunView window system",
  1340.        SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR, 
  1341.        SUN_VTIC, SUN_HTIC, options_null, SUN_init, SUN_reset, 
  1342.        SUN_text, null_scale, SUN_graphics, SUN_move, SUN_vector,
  1343.        SUN_linetype, SUN_put_text, null_text_angle, 
  1344.        SUN_justify_text, line_and_point, do_arrow}
  1345. #endif
  1346.  
  1347. #ifdef VWS
  1348.     ,{"VWS", "VAX Windowing System (UIS)",
  1349.            VWS_XMAX, VWS_YMAX, VWS_VCHAR, VWS_HCHAR,
  1350.            VWS_VTIC, VWS_HTIC, options_null, VWS_init, VWS_reset,
  1351.            VWS_text, null_scale, VWS_graphics, VWS_move, VWS_vector,
  1352.            VWS_linetype, VWS_put_text, VWS_text_angle,
  1353.            VWS_justify_text, do_point, do_arrow}
  1354. #endif
  1355.  
  1356. #ifdef TANDY60
  1357.     ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
  1358.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1359.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1360.        TANDY60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1361.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1362.        null_justify_text, do_point, do_arrow}
  1363. #endif
  1364.  
  1365. #ifdef T410X
  1366.     ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
  1367.        T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR, 
  1368.        T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset, 
  1369.        T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector, 
  1370.        T410X_linetype, T410X_put_text, T410X_text_angle, 
  1371.        null_justify_text, T410X_point, do_arrow}
  1372. #endif
  1373.  
  1374. #ifdef TEK
  1375.     ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
  1376.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1377.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, TEK40reset, 
  1378.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector, 
  1379.        TEK40linetype, TEK40put_text, null_text_angle, 
  1380.        null_justify_text, line_and_point, do_arrow}
  1381. #endif
  1382.  
  1383. #ifdef TEXDRAW
  1384.     ,{"texdraw", "LaTeX texdraw environment",
  1385.        TEXDRAW_XMAX, TEXDRAW_YMAX, TEXDRAW_VCHAR, TEXDRAW_HCHAR,
  1386.     TEXDRAW_VTIC, TEXDRAW_HTIC, options_null, TEXDRAW_init, TEXDRAW_reset,
  1387.     TEXDRAW_text, TEXDRAW_scale, TEXDRAW_graphics, TEXDRAW_move, TEXDRAW_vector,
  1388.     TEXDRAW_linetype, TEXDRAW_put_text, TEXDRAW_text_angle,
  1389.     TEXDRAW_justify_text, TEXDRAW_point, TEXDRAW_arrow}
  1390. #endif
  1391.   
  1392. #ifdef TGIF
  1393.     ,{"tgif", "TGIF X-Window draw tool (file version 10)",
  1394.        TGIF_XMAX, TGIF_YMAX, TGIF_VCHAR1, TGIF_HCHAR1, 
  1395.        TGIF_VTIC, TGIF_HTIC, options_null, TGIF_init, TGIF_reset, 
  1396.        TGIF_text, null_scale, TGIF_graphics, TGIF_move, TGIF_vector, 
  1397.        TGIF_linetype, TGIF_put_text, TGIF_text_angle, 
  1398.        TGIF_justify_text, line_and_point, TGIF_arrow}
  1399. #endif
  1400.  
  1401. #ifdef TPIC
  1402.     ,{"tpic", "TPIC -- LaTeX picture environment with tpic \\specials",
  1403.        TPIC_XMAX, TPIC_YMAX, TPIC_VCHAR, TPIC_HCHAR, 
  1404.        TPIC_VTIC, TPIC_HTIC, TPIC_options, TPIC_init, TPIC_reset, 
  1405.        TPIC_text, TPIC_scale, TPIC_graphics, TPIC_move, TPIC_vector, 
  1406.        TPIC_linetype, TPIC_put_text, TPIC_text_angle, 
  1407.        TPIC_justify_text, TPIC_point, TPIC_arrow}
  1408. #endif
  1409.  
  1410. #ifdef UNIXPLOT
  1411. #ifdef GNUGRAPH
  1412.     ,{"unixplot", "GNU plot(1) format [\042fontname\042 font_size]",
  1413.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR,
  1414.        UP_VTIC, UP_HTIC, UP_options, UP_init, UP_reset,
  1415.        UP_text, null_scale, UP_graphics, UP_move, UP_vector,
  1416.        UP_linetype, UP_put_text, UP_text_angle,
  1417.        UP_justify_text, line_and_point, do_arrow}
  1418. #else
  1419.     ,{"unixplot", "Unix plotting standard (see plot(1))",
  1420.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, 
  1421.        UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset, 
  1422.        UP_text, null_scale, UP_graphics, UP_move, UP_vector, 
  1423.        UP_linetype, UP_put_text, null_text_angle, 
  1424.        null_justify_text, line_and_point, do_arrow}
  1425. #endif /* GNUGRAPH */
  1426. #endif
  1427.     
  1428. #ifdef UNIXPC
  1429.     ,{"unixpc", "AT&T 3b1 or AT&T 7300 Unix PC",
  1430.        uPC_XMAX, uPC_YMAX, uPC_VCHAR, uPC_HCHAR, 
  1431.        uPC_VTIC, uPC_HTIC, options_null, uPC_init, uPC_reset, 
  1432.        uPC_text, null_scale, uPC_graphics, uPC_move, uPC_vector,
  1433.        uPC_linetype, uPC_put_text, uPC_text_angle, 
  1434.        null_justify_text, line_and_point, do_arrow}
  1435. #endif
  1436.  
  1437. #ifdef EMXVGA
  1438. #ifdef EMXVESA
  1439.     ,{"vesa", "IBM PC/Clone with VESA SVGA graphics board [vesa mode]",
  1440.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1441.        EMXVGA_VTIC, EMXVGA_HTIC, EMXVESA_options, EMXVESA_init, EMXVESA_reset,
  1442.        EMXVESA_text, null_scale, EMXVESA_graphics, EMXVGA_move, EMXVGA_vector,
  1443.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1444.        null_justify_text, do_point, do_arrow}
  1445. #endif
  1446.     ,{"vgal", "IBM PC/Clone with VGA graphics board",
  1447.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1448.        EMXVGA_VTIC, EMXVGA_HTIC, options_null, EMXVGA_init, EMXVGA_reset,
  1449.        EMXVGA_text, null_scale, EMXVGA_graphics, EMXVGA_move, EMXVGA_vector,
  1450.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1451.        null_justify_text, do_point, do_arrow}
  1452. #endif
  1453.  
  1454. #ifdef V384
  1455.     ,{"vx384", "Vectrix 384 and Tandy color printer",
  1456.        V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR, 
  1457.        V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset, 
  1458.        V384_text, null_scale, V384_graphics, V384_move, V384_vector, 
  1459.        V384_linetype, V384_put_text, null_text_angle, 
  1460.        null_justify_text, do_point, do_arrow}
  1461. #endif
  1462.  
  1463. #ifdef VTTEK
  1464.     ,{"vttek", "VT-like tek40xx terminal emulator",
  1465.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, TEK40HCHAR,
  1466.        TEK40VTIC, TEK40HTIC, options_null, VTTEK40init, VTTEK40reset,
  1467.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
  1468.        VTTEK40linetype, VTTEK40put_text, null_text_angle,
  1469.        null_justify_text, line_and_point, do_arrow}
  1470. #endif
  1471.  
  1472. #ifdef _Windows
  1473.     ,{"windows", "Microsoft Windows",
  1474.        WIN_XMAX, WIN_YMAX, WIN_VCHAR, WIN_HCHAR, 
  1475.        WIN_VTIC, WIN_HTIC, WIN_options, WIN_init, WIN_reset, 
  1476.        WIN_text, WIN_scale, WIN_graphics, WIN_move, WIN_vector,
  1477.        WIN_linetype, WIN_put_text, WIN_text_angle, 
  1478.        WIN_justify_text, WIN_point, do_arrow}
  1479. #endif
  1480.  
  1481. #ifdef X11
  1482.     ,{"x11", "X11 Window System",
  1483.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1484.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1485.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1486.        X11_linetype, X11_put_text, null_text_angle, 
  1487.        X11_justify_text, X11_point, do_arrow}
  1488.     ,{"X11", "X11 Window System (identical to x11)",
  1489.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1490.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1491.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1492.        X11_linetype, X11_put_text, null_text_angle, 
  1493.        X11_justify_text, X11_point, do_arrow}
  1494.    ,{"xlib", "X11 Window System (gnulib_x11 dump)",
  1495.        Xlib_XMAX, Xlib_YMAX, Xlib_VCHAR, Xlib_HCHAR, 
  1496.        Xlib_VTIC, Xlib_HTIC, options_null, Xlib_init, Xlib_reset, 
  1497.        Xlib_text, null_scale, Xlib_graphics, Xlib_move, Xlib_vector, 
  1498.        Xlib_linetype, Xlib_put_text, null_text_angle, 
  1499.        Xlib_justify_text, line_and_point, do_arrow}
  1500. #endif
  1501. };
  1502.  
  1503. #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
  1504.  
  1505.  
  1506. list_terms()
  1507. {
  1508. register int i;
  1509.  
  1510.     fprintf(stderr,"\nAvailable terminal types:\n");
  1511.     for (i = 0; i < TERMCOUNT; i++)
  1512.         fprintf(stderr,"  %15s  %s\n",
  1513.                term_tbl[i].name, term_tbl[i].description);
  1514.     (void) putc('\n',stderr);
  1515. }
  1516.  
  1517.  
  1518. /* set_term: get terminal number from name on command line */
  1519. /* will change 'term' variable if successful */
  1520. int                        /* term number */
  1521. set_term(c_token)
  1522. int c_token;
  1523. {
  1524.     register int t;
  1525.     char *input_name;
  1526.  
  1527.     if (!token[c_token].is_token)
  1528.      int_error("terminal name expected",c_token);
  1529.     t = -1;
  1530.     input_name = input_line + token[c_token].start_index;
  1531.     t = change_term(input_name, token[c_token].length);
  1532.     if (t == -1)
  1533.      int_error("unknown terminal type; type just 'set terminal' for a list",
  1534.              c_token);
  1535.     if (t == -2)
  1536.      int_error("ambiguous terminal name; type just 'set terminal' for a list",
  1537.              c_token);
  1538.  
  1539.     /* otherwise the type was changed */
  1540.  
  1541.     return(t);
  1542. }
  1543.  
  1544. /* change_term: get terminal number from name and set terminal type */
  1545. /* returns -1 if unknown, -2 if ambiguous, >=0 is terminal number */
  1546. int
  1547. change_term(name, length)
  1548.     char *name;
  1549.     int length;
  1550. {
  1551.     int i, t = -1;
  1552.  
  1553.     for (i = 0; i < TERMCOUNT; i++) {
  1554.        if (!strncmp(name,term_tbl[i].name,length)) {
  1555.           if (t != -1)
  1556.             return(-2);    /* ambiguous */
  1557.           t = i;
  1558.        }
  1559.     }
  1560.  
  1561.     if (t == -1)            /* unknown */
  1562.      return(t);
  1563.  
  1564.     /* Success: set terminal type now */
  1565.  
  1566.     term = t;
  1567.     term_init = FALSE;
  1568.     name = term_tbl[term].name;
  1569.  
  1570.     /* Special handling for unixplot term type */
  1571.     if (!strncmp("unixplot",name,8)) {
  1572.        UP_redirect (2);  /* Redirect actual stdout for unixplots */
  1573.     } else if (unixplot) {
  1574.        UP_redirect (3);  /* Put stdout back together again. */
  1575.     }
  1576.  
  1577.     if (interactive)
  1578.      fprintf(stderr, "Terminal type set to '%s'\n", name);
  1579.  
  1580.     return(t);
  1581. }
  1582.  
  1583. /*
  1584.    Routine to detect what terminal is being used (or do anything else
  1585.    that would be nice).  One anticipated (or allowed for) side effect
  1586.    is that the global ``term'' may be set. 
  1587.    The environment variable GNUTERM is checked first; if that does
  1588.    not exist, then the terminal hardware is checked, if possible, 
  1589.    and finally, we can check $TERM for some kinds of terminals.
  1590.    A default can be set with -DDEFAULTTERM=myterm in the Makefile
  1591.    or #define DEFAULTTERM myterm in term.h
  1592. */
  1593. /* thanks to osupyr!alden (Dave Alden) for the original GNUTERM code */
  1594. init_terminal()
  1595. {
  1596.     int t;
  1597. #ifdef DEFAULTTERM
  1598.     char *term_name = DEFAULTTERM;
  1599. #else
  1600.     char *term_name = NULL;
  1601. #endif /* DEFAULTTERM */
  1602. #if (defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)) || defined(NEXT) || defined(SUN) || defined(X11)
  1603.     char *term = NULL;        /* from TERM environment var */
  1604. #endif
  1605. #ifdef X11
  1606.     char *display = NULL;
  1607. #endif
  1608.     char *gnuterm = NULL;
  1609.  
  1610.     /* GNUTERM environment variable is primary */
  1611.     gnuterm = getenv("GNUTERM");
  1612.     if (gnuterm != (char *)NULL) {
  1613.      term_name = gnuterm;
  1614. #ifndef _Windows
  1615. #if defined(__TURBOC__) && defined(MSDOS)
  1616.          get_path();   /* So *_init() can find the BGI driver */
  1617. # endif
  1618. #endif
  1619.     }
  1620.     else {
  1621. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  1622.        term_name = turboc_init();
  1623.        term = (char *)NULL; /* shut up turbo C */
  1624. #endif
  1625.        
  1626. #ifdef __ZTC__
  1627.       term_name = ztc_init();
  1628. #endif
  1629.  
  1630. #ifdef vms
  1631.        term_name = vms_init();
  1632. #endif
  1633.  
  1634. #ifdef NEXT
  1635.     term = getenv("TERM");
  1636.     if (term_name == (char *)NULL
  1637.         && term != (char *)NULL && strcmp(term,"next") == 0)
  1638.           term_name = "next";
  1639. #endif /* NeXT */
  1640.        
  1641. #ifdef SUN
  1642.        term = getenv("TERM");    /* try $TERM */
  1643.        if (term_name == (char *)NULL
  1644.           && term != (char *)NULL && strcmp(term, "sun") == 0)
  1645.         term_name = "sun";
  1646. #endif /* sun */
  1647.  
  1648. #ifdef _Windows
  1649.         term_name = "win";
  1650. #endif /* _Windows */
  1651.  
  1652. #ifdef GPR
  1653.    if (gpr_isa_pad()) term_name = "gpr";       /* find out whether stdout is a DM pad. See term/gpr.trm */
  1654. #else
  1655. #ifdef APOLLO
  1656.    if (apollo_isa_pad()) term_name = "apollo"; /* find out whether stdout is a DM pad. See term/apollo.trm */
  1657. #endif /* APOLLO */
  1658. #endif /* GPR    */
  1659.  
  1660. #ifdef X11
  1661.        term = getenv("TERM");    /* try $TERM */
  1662.        if (term_name == (char *)NULL
  1663.           && term != (char *)NULL && strcmp(term, "xterm") == 0)
  1664.         term_name = "x11";
  1665.        display = getenv("DISPLAY");
  1666.        if (term_name == (char *)NULL && display != (char *)NULL)
  1667.         term_name = "x11";
  1668.        if (X11_Display)
  1669.         term_name = "x11";
  1670. #endif /* x11 */
  1671.  
  1672. #ifdef AMIGASCREEN
  1673.        term_name = "amiga";
  1674. #endif
  1675.  
  1676. #ifdef ATARI
  1677.        term_name = "atari";
  1678. #endif
  1679.  
  1680. #ifdef UNIXPC
  1681.            if (iswind() == 0) {
  1682.               term_name = "unixpc";
  1683.            }
  1684. #endif /* unixpc */
  1685.  
  1686. #ifdef CGI
  1687.        if (getenv("CGIDISP") || getenv("CGIPRNT"))
  1688.          term_name = "cgi";
  1689. #endif /*CGI */
  1690.  
  1691. #if defined(MSDOS) && defined(__EMX__)
  1692. #ifdef EMXVESA
  1693.        term_name = "vesa";
  1694. #else
  1695.        term_name = "vgal";
  1696. #endif
  1697. #endif
  1698.  
  1699. #ifdef DJGPP
  1700.         term_name = "svga";
  1701. #endif
  1702.  
  1703. #ifdef GRASS
  1704.         term_name = "grass";
  1705. #endif
  1706.  
  1707. #ifdef OS2
  1708.            term_name = "pm" ;
  1709.             /* EMX compiler has getcwd that can return drive */
  1710.            if( PM_path[0]=='\0' ) _getcwd2( PM_path, 256 ) ;
  1711. #endif /*OS2 */           
  1712.     }
  1713.  
  1714.     /* We have a name, try to set term type */
  1715.     if (term_name != NULL && *term_name != '\0') {
  1716.        t = change_term(term_name, (int)strlen(term_name));
  1717.        if (t == -1)
  1718.         fprintf(stderr, "Unknown terminal name '%s'\n", term_name);
  1719.        else if (t == -2)
  1720.         fprintf(stderr, "Ambiguous terminal name '%s'\n", term_name);
  1721.        else                /* successful */
  1722.         ;
  1723.     }
  1724. }
  1725.  
  1726.  
  1727. #ifndef _Windows
  1728. #if defined (__TURBOC__) && defined (MSDOS)
  1729. char *
  1730. turboc_init()
  1731. {
  1732.   int g_driver,g_mode;
  1733.   char far *c1,*c2;
  1734.   char *term_name = NULL;
  1735.   struct text_info tinfo;       /* So we can restore starting text mode. */
  1736.  
  1737. /* Some of this code including BGI drivers is copyright Borland Intl. */
  1738.     g_driver=DETECT;
  1739.           get_path();
  1740.     gettextinfo(&tinfo);
  1741.         initgraph(&g_driver,&g_mode,path);
  1742.         c1=getdrivername();
  1743.         c2=getmodename(g_mode);
  1744.           switch (g_driver){
  1745.             case -2: fprintf(stderr,"Graphics card not detected.\n");
  1746.                      break;
  1747.             case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
  1748.                      break;
  1749.             case -4: fprintf(stderr,"Invalid BGI driver file.\n");
  1750.                      break;
  1751.             case -5: fprintf(stderr,"Insufficient memory to load ",
  1752.                              "graphics driver.");
  1753.                      break;
  1754.             case 1 : term_name = "cga";
  1755.                      break;
  1756.             case 2 : term_name = "mcga";
  1757.                      break;
  1758.             case 3 : 
  1759.             case 4 : term_name = "egalib";
  1760.                      break;
  1761.             case 7 : term_name = "hercules";
  1762.                      break;
  1763.             case 8 : term_name = "att";
  1764.                      break;
  1765.             case 9 : term_name = "vgalib";
  1766.                      break;
  1767.             }
  1768.         closegraph();
  1769.         textmode(tinfo.currmode);
  1770.     clrscr();
  1771.     fprintf(stderr,"\tTC Graphics, driver %s  mode %s\n",c1,c2);
  1772.   return(term_name);
  1773. }
  1774. # endif /* __TURBOC__ */
  1775. #endif
  1776.  
  1777. #if defined(__ZTC__)
  1778. char *
  1779. ztc_init()
  1780. {
  1781.   int g_mode;
  1782.   char *term_name = NULL;
  1783.  
  1784.     g_mode = fg_init();
  1785.  
  1786.           switch (g_mode){
  1787.             case FG_NULL      :  fprintf(stderr,"Graphics card not detected or not supported.\n");
  1788.                                  exit(1);
  1789.             case FG_HERCFULL  :  term_name = "hercules";
  1790.                                  break;
  1791.             case FG_EGAMONO   :  term_name = "egamono";
  1792.                                  break;
  1793.             case FG_EGAECD      :  term_name = "egalib";
  1794.                                  break;
  1795.             case FG_VGA11      :  term_name = "vgamono";
  1796.                                  break;
  1797.             case FG_VGA12      :  term_name = "vgalib";
  1798.                                  break;
  1799.             case FG_VESA6A      :  term_name = "svgalib";
  1800.                                  break;
  1801.             case FG_VESA5      :  term_name = "ssvgalib";
  1802.                                  break;
  1803.             }
  1804.         fg_term();
  1805.   return(term_name);
  1806. }
  1807. #endif /* __ZTC__ */
  1808.  
  1809.  
  1810. /*
  1811.     This is always defined so we don't have to have command.c know if it
  1812.     is there or not.
  1813. */
  1814. #ifndef UNIXPLOT
  1815. UP_redirect(caller) int caller; 
  1816. {
  1817.     caller = caller;    /* to stop Turbo C complaining 
  1818.                          * about caller not being used */
  1819. }
  1820. #else
  1821. UP_redirect (caller)
  1822. int caller;
  1823. /*
  1824.     Unixplot can't really write to outfile--it wants to write to stdout.
  1825.     This is normally ok, but the original design of gnuplot gives us
  1826.     little choice.  Originally users of unixplot had to anticipate
  1827.     their needs and redirect all I/O to a file...  Not very gnuplot-like.
  1828.  
  1829.     caller:  1 - called from SET OUTPUT "FOO.OUT"
  1830.              2 - called from SET TERM UNIXPLOT
  1831.              3 - called from SET TERM other
  1832.              4 - called from SET OUTPUT
  1833. */
  1834. {
  1835.     switch (caller) {
  1836.     case 1:
  1837.     /* Don't save, just replace stdout w/outfile (save was already done). */
  1838.         if (unixplot)
  1839.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1840.     break;
  1841.     case 2:
  1842.         if (!unixplot) {
  1843.             fflush(stdout);
  1844.             save_stdout = *(stdout);
  1845.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1846.             unixplot = 1;
  1847.         }
  1848.     break;
  1849.     case 3:
  1850.     /* New terminal in use--put stdout back to original. */
  1851.         /* closepl(); */  /* This is called by the term. */
  1852.         fflush(stdout);
  1853.         *(stdout) = save_stdout;  /* Copy FILE structure */
  1854.         unixplot = 0;
  1855.     break;
  1856.     case 4:
  1857.     /*  User really wants to go to normal output... */
  1858.         if (unixplot) {
  1859.             fflush(stdout);
  1860.             *(stdout) = save_stdout;  /* Copy FILE structure */
  1861.         }
  1862.     break;
  1863.     }
  1864. }
  1865. #endif
  1866.  
  1867.  
  1868. /* test terminal by drawing border and text */
  1869. /* called from command test */
  1870. test_term()
  1871. {
  1872.     register struct termentry *t = &term_tbl[term];
  1873.     char *str;
  1874.     int x,y, xl,yl, i;
  1875.     unsigned int xmax, ymax;
  1876.     char label[MAX_ID_LEN];
  1877.     int scaling;
  1878.  
  1879.     if (!term_init) {
  1880.        (*t->init)();
  1881.        term_init = TRUE;
  1882.     }
  1883.     screen_ok = FALSE;
  1884.     scaling = (*t->scale)(xsize, ysize);
  1885.     xmax = (unsigned int)(t->xmax * (scaling ? 1 : xsize));
  1886.     ymax = (unsigned int)(t->ymax * (scaling ? 1 : ysize));
  1887.     (*t->graphics)();
  1888.     /* border linetype */
  1889.     (*t->linetype)(-2);
  1890.     (*t->move)(0,0);
  1891.     (*t->vector)(xmax-1,0);
  1892.     (*t->vector)(xmax-1,ymax-1);
  1893.     (*t->vector)(0,ymax-1);
  1894.     (*t->vector)(0,0);
  1895.     (void) (*t->justify_text)(LEFT);
  1896.     (*t->put_text)(t->h_char*5,ymax-t->v_char*3,"Terminal Test");
  1897.     /* axis linetype */
  1898.     (*t->linetype)(-1);
  1899.     (*t->move)(xmax/2,0);
  1900.     (*t->vector)(xmax/2,ymax-1);
  1901.     (*t->move)(0,ymax/2);
  1902.     (*t->vector)(xmax-1,ymax/2);
  1903.     /* test width and height of characters */
  1904.     (*t->linetype)(-2);
  1905.     (*t->move)(  xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1906.     (*t->vector)(xmax/2+t->h_char*10,ymax/2+t->v_char/2);
  1907.     (*t->vector)(xmax/2+t->h_char*10,ymax/2-t->v_char/2);
  1908.     (*t->vector)(xmax/2-t->h_char*10,ymax/2-t->v_char/2);
  1909.     (*t->vector)(xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1910.     (*t->put_text)(xmax/2-t->h_char*10,ymax/2,
  1911.         "12345678901234567890");
  1912.     /* test justification */
  1913.     (void) (*t->justify_text)(LEFT);
  1914.     (*t->put_text)(xmax/2,ymax/2+t->v_char*6,"left justified");
  1915.     str = "centre+d text";
  1916.     if ((*t->justify_text)(CENTRE))
  1917.         (*t->put_text)(xmax/2,
  1918.                 ymax/2+t->v_char*5,str);
  1919.     else
  1920.         (*t->put_text)(xmax/2-strlen(str)*t->h_char/2,
  1921.                 ymax/2+t->v_char*5,str);
  1922.     str = "right justified";
  1923.     if ((*t->justify_text)(RIGHT))
  1924.         (*t->put_text)(xmax/2,
  1925.                 ymax/2+t->v_char*4,str);
  1926.     else
  1927.         (*t->put_text)(xmax/2-strlen(str)*t->h_char,
  1928.                 ymax/2+t->v_char*4,str);
  1929.     /* test text angle */
  1930.     str = "rotated ce+ntred text";
  1931.     if ((*t->text_angle)(1)) {
  1932.         if ((*t->justify_text)(CENTRE))
  1933.             (*t->put_text)(t->v_char,
  1934.                 ymax/2,str);
  1935.         else
  1936.             (*t->put_text)(t->v_char,
  1937.                 ymax/2-strlen(str)*t->h_char/2,str);
  1938.     }
  1939.     else {
  1940.         (void) (*t->justify_text)(LEFT);
  1941.         (*t->put_text)(t->h_char*2,ymax/2-t->v_char*2,"Can't rotate text");
  1942.     }
  1943.     (void) (*t->justify_text)(LEFT);
  1944.     (void) (*t->text_angle)(0);
  1945.     /* test tic size */
  1946.     (*t->move)(xmax/2+t->h_tic*2,0);
  1947.     (*t->vector)(xmax/2+t->h_tic*2,t->v_tic);
  1948.     (*t->move)(xmax/2,t->v_tic*2);
  1949.     (*t->vector)(xmax/2+t->h_tic,t->v_tic*2);
  1950.     (*t->put_text)(xmax/2+t->h_tic*2,t->v_tic*2+t->v_char/2,"test tics");
  1951.     /* test line and point types */
  1952.     x = xmax - t->h_char*4 - t->h_tic*4;
  1953.     y = ymax - t->v_char;
  1954.     for ( i = -2; y > t->v_char; i++ ) {
  1955.         (*t->linetype)(i);
  1956.         /*    (void) sprintf(label,"%d",i);  Jorgen Lippert
  1957.         lippert@risoe.dk */
  1958.         (void) sprintf(label,"%d",i+1);
  1959.         if ((*t->justify_text)(RIGHT))
  1960.             (*t->put_text)(x,y,label);
  1961.         else
  1962.             (*t->put_text)(x-strlen(label)*t->h_char,y,label);
  1963.         (*t->move)(x+t->h_char,y);
  1964.         (*t->vector)(x+t->h_char*4,y);
  1965.         if ( i >= -1 )
  1966.             (*t->point)(x+t->h_char*4+t->h_tic*2,y,i);
  1967.         y -= t->v_char;
  1968.     }
  1969.     /* test some arrows */
  1970.     (*t->linetype)(0);
  1971.     x = xmax/4;
  1972.     y = ymax/4;
  1973.     xl = t->h_tic*5;
  1974.     yl = t->v_tic*5;
  1975.     (*t->arrow)(x,y,x+xl,y,TRUE);
  1976.     (*t->arrow)(x,y,x+xl/2,y+yl,TRUE);
  1977.     (*t->arrow)(x,y,x,y+yl,TRUE);
  1978.     (*t->arrow)(x,y,x-xl/2,y+yl,FALSE);
  1979.     (*t->arrow)(x,y,x-xl,y,TRUE);
  1980.     (*t->arrow)(x,y,x-xl,y-yl,TRUE);
  1981.     (*t->arrow)(x,y,x,y-yl,TRUE);
  1982.     (*t->arrow)(x,y,x+xl,y-yl,TRUE);
  1983.     /* and back into text mode */
  1984.     (*t->text)();
  1985. }
  1986.  
  1987.  
  1988. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  1989. /* output for some terminal types must be binary to stop non Unix computers
  1990.    changing \n to \r\n. 
  1991.    If the output is not STDOUT, the following code reopens outfile 
  1992.    with binary mode. */
  1993. void
  1994. reopen_binary()
  1995. {
  1996. char filename[MAX_ID_LEN+1];
  1997.  
  1998.     if (outfile!=stdout) {
  1999.         (void) fclose(outfile);
  2000.         (void) strcpy(filename,outstr+1);    /* remove quotes */
  2001.         filename[strlen(filename)-1] = '\0';
  2002. #ifdef _Windows
  2003.         if ( !stricmp(outstr,"'PRN'") )
  2004.             (void) strcpy(filename,win_prntmp);    /* use temp file for windows */
  2005. #endif
  2006.         if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
  2007.             if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2008.                 os_error("cannot reopen file with binary type; output unknown",
  2009.                     NO_CARET);
  2010.             } 
  2011.             else {
  2012.     os_error("cannot reopen file with binary type; output reset to ascii", 
  2013.                     NO_CARET);
  2014.             }
  2015.         }
  2016. #if defined(__TURBOC__) && defined(MSDOS)
  2017. #ifndef _Windows
  2018.         if ( !stricmp(outstr,"'PRN'") )
  2019.         {
  2020.         /* Put the printer into binary mode. */
  2021.         union REGS regs;
  2022.             regs.h.ah = 0x44;    /* ioctl */
  2023.             regs.h.al = 0;        /* get device info */
  2024.             regs.x.bx = fileno(outfile);
  2025.             intdos(®s, ®s);
  2026.             regs.h.dl |= 0x20;    /* binary (no ^Z intervention) */
  2027.             regs.h.dh = 0;
  2028.             regs.h.ah = 0x44;    /* ioctl */
  2029.             regs.h.al = 1;        /* set device info */
  2030.             intdos(®s, ®s);
  2031.         }
  2032. #endif
  2033. #endif
  2034.     }
  2035. }
  2036. #endif
  2037.  
  2038. #ifdef vms
  2039. /* these are needed to modify terminal characteristics */
  2040. #include <descrip.h>
  2041. #include <iodef.h>
  2042. #include <ttdef.h>
  2043. #include <tt2def.h>
  2044. #include <dcdef.h>
  2045. #include <ssdef.h>
  2046. #include <stat.h>
  2047. #include <fab.h>
  2048. static unsigned short   chan;
  2049. static int  old_char_buf[3], cur_char_buf[3];
  2050. $DESCRIPTOR(sysoutput_desc,"SYS$OUTPUT");
  2051.  
  2052. char *vms_init()
  2053. /*
  2054.  * Determine if we have a regis terminal
  2055.  * and save terminal characteristics
  2056. */
  2057. {
  2058.    /* Save terminal characteristics in old_char_buf and
  2059.    initialise cur_char_buf to current settings. */
  2060.    int i;
  2061.    sys$assign(&sysoutput_desc,&chan,0,0);
  2062.    sys$qiow(0,chan,IO$_SENSEMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2063.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2064.    sys$dassgn(chan);
  2065.  
  2066.    /* Test if terminal is regis */
  2067.    if ((cur_char_buf[2] & TT2$M_REGIS) == TT2$M_REGIS) return("regis");
  2068.    return(NULL);
  2069. }
  2070.  
  2071. void
  2072. vms_reset()
  2073. /* set terminal to original state */
  2074. {
  2075.    int i;
  2076.    sys$assign(&sysoutput_desc,&chan,0,0);
  2077.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2078.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2079.    sys$dassgn(chan);
  2080. }
  2081.  
  2082. void
  2083. term_mode_tek()
  2084. /* set terminal mode to tektronix */
  2085. {
  2086.    long status;
  2087.    if (outfile != stdout) return; /* don't modify if not stdout */
  2088.    sys$assign(&sysoutput_desc,&chan,0,0);
  2089.    cur_char_buf[0] = 0x004A0000 | DC$_TERM | (TT$_TEK401X<<8);
  2090.    cur_char_buf[1] = (cur_char_buf[1] & 0x00FFFFFF) | 0x18000000;
  2091.  
  2092.    cur_char_buf[1] &= ~TT$M_CRFILL;
  2093.    cur_char_buf[1] &= ~TT$M_ESCAPE;
  2094.    cur_char_buf[1] &= ~TT$M_HALFDUP;
  2095.    cur_char_buf[1] &= ~TT$M_LFFILL;
  2096.    cur_char_buf[1] &= ~TT$M_MECHFORM;
  2097.    cur_char_buf[1] &= ~TT$M_NOBRDCST;
  2098.    cur_char_buf[1] &= ~TT$M_NOECHO;
  2099.    cur_char_buf[1] &= ~TT$M_READSYNC;
  2100.    cur_char_buf[1] &= ~TT$M_REMOTE;
  2101.    cur_char_buf[1] |= TT$M_LOWER;
  2102.    cur_char_buf[1] |= TT$M_TTSYNC;
  2103.    cur_char_buf[1] |= TT$M_WRAP;
  2104.    cur_char_buf[1] &= ~TT$M_EIGHTBIT;
  2105.    cur_char_buf[1] &= ~TT$M_MECHTAB;
  2106.    cur_char_buf[1] &= ~TT$M_SCOPE;
  2107.    cur_char_buf[1] |= TT$M_HOSTSYNC;
  2108.  
  2109.    cur_char_buf[2] &= ~TT2$M_APP_KEYPAD;
  2110.    cur_char_buf[2] &= ~TT2$M_BLOCK;
  2111.    cur_char_buf[2] &= ~TT2$M_DECCRT3;
  2112.    cur_char_buf[2] &= ~TT2$M_LOCALECHO;
  2113.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2114.    cur_char_buf[2] &= ~TT2$M_REGIS;
  2115.    cur_char_buf[2] &= ~TT2$M_SIXEL;
  2116.    cur_char_buf[2] |= TT2$M_BRDCSTMBX;
  2117.    cur_char_buf[2] |= TT2$M_EDITING;
  2118.    cur_char_buf[2] |= TT2$M_INSERT;
  2119.    cur_char_buf[2] |= TT2$M_PRINTER;
  2120.    cur_char_buf[2] &= ~TT2$M_ANSICRT;
  2121.    cur_char_buf[2] &= ~TT2$M_AVO;
  2122.    cur_char_buf[2] &= ~TT2$M_DECCRT;
  2123.    cur_char_buf[2] &= ~TT2$M_DECCRT2;
  2124.    cur_char_buf[2] &= ~TT2$M_DRCS;
  2125.    cur_char_buf[2] &= ~TT2$M_EDIT;
  2126.    cur_char_buf[2] |= TT2$M_FALLBACK;
  2127.  
  2128.    status = sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2129.    if (status == SS$_BADPARAM) {
  2130.       /* terminal fallback utility not installed on system */
  2131.       cur_char_buf[2] &= ~TT2$M_FALLBACK;
  2132.       sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2133.    }
  2134.    else {
  2135.       if (status != SS$_NORMAL)
  2136.          lib$signal(status,0,0);
  2137.    }
  2138.    sys$dassgn(chan);
  2139. }
  2140.  
  2141. void
  2142. term_mode_native()
  2143. /* set terminal mode back to native */
  2144. {
  2145.    int i;
  2146.    if (outfile != stdout) return; /* don't modify if not stdout */
  2147.    sys$assign(&sysoutput_desc,&chan,0,0);
  2148.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2149.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2150.    sys$dassgn(chan);
  2151. }
  2152.  
  2153. void
  2154. term_pasthru()
  2155. /* set terminal mode pasthru */
  2156. {
  2157.    if (outfile != stdout) return; /* don't modify if not stdout */
  2158.    sys$assign(&sysoutput_desc,&chan,0,0);
  2159.    cur_char_buf[2] |= TT2$M_PASTHRU;
  2160.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2161.    sys$dassgn(chan);
  2162. }
  2163.  
  2164. void
  2165. term_nopasthru()
  2166. /* set terminal mode nopasthru */
  2167. {
  2168.    if (outfile != stdout) return; /* don't modify if not stdout */
  2169.    sys$assign(&sysoutput_desc,&chan,0,0);
  2170.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2171.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2172.    sys$dassgn(chan);
  2173. }
  2174.  
  2175. void
  2176. reopen_binary()
  2177. /* close the file outfile outfile and reopen it with binary type
  2178.    if not already done or outfile == stdout */
  2179. {
  2180.    stat_t stat_buf;
  2181.    char filename[MAX_ID_LEN+1];
  2182.    if (outfile != stdout) { /* don't modify if not stdout */
  2183.       if (!fstat(fileno(outfile),&stat_buf)) {
  2184.          if (stat_buf.st_fab_rfm != FAB$C_FIX) {
  2185.             /* modify only if not already done */
  2186.             (void) fclose(outfile);
  2187.             (void) strcpy(filename,outstr+1);   /* remove quotes */
  2188.             filename[strlen(filename)-1] = '\0';
  2189.             (void) delete(filename);
  2190.             if ((outfile = fopen(filename,"wb","rfm=fix","bls=512","mrs=512"))
  2191.                 == (FILE *)NULL ) {
  2192.                if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2193.                  os_error("cannot reopen file with binary type; output unknown",
  2194.                            NO_CARET);
  2195.                }
  2196.                else {
  2197.           os_error("cannot reopen file with binary type; output reset to ascii",
  2198.                            NO_CARET);
  2199.                }
  2200.             }
  2201.          }
  2202.       }
  2203.       else{
  2204.          os_error("cannot reopen file with binary type; output remains ascii",
  2205.                   NO_CARET);
  2206.       }
  2207.    }
  2208. }
  2209.  
  2210. void
  2211. fflush_binary()
  2212. {
  2213.    typedef short int INT16;     /* signed 16-bit integers */
  2214.    register INT16 k;            /* loop index */
  2215.    if (outfile != stdout) {
  2216.        /* Stupid VMS fflush() raises error and loses last data block
  2217.           unless it is full for a fixed-length record binary file.
  2218.           Pad it here with NULL characters. */
  2219.        for (k = (INT16)((*outfile)->_cnt); k > 0; --k)
  2220.           putc('\0',outfile);
  2221.        fflush(outfile);
  2222.    }
  2223. }
  2224. #endif
  2225.