home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume24 / gnuplot3 / part24 < prev    next >
Text File  |  1991-10-28  |  49KB  |  1,678 lines

  1. Newsgroups: comp.sources.misc
  2. From: gershon%gr@cs.utah.edu (Elber Gershon)
  3. Subject:  v24i046:  gnuplot3 - interactive function plotting utility, Part24/26
  4. Message-ID: <1991Oct29.031102.4252@sparky.imd.sterling.com>
  5. X-Md4-Signature: fe8e6d16ea57d803ea23e5e08a6f7bf0
  6. Date: Tue, 29 Oct 1991 03:11:02 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: gershon%gr@cs.utah.edu (Elber Gershon)
  10. Posting-number: Volume 24, Issue 46
  11. Archive-name: gnuplot3/part24
  12. Environment: UNIX, MS-DOS, VMS
  13. Supersedes: gnuplot2: Volume 11, Issue 65-79
  14.  
  15. #!/bin/sh
  16. # this is Part.24 (part 24 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file gnuplot/standard.c continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 24; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test ! -f _shar_wnt_.tmp; then
  33.     echo 'x - still skipping gnuplot/standard.c'
  34. else
  35. echo 'x - continuing file gnuplot/standard.c'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/standard.c' &&
  37. X        q = q*z2 + qpzero[n];
  38. X    }
  39. X    return(p/q);
  40. }
  41. X
  42. double qzero(x)
  43. double x;
  44. {
  45. double p, q, z, z2;
  46. int n;
  47. X
  48. X    z = 8.0 / x;
  49. X    z2 = z * z;
  50. X    p = pqzero[5];
  51. X    q = qqzero[5];
  52. X    for (n=4; n>=0; n--) {
  53. X        p = p*z2 + pqzero[n];
  54. X        q = q*z2 + qqzero[n];
  55. X    }
  56. X    return(p/q);
  57. }
  58. X
  59. double yzero(x)
  60. double x;
  61. {
  62. double p, q, x2;
  63. int n;
  64. X
  65. X    x2 = x * x;
  66. X    p = pyzero[8];
  67. X    q = qyzero[8];
  68. X    for (n=7; n>=0; n--) {
  69. X        p = p*x2 + pyzero[n];
  70. X        q = q*x2 + qyzero[n];
  71. X    }
  72. X    return(p/q);
  73. }
  74. X
  75. double rj0(x)
  76. double x;
  77. {
  78. X    if ( x <= 0.0 )
  79. X        x = -x;
  80. X    if ( x < 8.0 )
  81. X        return(jzero(x));
  82. X    else
  83. X        return( sqrt(TWO_ON_PI/x) *
  84. X            (pzero(x)*cos(x-PI_ON_FOUR) - 8.0/x*qzero(x)*sin(x-PI_ON_FOUR)) );
  85. X
  86. }
  87. X
  88. double ry0(x)
  89. double x;
  90. {
  91. X    if ( x < 0.0 )
  92. X        return(dzero/dzero); /* error */
  93. X    if ( x < 8.0 )
  94. X        return( yzero(x) + TWO_ON_PI*rj0(x)*log(x) );
  95. X    else
  96. X        return( sqrt(TWO_ON_PI/x) *
  97. X            (pzero(x)*sin(x-PI_ON_FOUR) + 
  98. X            (8.0/x)*qzero(x)*cos(x-PI_ON_FOUR)) );
  99. X
  100. }
  101. X
  102. X
  103. double jone(x)
  104. double x;
  105. {
  106. double p, q, x2;
  107. int n;
  108. X
  109. X    x2 = x * x;
  110. X    p = pjone[8];
  111. X    q = qjone[8];
  112. X    for (n=7; n>=0; n--) {
  113. X        p = p*x2 + pjone[n];
  114. X        q = q*x2 + qjone[n];
  115. X    }
  116. X    return(p/q);
  117. }
  118. X
  119. double pone(x)
  120. double x;
  121. {
  122. double p, q, z, z2;
  123. int n;
  124. X
  125. X    z = 8.0 / x;
  126. X    z2 = z * z;
  127. X    p = ppone[5];
  128. X    q = qpone[5];
  129. X    for (n=4; n>=0; n--) {
  130. X        p = p*z2 + ppone[n];
  131. X        q = q*z2 + qpone[n];
  132. X    }
  133. X    return(p/q);
  134. }
  135. X
  136. double qone(x)
  137. double x;
  138. {
  139. double p, q, z, z2;
  140. int n;
  141. X
  142. X    z = 8.0 / x;
  143. X    z2 = z * z;
  144. X    p = pqone[5];
  145. X    q = qqone[5];
  146. X    for (n=4; n>=0; n--) {
  147. X        p = p*z2 + pqone[n];
  148. X        q = q*z2 + qqone[n];
  149. X    }
  150. X    return(p/q);
  151. }
  152. X
  153. double yone(x)
  154. double x;
  155. {
  156. double p, q, x2;
  157. int n;
  158. X
  159. X    x2 = x * x;
  160. X    p = 0.0;
  161. X    q = qyone[8];
  162. X    for (n=7; n>=0; n--) {
  163. X        p = p*x2 + pyone[n];
  164. X        q = q*x2 + qyone[n];
  165. X    }
  166. X    return(p/q);
  167. }
  168. X
  169. double rj1(x)
  170. double x;
  171. {
  172. double v,w;
  173. X    v = x;
  174. X    if ( x < 0.0 )
  175. X        x = -x;
  176. X    if ( x < 8.0 )
  177. X        return(v*jone(x));
  178. X    else {
  179. X        w = sqrt(TWO_ON_PI/x) *
  180. X            (pone(x)*cos(x-THREE_PI_ON_FOUR) - 
  181. X               8.0/x*qone(x)*sin(x-THREE_PI_ON_FOUR)) ;
  182. X        if (v < 0.0)
  183. X            w = -w;
  184. X        return( w );
  185. X    }
  186. }
  187. X
  188. double ry1(x)
  189. double x;
  190. {
  191. X    if ( x <= 0.0 )
  192. X        return(dzero/dzero); /* error */
  193. X    if ( x < 8.0 )
  194. X        return( x*yone(x) + TWO_ON_PI*(rj1(x)*log(x) - 1.0/x) );
  195. X    else
  196. X        return( sqrt(TWO_ON_PI/x) *
  197. X            (pone(x)*sin(x-THREE_PI_ON_FOUR) + 
  198. X            (8.0/x)*qone(x)*cos(x-THREE_PI_ON_FOUR)) );
  199. }
  200. X
  201. X
  202. f_besj0()    
  203. {
  204. struct value a;
  205. double x;
  206. X    (void) pop(&a);
  207. X    if (imag(&a) > zero)
  208. X        int_error("can only do bessel functions of reals",NO_CARET);
  209. X    push( complex(&a,rj0(real(&a)),0.0) );
  210. }
  211. X
  212. X
  213. f_besj1()    
  214. {
  215. struct value a;
  216. double x;
  217. X    (void) pop(&a);
  218. X    if (imag(&a) > zero)
  219. X        int_error("can only do bessel functions of reals",NO_CARET);
  220. X    push( complex(&a,rj1(real(&a)),0.0) );
  221. }
  222. X
  223. X
  224. f_besy0()    
  225. {
  226. struct value a;
  227. double x;
  228. X    (void) pop(&a);
  229. X    if (imag(&a) > zero)
  230. X        int_error("can only do bessel functions of reals",NO_CARET);
  231. X    if (real(&a) > 0.0)
  232. X        push( complex(&a,ry0(real(&a)),0.0) );
  233. X    else {
  234. X        push( complex(&a,0.0,0.0) );
  235. X        undefined = TRUE ;
  236. X    }
  237. }
  238. X
  239. X
  240. f_besy1()    
  241. {
  242. struct value a;
  243. double x;
  244. X    (void) pop(&a);
  245. X    if (imag(&a) > zero)
  246. X        int_error("can only do bessel functions of reals",NO_CARET);
  247. X    if (real(&a) > 0.0)
  248. X        push( complex(&a,ry1(real(&a)),0.0) );
  249. X    else {
  250. X        push( complex(&a,0.0,0.0) );
  251. X        undefined = TRUE ;
  252. X    }
  253. }
  254. X
  255. SHAR_EOF
  256. echo 'File gnuplot/standard.c is complete' &&
  257. chmod 0666 gnuplot/standard.c ||
  258. echo 'restore of gnuplot/standard.c failed'
  259. Wc_c="`wc -c < 'gnuplot/standard.c'`"
  260. test 15347 -eq "$Wc_c" ||
  261.     echo 'gnuplot/standard.c: original size 15347, current size' "$Wc_c"
  262. rm -f _shar_wnt_.tmp
  263. fi
  264. # ============= gnuplot/term.c ==============
  265. if test -f 'gnuplot/term.c' -a X"$1" != X"-c"; then
  266.     echo 'x - skipping gnuplot/term.c (File already exists)'
  267.     rm -f _shar_wnt_.tmp
  268. else
  269. > _shar_wnt_.tmp
  270. echo 'x - extracting gnuplot/term.c (Text)'
  271. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term.c' &&
  272. /* GNUPLOT - term.c */
  273. /*
  274. X * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  275. X *
  276. X * Permission to use, copy, and distribute this software and its
  277. X * documentation for any purpose with or without fee is hereby granted, 
  278. X * provided that the above copyright notice appear in all copies and 
  279. X * that both that copyright notice and this permission notice appear 
  280. X * in supporting documentation.
  281. X *
  282. X * Permission to modify the software is granted, but not the right to
  283. X * distribute the modified code.  Modifications are to be distributed 
  284. X * as patches to released version.
  285. X *  
  286. X * This software is provided "as is" without express or implied warranty.
  287. X * 
  288. X *
  289. X * AUTHORS
  290. X * 
  291. X *   Original Software:
  292. X *     Thomas Williams,  Colin Kelley.
  293. X * 
  294. X *   Gnuplot 2.0 additions:
  295. X *       Russell Lang, Dave Kotz, John Campbell.
  296. X *
  297. X *   Gnuplot 3.0 additions:
  298. X *       Gershon Elber and many others.
  299. X * 
  300. X * Send your comments or suggestions to 
  301. X *  pixar!info-gnuplot@sun.com.
  302. X * This is a mailing list; to join it send a note to 
  303. X *  pixar!info-gnuplot-request@sun.com.  
  304. X * Send bug reports to
  305. X *  pixar!bug-gnuplot@sun.com.
  306. X */
  307. X
  308. #include <stdio.h>
  309. #include "plot.h"
  310. #include "setshow.h"
  311. #include "term.h"
  312. #include "bitmap.h"
  313. X
  314. /* for use by all drivers */
  315. #define sign(x) ((x) >= 0 ? 1 : -1)
  316. #define abs(x) ((x) >= 0 ? (x) : -(x))
  317. #define max(a,b) ((a) > (b) ? (a) : (b))
  318. #define min(a,b) ((a) < (b) ? (a) : (b))
  319. X
  320. BOOLEAN term_init;            /* true if terminal has been initialized */
  321. X
  322. extern FILE *outfile;
  323. extern char outstr[];
  324. extern BOOLEAN term_init;
  325. extern int term;
  326. extern float xsize, ysize;
  327. X
  328. extern char input_line[];
  329. extern struct lexical_unit token[];
  330. extern int num_tokens, c_token;
  331. extern struct value *const_express();
  332. X
  333. extern BOOLEAN interactive;
  334. X
  335. /*
  336. X * instead of <strings.h>
  337. X */
  338. extern char *strcpy();
  339. extern int strlen(), strcmp(), strncmp();
  340. #ifndef AMIGA_AC_5
  341. extern double sqrt();
  342. #endif
  343. X
  344. char *getenv();
  345. X
  346. #ifdef __TURBOC__
  347. char *turboc_init();
  348. #endif
  349. #ifdef PC
  350. void reopen_binary();
  351. #endif
  352. #ifdef vms
  353. char *vms_init();
  354. void vms_reset();
  355. void term_mode_tek();
  356. void term_mode_native();
  357. void term_pasthru();
  358. void term_nopasthru();
  359. void reopen_binary();
  360. void fflush_binary();
  361. #endif
  362. X
  363. /* This is needed because the unixplot library only writes to stdout. */
  364. #ifdef UNIXPLOT
  365. FILE save_stdout;
  366. #endif
  367. int unixplot=0;
  368. X
  369. #define NICE_LINE        0
  370. #define POINT_TYPES        6
  371. X
  372. X
  373. do_point(x,y,number)
  374. int x,y;
  375. int number;
  376. {
  377. register int htic,vtic;
  378. register struct termentry *t = &term_tbl[term];
  379. X
  380. X     if (number < 0) {        /* do dot */
  381. X        (*t->move)(x,y);
  382. X        (*t->vector)(x,y);
  383. X        return;
  384. X    }
  385. X
  386. X    number %= POINT_TYPES;
  387. X    htic = (t->h_tic/2);    /* should be in term_tbl[] in later version */
  388. X    vtic = (t->v_tic/2);    
  389. X
  390. X    switch(number) {
  391. X        case 0: /* do diamond */ 
  392. X                (*t->move)(x-htic,y);
  393. X                (*t->vector)(x,y-vtic);
  394. X                (*t->vector)(x+htic,y);
  395. X                (*t->vector)(x,y+vtic);
  396. X                (*t->vector)(x-htic,y);
  397. X                (*t->move)(x,y);
  398. X                (*t->vector)(x,y);
  399. X                break;
  400. X        case 1: /* do plus */ 
  401. X                (*t->move)(x-htic,y);
  402. X                (*t->vector)(x-htic,y);
  403. X                (*t->vector)(x+htic,y);
  404. X                (*t->move)(x,y-vtic);
  405. X                (*t->vector)(x,y-vtic);
  406. X                (*t->vector)(x,y+vtic);
  407. X                break;
  408. X        case 2: /* do box */ 
  409. X                (*t->move)(x-htic,y-vtic);
  410. X                (*t->vector)(x-htic,y-vtic);
  411. X                (*t->vector)(x+htic,y-vtic);
  412. X                (*t->vector)(x+htic,y+vtic);
  413. X                (*t->vector)(x-htic,y+vtic);
  414. X                (*t->vector)(x-htic,y-vtic);
  415. X                (*t->move)(x,y);
  416. X                (*t->vector)(x,y);
  417. X                break;
  418. X        case 3: /* do X */ 
  419. X                (*t->move)(x-htic,y-vtic);
  420. X                (*t->vector)(x-htic,y-vtic);
  421. X                (*t->vector)(x+htic,y+vtic);
  422. X                (*t->move)(x-htic,y+vtic);
  423. X                (*t->vector)(x-htic,y+vtic);
  424. X                (*t->vector)(x+htic,y-vtic);
  425. X                break;
  426. X        case 4: /* do triangle */ 
  427. X                (*t->move)(x,y+(4*vtic/3));
  428. X                (*t->vector)(x-(4*htic/3),y-(2*vtic/3));
  429. X                (*t->vector)(x+(4*htic/3),y-(2*vtic/3));
  430. X                (*t->vector)(x,y+(4*vtic/3));
  431. X                (*t->move)(x,y);
  432. X                (*t->vector)(x,y);
  433. X                break;
  434. X        case 5: /* do star */ 
  435. X                (*t->move)(x-htic,y);
  436. X                (*t->vector)(x-htic,y);
  437. X                (*t->vector)(x+htic,y);
  438. X                (*t->move)(x,y-vtic);
  439. X                (*t->vector)(x,y-vtic);
  440. X                (*t->vector)(x,y+vtic);
  441. X                (*t->move)(x-htic,y-vtic);
  442. X                (*t->vector)(x-htic,y-vtic);
  443. X                (*t->vector)(x+htic,y+vtic);
  444. X                (*t->move)(x-htic,y+vtic);
  445. X                (*t->vector)(x-htic,y+vtic);
  446. X                (*t->vector)(x+htic,y-vtic);
  447. X                break;
  448. X    }
  449. }
  450. X
  451. X
  452. /*
  453. X * general point routine
  454. X */
  455. line_and_point(x,y,number)
  456. int x,y,number;
  457. {
  458. X    /* temporary(?) kludge to allow terminals with bad linetypes 
  459. X        to make nice marks */
  460. X
  461. X    (*term_tbl[term].linetype)(NICE_LINE);
  462. X    do_point(x,y,number);
  463. }
  464. X
  465. /* 
  466. X * general arrow routine
  467. X */
  468. #define ROOT2 (1.41421)        /* sqrt of 2 */
  469. X
  470. do_arrow(sx, sy, ex, ey, head)
  471. X    int sx,sy;            /* start point */
  472. X    int ex, ey;            /* end point (point of arrowhead) */
  473. X    BOOLEAN head;
  474. {
  475. X    register struct termentry *t = &term_tbl[term];
  476. X    int len = (t->h_tic + t->v_tic)/2; /* arrowhead size = avg of tic sizes */
  477. X
  478. X    /* draw the line for the arrow. That's easy. */
  479. X    (*t->move)(sx, sy);
  480. X    (*t->vector)(ex, ey);
  481. X
  482. X    if (head) {
  483. X    /* now draw the arrow head. */
  484. X    /* we put the arrowhead marks at 45 degrees to line */
  485. X       if (sx == ex) {
  486. X       /* vertical line, special case */
  487. X          int delta = ((float)len / ROOT2 + 0.5);
  488. X          if (sy < ey)
  489. X              delta = -delta;    /* up arrow goes the other way */
  490. X          (*t->move)(ex - delta, ey + delta);
  491. X          (*t->vector)(ex,ey);
  492. X          (*t->vector)(ex + delta, ey + delta);
  493. X       } else {
  494. X          int dx = sx - ex;
  495. X          int dy = sy - ey;
  496. X          double coeff = len / sqrt(2.0*((double)dx*(double)dx 
  497. X                   + (double)dy*(double)dy));
  498. X          int x,y;            /* one endpoint */
  499. X
  500. X          x = (int)( ex + (dx + dy) * coeff );
  501. X          y = (int)( ey + (dy - dx) * coeff );
  502. X          (*t->move)(x,y);
  503. X          (*t->vector)(ex,ey);
  504. X
  505. X          x = (int)( ex + (dx - dy) * coeff );
  506. X          y = (int)( ey + (dy + dx) * coeff );
  507. X          (*t->vector)(x,y);
  508. X       }
  509. X    }
  510. }
  511. X
  512. #ifdef DUMB                    /* paper or glass dumb terminal */
  513. #include "term/dumb.trm"
  514. #endif
  515. X
  516. X
  517. #ifdef PC            /* all PC types */
  518. #include "term/pc.trm"
  519. #endif
  520. X
  521. /*
  522. X   all TEK types (TEK,BITGRAPH,KERMIT,VTTEK,SELANAR) are ifdef'd in tek.trm,
  523. X   but most require various TEK routines.  Hence TEK must be defined for
  524. X   the others to compile.
  525. */
  526. #ifdef BITGRAPH
  527. # ifndef TEK
  528. #  define TEK
  529. # endif
  530. #endif
  531. X
  532. #ifdef SELENAR
  533. # ifndef TEK
  534. #  define TEK
  535. # endif
  536. #endif
  537. X
  538. #ifdef KERMIT
  539. # ifndef TEK
  540. #  define TEK
  541. # endif
  542. #endif
  543. X
  544. #ifdef LN03P
  545. # ifndef TEK
  546. #  define TEK
  547. # endif
  548. #endif
  549. X
  550. #ifdef VTTEK
  551. # ifndef TEK
  552. #  define TEK
  553. # endif
  554. #endif
  555. X
  556. #ifdef T410X        /* Tektronix 4106, 4107, 4109 and 420x terminals */
  557. #include "term/t410x.trm"
  558. #endif
  559. X
  560. #ifdef TEK            /* all TEK types, TEK, BBN, SELANAR, KERMIT, VTTEK */
  561. #include "term/tek.trm"
  562. #endif
  563. X
  564. #ifdef EPSONP    /* bit map types, EPSON, NEC, PROPRINTER, STAR Color */
  565. #include "term/epson.trm"
  566. #endif
  567. X
  568. #ifdef HPLJII        /* HP LaserJet II */
  569. #include "term/hpljii.trm"
  570. #endif
  571. X
  572. #ifdef HPLJII /* HP LaserJet III in HPGL mode */
  573. #  ifndef HPGL
  574. #    define HPGL
  575. #  endif
  576. #endif
  577. X
  578. #ifdef FIG                /* Fig 1.4FS Interactive graphics program */
  579. #include "term/fig.trm"
  580. #include "term/bigfig.trm"
  581. #endif
  582. X  
  583. #ifdef GPR              /* Apollo Graphics Primitive Resource (fixed-size window) */
  584. #include "term/gpr.trm"
  585. #endif /* GPR */
  586. X
  587. #ifdef APOLLO           /* Apollo Graphics Primitive Resource (resizable window) */
  588. #include "term/apollo.trm"
  589. #endif /* APOLLO */
  590. X
  591. #ifdef IMAGEN        /* IMAGEN printer */
  592. #include "term/imagen.trm"
  593. #endif
  594. X
  595. #ifdef EEPIC        /* EEPIC (LATEX) type */
  596. #include "term/eepic.trm"
  597. # ifndef LATEX
  598. #  define LATEX
  599. # endif
  600. #endif
  601. X
  602. #ifdef EMTEX        /* EMTEX (LATEX for PC) type */
  603. # ifndef LATEX
  604. #  define LATEX
  605. # endif
  606. #endif
  607. X
  608. #ifdef LATEX        /* LATEX type */
  609. #include "term/latex.trm"
  610. #endif
  611. X
  612. #ifdef POSTSCRIPT    /* POSTSCRIPT type */
  613. #include "term/post.trm"
  614. #endif
  615. X
  616. #ifdef PRESCRIBE    /* PRESCRIBE type */
  617. #include "term/kyo.trm"
  618. #endif
  619. X
  620. #ifdef UNIXPC     /* unix-PC  ATT 7300 or 3b1 machine */
  621. #include "term/unixpc.trm"
  622. #endif /* UNIXPC */
  623. X
  624. #ifdef AED
  625. #include "term/aed.trm"
  626. #endif /* AED */
  627. X
  628. #ifdef CGI
  629. #include "term/cgi.trm"
  630. #endif /* CGI */
  631. X
  632. #ifdef HP2648
  633. /* also works for HP2647 */
  634. #include "term/hp2648.trm"
  635. #endif /* HP2648 */
  636. X
  637. #ifdef HP26
  638. #include "term/hp26.trm"
  639. #endif /* HP26 */
  640. X
  641. #ifdef HP75
  642. #ifndef HPGL
  643. #define HPGL
  644. #endif
  645. #endif
  646. X
  647. /* HPGL - includes HP75 and HPLJIII in HPGL mode */
  648. #ifdef HPGL
  649. #include "term/hpgl.trm"
  650. #endif /* HPGL */
  651. X
  652. /* Roland DXY800A plotter driver by Martin Yii, eln557h@monu3.OZ 
  653. X    and Russell Lang, rjl@monu1.cc.monash.oz */
  654. #ifdef DXY800A
  655. #include "term/dxy.trm"
  656. #endif /* DXY800A */
  657. X
  658. #ifdef IRIS4D
  659. #include "term/iris4d.trm"
  660. #endif /* IRIS4D */
  661. X
  662. #ifdef QMS
  663. #include "term/qms.trm"
  664. #endif /* QMS */
  665. X
  666. #ifdef REGIS
  667. #include "term/regis.trm"
  668. #endif /* REGIS */
  669. X
  670. #ifdef SUN
  671. #include "term/sun.trm"
  672. #endif /* SUN */
  673. X
  674. #ifdef VWS
  675. #include "term/vws.trm"
  676. #endif /* VWS */
  677. X
  678. #ifdef V384
  679. #include "term/v384.trm"
  680. #endif /* V384 */
  681. X
  682. #ifdef UNIXPLOT
  683. #include "term/unixplot.trm"
  684. #endif /* UNIXPLOT */
  685. X
  686. #ifdef X11
  687. #include "term/x11.trm"
  688. #endif /* X11 */
  689. X
  690. #ifdef DXF
  691. #include "term/dxf.trm"
  692. #endif /* DXF */
  693. X  
  694. #ifdef AMIGASCREEN
  695. #include "term/amiga.trm"
  696. #endif
  697. X
  698. X
  699. /* Dummy functions for unavailable features */
  700. X
  701. /* change angle of text.  0 is horizontal left to right.
  702. * 1 is vertical bottom to top (90 deg rotate)  
  703. */
  704. static int null_text_angle()
  705. {
  706. return FALSE ;    /* can't be done */
  707. }
  708. X
  709. /* change justification of text.  
  710. X * modes are LEFT (flush left), CENTRE (centred), RIGHT (flush right)
  711. X */
  712. static int null_justify_text()
  713. {
  714. return FALSE ;    /* can't be done */
  715. }
  716. X
  717. X
  718. /* Change scale of plot.
  719. X * Parameters are x,y scaling factors for this plot.
  720. X * Some terminals (eg latex) need to do scaling themselves.
  721. X */
  722. static int null_scale()
  723. {
  724. return FALSE ;    /* can't be done */
  725. }
  726. X
  727. static int do_scale()
  728. {
  729. return TRUE ;    /* can be done */
  730. }
  731. X
  732. options_null()
  733. {
  734. X    term_options[0] = '\0';    /* we have no options */
  735. }
  736. X
  737. static UNKNOWN_null()
  738. {
  739. }
  740. X
  741. /*
  742. X * term_tbl[] contains an entry for each terminal.  "unknown" must be the
  743. X *   first, since term is initialized to 0.
  744. X */
  745. struct termentry term_tbl[] = {
  746. X    {"unknown", "Unknown terminal type - not a plotting device",
  747. X      100, 100, 1, 1,
  748. X      1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  749. X      UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  750. X      UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  751. X      null_justify_text, UNKNOWN_null, UNKNOWN_null}
  752. X
  753. #ifdef AMIGASCREEN
  754. X    ,{"amiga", "Amiga Custom Screen",
  755. X       AMIGA_XMAX, AMIGA_YMAX, AMIGA_VCHAR, AMIGA_HCHAR, 
  756. X       AMIGA_VTIC, AMIGA_HTIC, options_null, AMIGA_init, AMIGA_reset, 
  757. X       AMIGA_text, null_scale, AMIGA_graphics, AMIGA_move, AMIGA_vector,
  758. X       AMIGA_linetype, AMIGA_put_text, null_text_angle, 
  759. X       AMIGA_justify_text, do_point, do_arrow}
  760. #endif
  761. X
  762. #ifdef DUMB
  763. X    ,{"dumb", "printer or glass dumb terminal",
  764. X         DUMB_XMAX, DUMB_YMAX, 1, 1,
  765. X         1, 1, DUMB_options, DUMB_init, DUMB_reset,
  766. X         DUMB_text, null_scale, DUMB_graphics, DUMB_move, DUMB_vector,
  767. X         DUMB_linetype, DUMB_put_text, null_text_angle,
  768. X         null_justify_text, DUMB_point, DUMB_arrow}
  769. #endif
  770. X
  771. #ifdef PC
  772. #ifdef __TURBOC__
  773. X
  774. X    ,{"egalib", "IBM PC/Clone with EGA graphics board",
  775. X       EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  776. X       EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  777. X       EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  778. X       EGALIB_linetype, EGALIB_put_text, EGALIB_text_angle, 
  779. X       EGALIB_justify_text, do_point, do_arrow}
  780. X
  781. X    ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  782. X       VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  783. X       VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  784. X       VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  785. X       VGA_linetype, VGA_put_text, VGA_text_angle, 
  786. X       VGA_justify_text, do_point, do_arrow}
  787. X
  788. X    ,{"vgamono", "IBM PC/Clone with VGA Monochrome graphics board",
  789. X       VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  790. X       VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  791. X       VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  792. X       VGAMONO_linetype, VGA_put_text, VGA_text_angle, 
  793. X       VGA_justify_text, line_and_point, do_arrow}
  794. X
  795. X    ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  796. X       SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  797. X       SVGA_VTIC, SVGA_HTIC, options_null, SVGA_init, SVGA_reset,
  798. X       SVGA_text, null_scale, SVGA_graphics, SVGA_move, SVGA_vector,
  799. X       SVGA_linetype, SVGA_put_text, SVGA_text_angle, 
  800. X       SVGA_justify_text, do_point, do_arrow}
  801. X
  802. X    ,{"mcga", "IBM PC/Clone with MCGA graphics board",
  803. X       MCGA_XMAX, MCGA_YMAX, MCGA_VCHAR, MCGA_HCHAR,
  804. X       MCGA_VTIC, MCGA_HTIC, options_null, MCGA_init, MCGA_reset,
  805. X       MCGA_text, null_scale, MCGA_graphics, MCGA_move, MCGA_vector,
  806. X       MCGA_linetype, MCGA_put_text, MCGA_text_angle, 
  807. X       MCGA_justify_text, line_and_point, do_arrow}
  808. X
  809. X    ,{"cga", "IBM PC/Clone with CGA graphics board",
  810. X       CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  811. X       CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  812. X       CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  813. X       CGA_linetype, CGA_put_text, MCGA_text_angle, 
  814. X       CGA_justify_text, line_and_point, do_arrow}
  815. X
  816. X    ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  817. X       HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  818. X       HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  819. X       HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  820. X       HERC_linetype, HERC_put_text, MCGA_text_angle, 
  821. X       HERC_justify_text, line_and_point, do_arrow}
  822. #ifdef ATT6300
  823. X    ,{"att", "IBM PC/Clone with AT&T 6300 graphics board",
  824. X       ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  825. X       ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  826. X       ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  827. X       ATT_linetype, ATT_put_text, ATT_text_angle, 
  828. X       ATT_justify_text, line_and_point, do_arrow}
  829. #endif
  830. #else                    /* TURBO */
  831. X
  832. X    ,{"cga", "IBM PC/Clone with CGA graphics board",
  833. X       CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  834. X       CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  835. X       CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  836. X       CGA_linetype, CGA_put_text, CGA_text_angle, 
  837. X       null_justify_text, line_and_point, do_arrow}
  838. X
  839. X    ,{"egabios", "IBM PC/Clone with EGA graphics board (BIOS)",
  840. X       EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  841. X       EGA_VTIC, EGA_HTIC, options_null, EGA_init, EGA_reset,
  842. X       EGA_text, null_scale, EGA_graphics, EGA_move, EGA_vector,
  843. X       EGA_linetype, EGA_put_text, EGA_text_angle, 
  844. X       null_justify_text, do_point, do_arrow}
  845. X
  846. X    ,{"vgabios", "IBM PC/Clone with VGA graphics board (BIOS)",
  847. X       VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  848. X       VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  849. X       VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  850. X       VGA_linetype, VGA_put_text, VGA_text_angle, 
  851. X       null_justify_text, do_point, do_arrow}
  852. X
  853. #ifdef EGALIB
  854. X    ,{"egalib", "IBM PC/Clone with EGA graphics board (LIB)",
  855. X       EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  856. X       EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  857. X       EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  858. X       EGALIB_linetype, EGALIB_put_text, null_text_angle, 
  859. X       null_justify_text, do_point, do_arrow}
  860. #endif
  861. X
  862. #ifdef HERCULES
  863. X    ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  864. X       HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  865. X       HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  866. X       HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  867. X       HERC_linetype, HERC_put_text, HERC_text_angle, 
  868. X       null_justify_text, line_and_point, do_arrow}
  869. #endif                    /* HERCULES */
  870. X
  871. #ifdef ATT6300
  872. X    ,{"att", "AT&T PC/6300 graphics",
  873. X       ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  874. X       ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  875. X       ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  876. X       ATT_linetype, ATT_put_text, ATT_text_angle, 
  877. X       null_justify_text, line_and_point, do_arrow}
  878. #endif
  879. X
  880. #ifdef CORONA
  881. X    ,{"corona325", "Corona graphics ???",
  882. X       COR_XMAX, COR_YMAX, COR_VCHAR, COR_HCHAR,
  883. X       COR_VTIC, COR_HTIC, options_null, COR_init, COR_reset,
  884. X       COR_text, null_scale, COR_graphics, COR_move, COR_vector,
  885. X       COR_linetype, COR_put_text, COR_text_angle, 
  886. X       null_justify_text, line_and_point, do_arrow}
  887. #endif                    /* CORONA */
  888. #endif                    /* TURBO */
  889. #endif                    /* PC */
  890. X
  891. #ifdef AED
  892. X    ,{"aed512", "AED 512 Terminal",
  893. X       AED5_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  894. X       AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  895. X       AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  896. X       AED_linetype, AED_put_text, null_text_angle, 
  897. X       null_justify_text, do_point, do_arrow}
  898. X    ,{"aed767", "AED 767 Terminal",
  899. X       AED_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  900. X       AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  901. X       AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  902. X       AED_linetype, AED_put_text, null_text_angle, 
  903. X       null_justify_text, do_point, do_arrow}
  904. #endif
  905. X
  906. #ifdef APOLLO
  907. X       ,{"apollo", "Apollo Graphics Primitive Resource, rescaling of subsequent plots after window resizing",
  908. X       0, 0, 0, 0, /* APOLLO_XMAX, APOLLO_YMAX, APOLLO_VCHAR, APOLLO_HCHAR, are filled in at run-time */
  909. X       APOLLO_VTIC, APOLLO_HTIC, options_null, APOLLO_init, APOLLO_reset,
  910. X       APOLLO_text, null_scale, APOLLO_graphics, APOLLO_move, APOLLO_vector,
  911. X       APOLLO_linetype, APOLLO_put_text, APOLLO_text_angle,
  912. X       APOLLO_justify_text, line_and_point, do_arrow}
  913. #endif
  914. X
  915. #ifdef GPR
  916. X       ,{"gpr", "Apollo Graphics Primitive Resource, fixed-size window",
  917. X       GPR_XMAX, GPR_YMAX, GPR_VCHAR, GPR_HCHAR,
  918. X       GPR_VTIC, GPR_HTIC, options_null, GPR_init, GPR_reset,
  919. X       GPR_text, null_scale, GPR_graphics, GPR_move, GPR_vector,
  920. X       GPR_linetype, GPR_put_text, GPR_text_angle,
  921. X       GPR_justify_text, line_and_point, do_arrow}
  922. #endif
  923. X
  924. #ifdef BITGRAPH
  925. X    ,{"bitgraph", "BBN Bitgraph Terminal",
  926. X       BG_XMAX,BG_YMAX,BG_VCHAR, BG_HCHAR, 
  927. X       BG_VTIC, BG_HTIC, options_null, BG_init, BG_reset, 
  928. X       BG_text, null_scale, BG_graphics, BG_move, BG_vector,
  929. X       BG_linetype, BG_put_text, null_text_angle, 
  930. X       null_justify_text, line_and_point, do_arrow}
  931. #endif
  932. X
  933. #ifdef CGI
  934. X    ,{"cgi", "SCO CGI drivers (requires CGIDISP or CGIPRNT env variable)",
  935. X       CGI_XMAX, CGI_YMAX, 0, 0, 
  936. X       CGI_VTIC, 0, options_null, CGI_init, CGI_reset, 
  937. X       CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  938. X       CGI_linetype, CGI_put_text, CGI_text_angle, 
  939. X       CGI_justify_text, CGI_point, do_arrow}
  940. X
  941. X    ,{"hcgi", "SCO CGI drivers (hardcopy, requires CGIPRNT env variable)",
  942. X       CGI_XMAX, CGI_YMAX, 0, 0, 
  943. X       CGI_VTIC, 0, options_null, HCGI_init, CGI_reset, 
  944. X       CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  945. X       CGI_linetype, CGI_put_text, CGI_text_angle, 
  946. X       CGI_justify_text, CGI_point, do_arrow}
  947. #endif
  948. X
  949. #ifdef DXF
  950. X    ,{"dxf", "dxf-file for AutoCad (default size 120x80)",
  951. X       DXF_XMAX,DXF_YMAX,DXF_VCHAR, DXF_HCHAR,
  952. X       DXF_VTIC, DXF_HTIC, options_null,DXF_init, DXF_reset,
  953. X       DXF_text, null_scale, DXF_graphics, DXF_move, DXF_vector,
  954. X       DXF_linetype, DXF_put_text, DXF_text_angle,
  955. X       DXF_justify_text, do_point, do_arrow}
  956. #endif
  957. X
  958. #ifdef DXY800A
  959. X    ,{"dxy800a", "Roland DXY800A plotter",
  960. X       DXY_XMAX, DXY_YMAX, DXY_VCHAR, DXY_HCHAR,
  961. X       DXY_VTIC, DXY_HTIC, options_null, DXY_init, DXY_reset,
  962. X       DXY_text, null_scale, DXY_graphics, DXY_move, DXY_vector,
  963. X       DXY_linetype, DXY_put_text, DXY_text_angle, 
  964. X       null_justify_text, do_point, do_arrow}
  965. #endif
  966. X
  967. #ifdef EEPIC
  968. X    ,{"eepic", "EEPIC -- extended LaTeX picture environment",
  969. X       EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR, 
  970. X       EEPIC_VTIC, EEPIC_HTIC, options_null, EEPIC_init, EEPIC_reset, 
  971. X       EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector, 
  972. X       EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle, 
  973. X       EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
  974. #endif
  975. X
  976. #ifdef EMTEX
  977. X   
  978. X    ,{"emtex", "LATEX picture environment with emTeX specials",
  979. X       LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  980. X       LATEX_VTIC, LATEX_HTIC, options_null, EMTEX_init, EMTEX_reset, 
  981. X       EMTEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  982. X       LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  983. X       LATEX_justify_text, LATEX_point, LATEX_arrow}
  984. #endif
  985. X
  986. #ifdef EPS60
  987. X    ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
  988. X       EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  989. X       EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  990. X       EPS60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  991. X       EPSONlinetype, EPSONput_text, EPSON_text_angle,
  992. X       null_justify_text, do_point, do_arrow}
  993. #endif
  994. X
  995. #ifdef EPSONP
  996. X    ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
  997. X       EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  998. X       EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset, 
  999. X       EPSONtext, null_scale, EPSONgraphics, EPSONmove, EPSONvector, 
  1000. X       EPSONlinetype, EPSONput_text, EPSON_text_angle, 
  1001. X       null_justify_text, line_and_point, do_arrow}
  1002. #endif
  1003. X
  1004. #ifdef FIG
  1005. X    ,{"fig", "FIG graphics language: SunView or X graphics editor",
  1006. X       FIG_XMAX, FIG_YMAX, FIG_VCHAR, FIG_HCHAR, 
  1007. X       FIG_VTIC, FIG_HTIC, options_null, FIG_init, FIG_reset, 
  1008. X       FIG_text, null_scale, FIG_graphics, FIG_move, FIG_vector, 
  1009. X       FIG_linetype, FIG_put_text, FIG_text_angle, 
  1010. X       FIG_justify_text, do_point, FIG_arrow}
  1011. X    ,{"bfig", "FIG graphics language: SunView or X graphics editor. Large Graph",
  1012. X       BFIG_XMAX, BFIG_YMAX, BFIG_VCHAR, BFIG_HCHAR, 
  1013. X       BFIG_VTIC, BFIG_HTIC, options_null, FIG_init, FIG_reset, 
  1014. X       FIG_text, null_scale, FIG_graphics, FIG_move, BFIG_vector, 
  1015. X       FIG_linetype, BFIG_put_text, FIG_text_angle, 
  1016. X       FIG_justify_text, do_point, BFIG_arrow}
  1017. #endif
  1018. X
  1019. #ifdef HP26
  1020. X    ,{"hp2623A", "HP2623A and maybe others",
  1021. X       HP26_XMAX, HP26_YMAX, HP26_VCHAR, HP26_HCHAR,
  1022. X       HP26_VTIC, HP26_HTIC, options_null, HP26_init, HP26_reset,
  1023. X       HP26_text, null_scale, HP26_graphics, HP26_move, HP26_vector,
  1024. X       HP26_linetype, HP26_put_text, null_text_angle, 
  1025. X       null_justify_text, line_and_point, do_arrow}
  1026. #endif
  1027. X
  1028. #ifdef HP2648
  1029. X    ,{"hp2648", "HP2648 and HP2647",
  1030. X       HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR, 
  1031. X       HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset, 
  1032. X       HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector, 
  1033. X       HP2648linetype, HP2648put_text, HP2648_text_angle, 
  1034. X       null_justify_text, line_and_point, do_arrow}
  1035. #endif
  1036. X
  1037. #ifdef HP75
  1038. X    ,{"hp7580B", "HP7580, and probably other HPs (4 pens)",
  1039. X       HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1040. X       HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1041. X       HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1042. X       HP75_linetype, HPGL_put_text, HPGL_text_angle, 
  1043. X       null_justify_text, do_point, do_arrow}
  1044. #endif
  1045. X
  1046. #ifdef HPGL
  1047. X    ,{"hpgl", "HP7475 and (hopefully) lots of others (6 pens)",
  1048. X       HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1049. X       HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1050. X       HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1051. X       HPGL_linetype, HPGL_put_text, HPGL_text_angle, 
  1052. X       null_justify_text, do_point, do_arrow}
  1053. #endif
  1054. X
  1055. #ifdef HPLJII
  1056. X    ,{"hpljii", "HP Laserjet series II, [75 100 150 300]",
  1057. X       HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1058. X       HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1059. X       HPLJIIinit, HPLJIIreset, HPLJIItext, null_scale,
  1060. X       HPLJIIgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1061. X       HPLJIIput_text, HPLJIItext_angle, null_justify_text, line_and_point,
  1062. X       do_arrow}
  1063. X    ,{"hpdj", "HP DeskJet 500, [75 100 150 300]",
  1064. X       HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1065. X       HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1066. X       HPLJIIinit, HPLJIIreset, HPDJtext, null_scale,
  1067. X       HPDJgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1068. X       HPDJput_text, HPDJtext_angle, null_justify_text, line_and_point,
  1069. X       do_arrow}
  1070. #endif
  1071. X
  1072. #ifdef HPLJIII
  1073. X    ,{"hpljiii_port", "HP laserjet iii (using HPGL plot vectors), portrait mode",
  1074. X    HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1075. X    HPGL_VTIC, HPGL_HTIC, options_null, HPLJIII_PORT_init, HPLJIII_reset,
  1076. X    HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1077. X    HPGL_linetype, HPGL_put_text, HPGL_text_angle,
  1078. X    null_justify_text, do_point, do_arrow}
  1079. X     ,{"hpljiii_land", "HP laserjet iii (using HPGL plot vectors), landscape mode",
  1080. X    HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1081. X    HPGL_VTIC, HPGL_HTIC, options_null, HPLJIII_LAND_init, HPLJIII_reset,
  1082. X    HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1083. X    HPGL_linetype, HPGL_put_text, HPGL_text_angle,
  1084. X    null_justify_text, do_point, do_arrow}
  1085. #endif
  1086. X
  1087. #ifdef IMAGEN
  1088. X    ,{"imagen", "Imagen laser printer",
  1089. X       IMAGEN_XMAX, IMAGEN_YMAX, IMAGEN_VCHAR, IMAGEN_HCHAR, 
  1090. X       IMAGEN_VTIC, IMAGEN_HTIC, options_null, IMAGEN_init, IMAGEN_reset, 
  1091. X       IMAGEN_text, null_scale, IMAGEN_graphics, IMAGEN_move, 
  1092. X       IMAGEN_vector, IMAGEN_linetype, IMAGEN_put_text, IMAGEN_text_angle,
  1093. X       IMAGEN_justify_text, line_and_point, do_arrow}
  1094. #endif
  1095. X
  1096. #ifdef IRIS4D
  1097. X    ,{"iris4d", "Silicon Graphics IRIS 4D Series Computer",
  1098. X       IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR, 
  1099. X       IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset, 
  1100. X       IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
  1101. X       IRIS4D_linetype, IRIS4D_put_text, null_text_angle, 
  1102. X       null_justify_text, do_point, do_arrow}
  1103. #endif
  1104. X
  1105. #ifdef KERMIT
  1106. X    ,{"kc_tek40xx", "Kermit-MS tek40xx terminal emulator - color",
  1107. X       TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1108. X       TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1109. X       KTEK40Ctext, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1110. X       KTEK40Clinetype, TEK40put_text, null_text_angle, 
  1111. X       null_justify_text, do_point, do_arrow}
  1112. X    ,{"km_tek40xx", "Kermit-MS tek40xx terminal emulator - monochrome",
  1113. X       TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1114. X       TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1115. X       TEK40text, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1116. X       KTEK40Mlinetype, TEK40put_text, null_text_angle, 
  1117. X       null_justify_text, line_and_point, do_arrow}
  1118. #endif
  1119. X
  1120. #ifdef LATEX
  1121. X    ,{"latex", "LaTeX picture environment",
  1122. X       LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  1123. X       LATEX_VTIC, LATEX_HTIC, options_null, LATEX_init, LATEX_reset, 
  1124. X       LATEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  1125. X       LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  1126. X       LATEX_justify_text, LATEX_point, LATEX_arrow}
  1127. #endif
  1128. X
  1129. #ifdef LN03P
  1130. X     ,{"ln03", "LN03-plus laser printer in tektronix mode",
  1131. X    TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR,
  1132. X    TEK40VTIC, TEK40HTIC, options_null, LN03Pinit, LN03Preset,
  1133. X    TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
  1134. X    TEK40linetype, TEK40put_text, null_text_angle,
  1135. X    null_justify_text, line_and_point, do_arrow}
  1136. #endif
  1137. X
  1138. #ifdef NEC
  1139. X    ,{"nec_cp6m", "NEC printer CP6, Epson LQ-800 Monochrome",
  1140. X       NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  1141. X       NECVTIC, NECHTIC, options_null, NECinit, NECreset, 
  1142. X       NECtext, null_scale, NECMgraphics, NECmove, NECvector, 
  1143. X       NECMlinetype, NECput_text, NEC_text_angle, 
  1144. X       null_justify_text, line_and_point, do_arrow}
  1145. X    ,{"nec_cp6c", "NEC printer CP6 Color",
  1146. X       NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  1147. X       NECVTIC, NECHTIC, options_null, NECinit, NECreset, 
  1148. X       NECtext, null_scale, NECCgraphics, NECmove, NECvector, 
  1149. X       NECClinetype, NECput_text, NEC_text_angle, 
  1150. X       null_justify_text, do_point, do_arrow}
  1151. X    ,{"nec_cp6d", "NEC printer CP6, Epson LQ-800 Draft monochrome",
  1152. X       NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  1153. X       NECVTIC, NECHTIC, options_null, NECinit, NECreset, 
  1154. X       NECdraft_text, null_scale, NECMgraphics, NECmove, NECvector, 
  1155. X       NECMlinetype, NECput_text, NEC_text_angle, 
  1156. X       null_justify_text, line_and_point, do_arrow}
  1157. #endif
  1158. X
  1159. #ifdef POSTSCRIPT
  1160. X    ,{"postscript", "PostScript graphics language [mode \042fontname\042 font_size]",
  1161. X       PS_XMAX, PS_YMAX, PS_VCHAR, PS_HCHAR, 
  1162. X       PS_VTIC, PS_HTIC, PS_options, PS_init, PS_reset, 
  1163. X       PS_text, do_scale, PS_graphics, PS_move, PS_vector, 
  1164. X       PS_linetype, PS_put_text, PS_text_angle, 
  1165. X       PS_justify_text, PS_point, do_arrow}
  1166. #endif
  1167. X
  1168. #ifdef PRESCRIBE
  1169. X    ,{"prescribe", "Prescribe - for the Kyocera Laser Printer",
  1170. X    PRE_XMAX, PRE_YMAX, PRE_VCHAR, PRE_HCHAR, 
  1171. X    PRE_VTIC, PRE_HTIC, options_null, PRE_init, PRE_reset, 
  1172. X    PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1173. X    PRE_linetype, PRE_put_text, null_text_angle, 
  1174. X    PRE_justify_text, line_and_point, do_arrow}
  1175. X    ,{"kyo", "Kyocera Laser Printer with Courier font",
  1176. X    PRE_XMAX, PRE_YMAX, KYO_VCHAR, KYO_HCHAR, 
  1177. X    PRE_VTIC, PRE_HTIC, options_null, KYO_init, PRE_reset, 
  1178. X    PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1179. X    PRE_linetype, PRE_put_text, null_text_angle, 
  1180. X    PRE_justify_text, line_and_point, do_arrow}
  1181. #endif /* PRESCRIBE */
  1182. X
  1183. #ifdef QMS
  1184. X    ,{"qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
  1185. X       QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR, 
  1186. X       QMS_VTIC, QMS_HTIC, options_null, QMS_init,QMS_reset, 
  1187. X       QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
  1188. X       QMS_linetype,QMS_put_text, null_text_angle, 
  1189. X       null_justify_text, line_and_point, do_arrow}
  1190. #endif
  1191. X
  1192. #ifdef REGIS
  1193. X    ,{"regis", "REGIS graphics language",
  1194. X       REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR, 
  1195. X       REGISVTIC, REGISHTIC, options_null, REGISinit, REGISreset, 
  1196. X       REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
  1197. X       REGISlinetype, REGISput_text, REGIStext_angle, 
  1198. X       null_justify_text, line_and_point, do_arrow}
  1199. #endif
  1200. X
  1201. X
  1202. #ifdef SELANAR
  1203. X    ,{"selanar", "Selanar",
  1204. X       TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1205. X       TEK40VTIC, TEK40HTIC, options_null, SEL_init, SEL_reset, 
  1206. X       SEL_text, null_scale, SEL_graphics, TEK40move, TEK40vector, 
  1207. X       TEK40linetype, TEK40put_text, null_text_angle, 
  1208. X       null_justify_text, line_and_point, do_arrow}
  1209. #endif
  1210. X
  1211. #ifdef STARC
  1212. X    ,{"starc", "Star Color Printer",
  1213. X       STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR, 
  1214. X       STARCVTIC, STARCHTIC, options_null, STARCinit, STARCreset, 
  1215. X       STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector, 
  1216. X       STARClinetype, STARCput_text, STARC_text_angle, 
  1217. X       null_justify_text, line_and_point, do_arrow}
  1218. #endif
  1219. X
  1220. #ifdef SUN
  1221. X    ,{"sun", "SunView window system",
  1222. X       SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR, 
  1223. X       SUN_VTIC, SUN_HTIC, options_null, SUN_init, SUN_reset, 
  1224. X       SUN_text, null_scale, SUN_graphics, SUN_move, SUN_vector,
  1225. X       SUN_linetype, SUN_put_text, null_text_angle, 
  1226. X       SUN_justify_text, line_and_point, do_arrow}
  1227. #endif
  1228. X
  1229. #ifdef VWS
  1230. X    ,{"VWS", "VAX Windowing System (UIS)",
  1231. X           VWS_XMAX, VWS_YMAX, VWS_VCHAR, VWS_HCHAR,
  1232. X           VWS_VTIC, VWS_HTIC, options_null, VWS_init, VWS_reset,
  1233. X           VWS_text, null_scale, VWS_graphics, VWS_move, VWS_vector,
  1234. X           VWS_linetype, VWS_put_text, VWS_text_angle,
  1235. X           VWS_justify_text, do_point, do_arrow}
  1236. #endif
  1237. X
  1238. #ifdef TANDY60
  1239. X    ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
  1240. X       EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1241. X       EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1242. X       TANDY60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1243. X       EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1244. X       null_justify_text, do_point, do_arrow}
  1245. #endif
  1246. X
  1247. #ifdef T410X
  1248. X    ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
  1249. X       T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR, 
  1250. X       T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset, 
  1251. X       T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector, 
  1252. X       T410X_linetype, T410X_put_text, T410X_text_angle, 
  1253. X       null_justify_text, T410X_point, do_arrow}
  1254. #endif
  1255. X
  1256. #ifdef TEK
  1257. X    ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
  1258. X       TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1259. X       TEK40VTIC, TEK40HTIC, options_null, TEK40init, TEK40reset, 
  1260. X       TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector, 
  1261. X       TEK40linetype, TEK40put_text, null_text_angle, 
  1262. X       null_justify_text, line_and_point, do_arrow}
  1263. #endif
  1264. X
  1265. #ifdef UNIXPLOT
  1266. X    ,{"unixplot", "Unix plotting standard (see plot(1))",
  1267. X       UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, 
  1268. X       UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset, 
  1269. X       UP_text, null_scale, UP_graphics, UP_move, UP_vector, 
  1270. X       UP_linetype, UP_put_text, null_text_angle, 
  1271. X       null_justify_text, line_and_point, do_arrow}
  1272. #endif
  1273. X    
  1274. #ifdef UNIXPC
  1275. X    ,{"unixpc", "AT&T 3b1 or AT&T 7300 Unix PC",
  1276. X       uPC_XMAX, uPC_YMAX, uPC_VCHAR, uPC_HCHAR, 
  1277. X       uPC_VTIC, uPC_HTIC, options_null, uPC_init, uPC_reset, 
  1278. X       uPC_text, null_scale, uPC_graphics, uPC_move, uPC_vector,
  1279. X       uPC_linetype, uPC_put_text, uPC_text_angle, 
  1280. X       null_justify_text, line_and_point, do_arrow}
  1281. #endif
  1282. X
  1283. #ifdef V384
  1284. X    ,{"vx384", "Vectrix 384 and Tandy color printer",
  1285. X       V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR, 
  1286. X       V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset, 
  1287. X       V384_text, null_scale, V384_graphics, V384_move, V384_vector, 
  1288. X       V384_linetype, V384_put_text, null_text_angle, 
  1289. X       null_justify_text, do_point, do_arrow}
  1290. #endif
  1291. X
  1292. #ifdef VTTEK
  1293. X    ,{"vttek", "VT-like tek40xx terminal emulator",
  1294. X       TEK40XMAX,TEK40YMAX,TEK40VCHAR, TEK40HCHAR,
  1295. X       TEK40VTIC, TEK40HTIC, options_null, VTTEK40init, VTTEK40reset,
  1296. X       TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
  1297. X       VTTEK40linetype, VTTEK40put_text, null_text_angle,
  1298. X       null_justify_text, line_and_point, do_arrow}
  1299. #endif
  1300. X
  1301. #ifdef X11
  1302. X    ,{"x11", "X11 Window System",
  1303. X       X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1304. X       X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1305. X       X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1306. X       X11_linetype, X11_put_text, null_text_angle, 
  1307. X       X11_justify_text, line_and_point, do_arrow}
  1308. X    ,{"X11", "X11 Window System - multi-color points",
  1309. X       X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1310. X       X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1311. X       X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1312. X       X11_linetype, X11_put_text, null_text_angle, 
  1313. X       X11_justify_text, do_point, do_arrow}
  1314. #endif
  1315. };
  1316. X
  1317. #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
  1318. X
  1319. X
  1320. list_terms()
  1321. {
  1322. register int i;
  1323. X
  1324. X    fprintf(stderr,"\nAvailable terminal types:\n");
  1325. X    for (i = 0; i < TERMCOUNT; i++)
  1326. X        fprintf(stderr,"  %15s  %s\n",
  1327. X               term_tbl[i].name, term_tbl[i].description);
  1328. X    (void) putc('\n',stderr);
  1329. }
  1330. X
  1331. X
  1332. /* set_term: get terminal number from name on command line */
  1333. /* will change 'term' variable if successful */
  1334. int                        /* term number */
  1335. set_term(c_token)
  1336. int c_token;
  1337. {
  1338. X    register int t;
  1339. X    char *input_name;
  1340. X
  1341. X    if (!token[c_token].is_token)
  1342. X     int_error("terminal name expected",c_token);
  1343. X    t = -1;
  1344. X    input_name = input_line + token[c_token].start_index;
  1345. X    t = change_term(input_name, token[c_token].length);
  1346. X    if (t == -1)
  1347. X     int_error("unknown terminal type; type just 'set terminal' for a list",
  1348. X             c_token);
  1349. X    if (t == -2)
  1350. X     int_error("ambiguous terminal name; type just 'set terminal' for a list",
  1351. X             c_token);
  1352. X
  1353. X    /* otherwise the type was changed */
  1354. X
  1355. X    return(t);
  1356. }
  1357. X
  1358. /* change_term: get terminal number from name and set terminal type */
  1359. /* returns -1 if unknown, -2 if ambiguous, >=0 is terminal number */
  1360. int
  1361. change_term(name, length)
  1362. X    char *name;
  1363. X    int length;
  1364. {
  1365. X    int i, t = -1;
  1366. X
  1367. X    for (i = 0; i < TERMCOUNT; i++) {
  1368. X       if (!strncmp(name,term_tbl[i].name,length)) {
  1369. X          if (t != -1)
  1370. X            return(-2);    /* ambiguous */
  1371. X          t = i;
  1372. X       }
  1373. X    }
  1374. X
  1375. X    if (t == -1)            /* unknown */
  1376. X     return(t);
  1377. X
  1378. X    /* Success: set terminal type now */
  1379. X
  1380. X    term = t;
  1381. X    term_init = FALSE;
  1382. X    name = term_tbl[term].name;
  1383. X
  1384. X    /* Special handling for unixplot term type */
  1385. X    if (!strncmp("unixplot",name,8)) {
  1386. X       UP_redirect (2);  /* Redirect actual stdout for unixplots */
  1387. X    } else if (unixplot) {
  1388. X       UP_redirect (3);  /* Put stdout back together again. */
  1389. X    }
  1390. X
  1391. X    if (interactive)
  1392. X     fprintf(stderr, "Terminal type set to '%s'\n", name);
  1393. X
  1394. X    return(t);
  1395. }
  1396. X
  1397. /*
  1398. X   Routine to detect what terminal is being used (or do anything else
  1399. X   that would be nice).  One anticipated (or allowed for) side effect
  1400. X   is that the global ``term'' may be set. 
  1401. X   The environment variable GNUTERM is checked first; if that does
  1402. X   not exist, then the terminal hardware is checked, if possible, 
  1403. X   and finally, we can check $TERM for some kinds of terminals.
  1404. */
  1405. /* thanks to osupyr!alden (Dave Alden) for the original GNUTERM code */
  1406. init_terminal()
  1407. {
  1408. X    char *term_name = NULL;
  1409. X    int t;
  1410. X    char *term = NULL;        /* from TERM environment var */
  1411. #ifdef X11
  1412. X    char *display = NULL;
  1413. #endif
  1414. X    char *gnuterm = NULL;
  1415. X
  1416. X    /* GNUTERM environment variable is primary */
  1417. X    gnuterm = getenv("GNUTERM");
  1418. X    if (gnuterm != (char *)NULL)
  1419. X     term_name = gnuterm;
  1420. X    else {
  1421. #ifdef __TURBOC__
  1422. X       term_name = turboc_init();
  1423. X       term = (char *)NULL; /* shut up turbo C */
  1424. #endif
  1425. X       
  1426. #ifdef vms
  1427. X       term_name = vms_init();
  1428. #endif
  1429. X       
  1430. #ifdef SUN
  1431. X       term = getenv("TERM");    /* try $TERM */
  1432. X       if (term_name == (char *)NULL
  1433. X          && term != (char *)NULL && strcmp(term, "sun") == 0)
  1434. X        term_name = "sun";
  1435. #endif /* sun */
  1436. X
  1437. #ifdef GPR
  1438. X   if (gpr_isa_pad()) term_name = "gpr";       /* find out whether stdout is a DM pad. See term/gpr.trm */
  1439. #else
  1440. #ifdef APOLLO
  1441. X   if (apollo_isa_pad()) term_name = "apollo"; /* find out whether stdout is a DM pad. See term/apollo.trm */
  1442. #endif /* APOLLO */
  1443. #endif /* GPR    */
  1444. X
  1445. #ifdef X11
  1446. X       term = getenv("TERM");    /* try $TERM */
  1447. X       if (term_name == (char *)NULL
  1448. X          && term != (char *)NULL && strcmp(term, "xterm") == 0)
  1449. X        term_name = "x11";
  1450. X       display = getenv("DISPLAY");
  1451. X       if (term_name == (char *)NULL && display != (char *)NULL)
  1452. X        term_name = "x11";
  1453. #endif /* x11 */
  1454. X
  1455. #ifdef AMIGASCREEN
  1456. X       term_name = "amiga";
  1457. #endif
  1458. X
  1459. #ifdef UNIXPC
  1460. X           if (iswind() == 0) {
  1461. X              term_name = "unixpc";
  1462. X           }
  1463. #endif /* unixpc */
  1464. X
  1465. #ifdef CGI
  1466. X       if (getenv("CGIDISP") || getenv("CGIPRNT"))
  1467. X         term_name = "cgi";
  1468. #endif /*CGI */
  1469. X    }
  1470. X
  1471. X    /* We have a name, try to set term type */
  1472. X    if (term_name != NULL && *term_name != '\0') {
  1473. X       t = change_term(term_name, strlen(term_name));
  1474. X       if (t == -1)
  1475. X        fprintf(stderr, "Unknown terminal name '%s'\n", term_name);
  1476. X       else if (t == -2)
  1477. X        fprintf(stderr, "Ambiguous terminal name '%s'\n", term_name);
  1478. X       else                /* successful */
  1479. X        ;
  1480. X    }
  1481. }
  1482. X
  1483. X
  1484. #ifdef __TURBOC__
  1485. char *
  1486. turboc_init()
  1487. {
  1488. X  int g_driver,g_mode;
  1489. X  char far *c1,*c2;
  1490. X  char *term_name = NULL;
  1491. X  struct text_info tinfo;       /* So we can restore starting text mode. */
  1492. X
  1493. /* Some of this code including BGI drivers is copyright Borland Intl. */
  1494. X    g_driver=DETECT;
  1495. X          get_path();
  1496. X    gettextinfo(&tinfo);
  1497. X        initgraph(&g_driver,&g_mode,path);
  1498. X        c1=getdrivername();
  1499. X        c2=getmodename(g_mode);
  1500. X          switch (g_driver){
  1501. X            case -2: fprintf(stderr,"Graphics card not detected.\n");
  1502. X                     break;
  1503. X            case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
  1504. X                     break;
  1505. X            case -4: fprintf(stderr,"Invalid BGI driver file.\n");
  1506. X                     break;
  1507. X            case -5: fprintf(stderr,"Insufficient memory to load ",
  1508. X                             "graphics driver.");
  1509. X                     break;
  1510. X            case 1 : term_name = "cga";
  1511. X                     break;
  1512. X            case 2 : term_name = "mcga";
  1513. X                     break;
  1514. X            case 3 : 
  1515. X            case 4 : term_name = "egalib";
  1516. X                     break;
  1517. X            case 7 : term_name = "hercules";
  1518. X                     break;
  1519. X            case 8 : term_name = "att";
  1520. X                     break;
  1521. X            case 9 : term_name = "vgalib";
  1522. X                     break;
  1523. X            }
  1524. X        closegraph();
  1525. X        textmode(tinfo.currmode);
  1526. X    clrscr();
  1527. X    fprintf(stderr,"\tTC Graphics, driver %s  mode %s\n",c1,c2);
  1528. X  return(term_name);
  1529. }
  1530. #endif /* __TURBOC__ */
  1531. X
  1532. /*
  1533. X    This is always defined so we don't have to have command.c know if it
  1534. X    is there or not.
  1535. */
  1536. #ifndef UNIXPLOT
  1537. UP_redirect(caller) int caller; 
  1538. {
  1539. X    caller = caller;    /* to stop Turbo C complaining 
  1540. X                         * about caller not being used */
  1541. }
  1542. #else
  1543. UP_redirect (caller)
  1544. int caller;
  1545. /*
  1546. X    Unixplot can't really write to outfile--it wants to write to stdout.
  1547. X    This is normally ok, but the original design of gnuplot gives us
  1548. X    little choice.  Originally users of unixplot had to anticipate
  1549. X    their needs and redirect all I/O to a file...  Not very gnuplot-like.
  1550. X
  1551. X    caller:  1 - called from SET OUTPUT "FOO.OUT"
  1552. X             2 - called from SET TERM UNIXPLOT
  1553. X             3 - called from SET TERM other
  1554. X             4 - called from SET OUTPUT
  1555. */
  1556. {
  1557. X    switch (caller) {
  1558. X    case 1:
  1559. X    /* Don't save, just replace stdout w/outfile (save was already done). */
  1560. X        if (unixplot)
  1561. X            *(stdout) = *(outfile);  /* Copy FILE structure */
  1562. X    break;
  1563. X    case 2:
  1564. X        if (!unixplot) {
  1565. X            fflush(stdout);
  1566. X            save_stdout = *(stdout);
  1567. X            *(stdout) = *(outfile);  /* Copy FILE structure */
  1568. X            unixplot = 1;
  1569. X        }
  1570. X    break;
  1571. X    case 3:
  1572. X    /* New terminal in use--put stdout back to original. */
  1573. X        closepl();
  1574. X        fflush(stdout);
  1575. X        *(stdout) = save_stdout;  /* Copy FILE structure */
  1576. X        unixplot = 0;
  1577. X    break;
  1578. X    case 4:
  1579. X    /*  User really wants to go to normal output... */
  1580. X        if (unixplot) {
  1581. X            fflush(stdout);
  1582. X            *(stdout) = save_stdout;  /* Copy FILE structure */
  1583. X        }
  1584. X    break;
  1585. X    }
  1586. }
  1587. #endif
  1588. X
  1589. X
  1590. /* test terminal by drawing border and text */
  1591. /* called from command test */
  1592. test_term()
  1593. {
  1594. X    register struct termentry *t = &term_tbl[term];
  1595. X    char *str;
  1596. X    int x,y, xl,yl, i;
  1597. X    unsigned int xmax, ymax;
  1598. X    char label[MAX_ID_LEN];
  1599. X    int scaling;
  1600. X
  1601. X    if (!term_init) {
  1602. X       (*t->init)();
  1603. X       term_init = TRUE;
  1604. X    }
  1605. X    screen_ok = FALSE;
  1606. X    scaling = (*t->scale)(xsize, ysize);
  1607. X    xmax = (unsigned int)(t->xmax * (scaling ? 1 : xsize));
  1608. X    ymax = (unsigned int)(t->ymax * (scaling ? 1 : ysize));
  1609. X    (*t->graphics)();
  1610. X    /* border linetype */
  1611. X    (*t->linetype)(-2);
  1612. X    (*t->move)(0,0);
  1613. X    (*t->vector)(xmax-1,0);
  1614. X    (*t->vector)(xmax-1,ymax-1);
  1615. X    (*t->vector)(0,ymax-1);
  1616. X    (*t->vector)(0,0);
  1617. X    (void) (*t->justify_text)(LEFT);
  1618. X    (*t->put_text)(t->h_char*5,ymax-t->v_char*3,"Terminal Test");
  1619. X    /* axis linetype */
  1620. X    (*t->linetype)(-1);
  1621. X    (*t->move)(xmax/2,0);
  1622. X    (*t->vector)(xmax/2,ymax-1);
  1623. X    (*t->move)(0,ymax/2);
  1624. X    (*t->vector)(xmax-1,ymax/2);
  1625. X    /* test width and height of characters */
  1626. X    (*t->linetype)(-2);
  1627. X    (*t->move)(  xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1628. X    (*t->vector)(xmax/2+t->h_char*10,ymax/2+t->v_char/2);
  1629. X    (*t->vector)(xmax/2+t->h_char*10,ymax/2-t->v_char/2);
  1630. X    (*t->vector)(xmax/2-t->h_char*10,ymax/2-t->v_char/2);
  1631. X    (*t->vector)(xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1632. X    (*t->put_text)(xmax/2-t->h_char*10,ymax/2,
  1633. X        "12345678901234567890");
  1634. X    /* test justification */
  1635. X    (void) (*t->justify_text)(LEFT);
  1636. X    (*t->put_text)(xmax/2,ymax/2+t->v_char*6,"left justified");
  1637. X    str = "centre+d text";
  1638. X    if ((*t->justify_text)(CENTRE))
  1639. X        (*t->put_text)(xmax/2,
  1640. X                ymax/2+t->v_char*5,str);
  1641. X    else
  1642. X        (*t->put_text)(xmax/2-strlen(str)*t->h_char/2,
  1643. X                ymax/2+t->v_char*5,str);
  1644. X    str = "right justified";
  1645. X    if ((*t->justify_text)(RIGHT))
  1646. X        (*t->put_text)(xmax/2,
  1647. X                ymax/2+t->v_char*4,str);
  1648. X    else
  1649. X        (*t->put_text)(xmax/2-strlen(str)*t->h_char,
  1650. X                ymax/2+t->v_char*4,str);
  1651. X    /* test text angle */
  1652. X    str = "rotated ce+ntred text";
  1653. X    if ((*t->text_angle)(1)) {
  1654. X        if ((*t->justify_text)(CENTRE))
  1655. X            (*t->put_text)(t->v_char,
  1656. X                ymax/2,str);
  1657. X        else
  1658. X            (*t->put_text)(t->v_char,
  1659. X                ymax/2-strlen(str)*t->h_char/2,str);
  1660. X    }
  1661. X    else {
  1662. X        (void) (*t->justify_text)(LEFT);
  1663. X        (*t->put_text)(t->h_char*2,ymax/2-t->v_char*2,"Can't rotate text");
  1664. SHAR_EOF
  1665. true || echo 'restore of gnuplot/term.c failed'
  1666. fi
  1667. echo 'End of  part 24'
  1668. echo 'File gnuplot/term.c is continued in part 25'
  1669. echo 25 > _shar_seq_.tmp
  1670. exit 0
  1671.  
  1672. exit 0 # Just in case...
  1673. -- 
  1674. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1675. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1676. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1677. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1678.