home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume24 / gnuplot3 / part15 < prev    next >
Text File  |  1991-10-27  |  50KB  |  2,047 lines

  1. Newsgroups: comp.sources.misc
  2. From: gershon%gr@cs.utah.edu (Elber Gershon)
  3. Subject:  v24i037:  gnuplot3 - interactive function plotting utility, Part15/26
  4. Message-ID: <1991Oct28.002252.12402@sparky.imd.sterling.com>
  5. X-Md4-Signature: 5e63790cfeb8a0ccbd5a506a41303504
  6. Date: Mon, 28 Oct 1991 00:22:52 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 37
  11. Archive-name: gnuplot3/part15
  12. Environment: UNIX, MS-DOS, VMS
  13. Supersedes: gnuplot2: Volume 11, Issue 65-79
  14.  
  15. #!/bin/sh
  16. # this is Part.15 (part 15 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file gnuplot/term/bigfig.trm 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" != 15; 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/term/bigfig.trm'
  34. else
  35. echo 'x - continuing file gnuplot/term/bigfig.trm'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term/bigfig.trm' &&
  37. X  FIG_poly_vec_cnt++;
  38. X  if (FIG_poly_vec_cnt > 50)
  39. X    FIG_poly_clean(FIG_polyvec_stat);
  40. X  FIG_posx = x;
  41. X  FIG_posy = y;
  42. }
  43. BFIG_arrow(sx, sy, ex, ey, head)
  44. X        int sx, sy;     /* start coord */
  45. X        int ex, ey;     /* end coord */
  46. X    BOOLEAN head;
  47. {
  48. X    FIG_poly_clean(FIG_polyvec_stat);
  49. X        fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
  50. X                O_POLYLINE, T_POLYLINE,
  51. X                FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
  52. X                head ? 1 : 0, 0);
  53. X        /* arrow line */
  54. X    if ( head )
  55. X        fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
  56. X                    0, 0, 1.0,
  57. X            (double)BFIG_ARROW_WIDTH, (double)BFIG_ARROW_HEIGHT);
  58. X        fprintf(outfile, "%d %d %d %d 9999 9999\n",
  59. X                BFIG_XOFF + sx, BFIG_YOFF + BFIG_YMAX - sy,
  60. X        BFIG_XOFF + ex, BFIG_YOFF + BFIG_YMAX - ey);
  61. X        FIG_posx = ex;
  62. X        FIG_posy = ey;
  63. }
  64. BFIG_put_text(x, y, str)
  65. X        int x, y;
  66. X        char *str;
  67. {
  68. X  if (strlen(str) == 0) return;
  69. X  FIG_poly_clean(FIG_polyvec_stat);
  70. X    y = y - BFIG_VCHAR/2;               /* assuming vertical center justified */
  71. X    fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
  72. X                  O_TEXT, FIG_justify,
  73. X                  FIG_ROMAN_FONT, BFIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_angle,
  74. X                  1, BFIG_VCHAR, BFIG_HCHAR*strlen(str), BFIG_XOFF + x,
  75. X        BFIG_YMAX + BFIG_YOFF-y, str);
  76. }
  77. SHAR_EOF
  78. echo 'File gnuplot/term/bigfig.trm is complete' &&
  79. chmod 0666 gnuplot/term/bigfig.trm ||
  80. echo 'restore of gnuplot/term/bigfig.trm failed'
  81. Wc_c="`wc -c < 'gnuplot/term/bigfig.trm'`"
  82. test 3598 -eq "$Wc_c" ||
  83.     echo 'gnuplot/term/bigfig.trm: original size 3598, current size' "$Wc_c"
  84. rm -f _shar_wnt_.tmp
  85. fi
  86. # ============= gnuplot/term/cgi.trm ==============
  87. if test -f 'gnuplot/term/cgi.trm' -a X"$1" != X"-c"; then
  88.     echo 'x - skipping gnuplot/term/cgi.trm (File already exists)'
  89.     rm -f _shar_wnt_.tmp
  90. else
  91. > _shar_wnt_.tmp
  92. echo 'x - extracting gnuplot/term/cgi.trm (Text)'
  93. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/cgi.trm' &&
  94. /* GNUPLOT - cgi.trm */
  95. /*
  96. X * Copyright (C) 1990 Ronald Florence
  97. X *
  98. X * Permission is hereby granted for unlimited non-commercial
  99. X * use of this code, on condition that the copyright
  100. X * notices are left intact and any modifications to the source
  101. X * code are noted as such.  No warranty of any kind is implied
  102. X * or granted for this material.
  103. X *
  104. X * This file is included by ../term.c.
  105. X *
  106. X * This terminal driver supports SCO CGI drivers
  107. X *
  108. X * AUTHOR
  109. X *   Ronald Florence <ron@mlfarm.com>
  110. X */
  111. X
  112. #ifdef VGA_MONO
  113. static short rgb[16][3] = {
  114. X  0,    0,      0,      /* Black        */
  115. X  1000,    1000,    1000,    /* White    */
  116. X  800,    800,    0,    /* Red        */
  117. X  0,    600,    0,    /* Green    */
  118. X  0,    800,    800,    /* Blue        */
  119. X  1000,    1000,    400,    /* Yellow    */
  120. X  0,    600,    600,    /* Cyan        */
  121. X  600,    600,    600,    /* Magenta    */
  122. X  800,    800,    0,    /* Brown    */
  123. X  600,    600,    600,    /* Lt. Grey    */
  124. X  400,    600,    400,    /* Dark Grey    */
  125. X  400,    600,    1000,    /* Lt. Blue    */
  126. X  400,    1000,    400,    /* Lt Green    */
  127. X  400,    1000,    1000,    /* Lt Cyan    */
  128. X  1000,    600,    400,    /* Lt Red    */
  129. X  600,    600,    1000    /* Lt Magenta    */
  130. };
  131. #endif
  132. X
  133. #define CGI_XMAX    32767
  134. #define CGI_YMAX    32767
  135. #define CGI_VTIC    (CGI_YMAX / 75)
  136. #define CGI_HTIC    term_tbl[term].h_tic
  137. #define CGI_VCHAR    term_tbl[term].v_char
  138. #define CGI_HCHAR    term_tbl[term].h_char
  139. #define CRT        (gout[45] == 0)
  140. #define CGICOLORS    gout[13]
  141. #define CGILINES    gout[6]
  142. #define CGIROTATES    gout[36]
  143. #define CGITEXTALIGN    gout[48]
  144. X
  145. static short gout[66];
  146. static short cgidev;
  147. static short vect[4];
  148. static short gin[19] = {
  149. X 0,    /* default aspect ratio */
  150. X 1,    /* solid line */
  151. X 1,    /* line color */
  152. X 1,    /* marker type . */
  153. X 1,    /* marker color */
  154. X 1,    /* graphics text font */
  155. X 1,    /* graphics text color */
  156. X 0,    /* fill interior style */
  157. X 0,    /* fill style index */
  158. X 1,    /* fill color index */
  159. X 1     /* prompt for paper changes */
  160. X };
  161. X
  162. char    *cgidriver, *getenv();
  163. X
  164. X
  165. CGI_init()
  166. {
  167. X  if (getenv(cgidriver = "CGIDISP") == NULL)
  168. X    HCGI_init();
  169. }
  170. X
  171. X
  172. HCGI_init()
  173. {
  174. X  if (getenv(cgidriver = "CGIPRNT") == NULL)
  175. X    int_error("no CGI driver", NO_CARET);
  176. }
  177. X
  178. X
  179. CGI_graphics()
  180. {
  181. X  int    i, aspect;
  182. X  char *s;
  183. X  short font_cap[9];
  184. X  char    err_str[80];
  185. X
  186. X  if ( (s=getenv("ASPECT")) != NULL && (aspect=atoi(s)) >= 0 && aspect <= 3 )
  187. X    gin[0] = aspect;
  188. X  for (i = 0; cgidriver[i]; i++) 
  189. X    gin[11+i] = cgidriver[i];
  190. X  gin[18] = ' ';
  191. X
  192. X  if (v_opnwk(gin, &cgidev, gout) < 0) 
  193. X    {
  194. X      sprintf(err_str, "CGI error %d opening %s", -vq_error(), cgidriver);
  195. X      int_error(err_str, NO_CARET);
  196. X    }
  197. X  vqt_representation(cgidev, 9, font_cap);
  198. X  CGI_VCHAR = font_cap[8] * 3 / 2;
  199. X  CGI_HCHAR = font_cap[7];
  200. X  CGI_HTIC = CGI_VTIC * ((double) gout[1] / (double) gout[4]) / 
  201. X            ((double) gout[0] / (double) gout[3]);
  202. #ifdef VGA_MONO
  203. X  if (CGICOLORS > 2)
  204. X    vsc_table(cgidev, 0, CGICOLORS, rgb);
  205. #endif
  206. }
  207. X
  208. X
  209. CGI_text()
  210. {
  211. X  if (CRT)  
  212. X    {
  213. X      short ptin[2];
  214. X      char  strin[2];
  215. X      
  216. X      ptin[0] = 0;
  217. X      ptin[1] = 0;
  218. X      vrq_string(cgidev, 1, 0, ptin, strin);
  219. X    }
  220. X  v_clswk(cgidev);
  221. }
  222. X
  223. X
  224. CGI_reset()
  225. {
  226. }
  227. X
  228. X
  229. CGI_move(x, y)
  230. X     int x, y;
  231. {
  232. X  vect[0] = x;
  233. X  vect[1] = y;
  234. }
  235. X
  236. CGI_vector(x, y)
  237. X     int x, y;
  238. {
  239. X  vect[2] = x;
  240. X  vect[3] = y;
  241. X  v_pline(cgidev, 2, vect);
  242. X  vect[0] = x;
  243. X  vect[1] = y;
  244. }
  245. X
  246. X
  247. CGI_linetype(linetype)
  248. X     int linetype;
  249. {
  250. X  short lcolor;
  251. X
  252. X  if (CGICOLORS > 2) 
  253. X    {
  254. X      lcolor = (linetype + 2) % CGICOLORS + 1;
  255. X      vsl_color(cgidev, lcolor);
  256. X      vsm_color(cgidev, lcolor);
  257. X    }
  258. X  vsl_type(cgidev, (linetype < 1) ? 1 : (linetype % CGILINES) + 1);
  259. }
  260. X
  261. X
  262. CGI_put_text(x, y, str)
  263. int x, y;
  264. char *str;
  265. {
  266. X  v_gtext(cgidev, (short) x, (short) y, str);
  267. }
  268. X
  269. X
  270. CGI_text_angle(ang)
  271. int    ang;
  272. {
  273. X  if (!CGIROTATES)
  274. X    return FALSE;
  275. X                /* angles are 1/10 degree ccw */
  276. X  vst_rotation(cgidev, (ang) ? 900 : 0);
  277. X  return TRUE;
  278. }
  279. X
  280. X
  281. CGI_justify_text(mode)
  282. enum JUSTIFY mode;
  283. {
  284. X  short hor_in, hor_out, vert_out;
  285. X
  286. X  if (!CGITEXTALIGN)
  287. X    return FALSE;
  288. X
  289. X  switch (mode)
  290. X    {
  291. X    case LEFT:   hor_in = 0; break;
  292. X    case CENTRE: hor_in = 1; break;
  293. X    case RIGHT:  hor_in = 2; break;
  294. X    }
  295. X  vst_alignment(cgidev, hor_in, 1, &hor_out, &vert_out); 
  296. X  return TRUE;
  297. }
  298. X
  299. X
  300. #define POINT_TYPES 6
  301. X
  302. CGI_point(x,y,num)
  303. X     int x, y, num;
  304. {
  305. X  short  point[2];
  306. X  static short cgimarker[POINT_TYPES] = {1, 2, 6, 4, 5, 3};
  307. X                          /* .  +  <> [] X  * */
  308. X  if (num < 0)
  309. X    {
  310. X      CGI_move(x, y);
  311. X      CGI_vector(x, y);
  312. X    }
  313. X  else
  314. X    {
  315. X      vsm_type(cgidev, cgimarker[num % POINT_TYPES]);
  316. X      point[0] = x;
  317. X      point[1] = y;
  318. X      v_pmarker(cgidev, 1, point);
  319. X    }
  320. }
  321. SHAR_EOF
  322. chmod 0666 gnuplot/term/cgi.trm ||
  323. echo 'restore of gnuplot/term/cgi.trm failed'
  324. Wc_c="`wc -c < 'gnuplot/term/cgi.trm'`"
  325. test 4407 -eq "$Wc_c" ||
  326.     echo 'gnuplot/term/cgi.trm: original size 4407, current size' "$Wc_c"
  327. rm -f _shar_wnt_.tmp
  328. fi
  329. # ============= gnuplot/term/dxy.trm ==============
  330. if test -f 'gnuplot/term/dxy.trm' -a X"$1" != X"-c"; then
  331.     echo 'x - skipping gnuplot/term/dxy.trm (File already exists)'
  332.     rm -f _shar_wnt_.tmp
  333. else
  334. > _shar_wnt_.tmp
  335. echo 'x - extracting gnuplot/term/dxy.trm (Text)'
  336. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/dxy.trm' &&
  337. /* GNUPLOT - dxy.trm */
  338. /*
  339. X * Copyright (C) 1990   
  340. X *
  341. X * Permission to use, copy, and distribute this software and its
  342. X * documentation for any purpose with or without fee is hereby granted, 
  343. X * provided that the above copyright notice appear in all copies and 
  344. X * that both that copyright notice and this permission notice appear 
  345. X * in supporting documentation.
  346. X *
  347. X * Permission to modify the software is granted, but not the right to
  348. X * distribute the modified code.  Modifications are to be distributed 
  349. X * as patches to released version.
  350. X *  
  351. X * This software  is provided "as is" without express or implied warranty.
  352. X * 
  353. X * This file is included by ../term.c.
  354. X *
  355. X * This terminal driver supports:
  356. X *  Roland DXY800A plotter 
  357. X *
  358. X * AUTHORS
  359. X *  Martin Yii, eln557h@monu3.OZ
  360. X *  Further modified Jan 1990 by Russell Lang, rjl@monu1.cc.monash.oz
  361. X * 
  362. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  363. X * 
  364. X */
  365. X
  366. #define DXY_XMAX 2470
  367. #define DXY_YMAX 1700
  368. X
  369. #define DXY_XLAST (DXY_XMAX - 1)
  370. #define DXY_YLAST (DXY_XMAX - 1)
  371. X
  372. #define DXY_VCHAR    (56)    /* double actual height of characters */
  373. #define DXY_HCHAR    (28)    /* actual width including spacing */
  374. #define DXY_VTIC    (28)        
  375. #define DXY_HTIC    (28)        
  376. X
  377. int dxy_angle = 0;
  378. X
  379. DXY_init()
  380. {
  381. /*
  382. X    No initialisation sequences for DXY 800A
  383. */
  384. }
  385. X
  386. X
  387. DXY_graphics()
  388. {
  389. X    /* HOME, Character size 3 */
  390. X    fprintf(outfile,"H\nS3\n");
  391. }
  392. X
  393. X
  394. DXY_text()
  395. {
  396. /*
  397. X    No sequences needed
  398. */
  399. }
  400. X
  401. X
  402. DXY_linetype(linetype)
  403. int linetype;
  404. {
  405. X    /* select pen */
  406. X    fprintf(outfile,"J%d\n",(linetype+2)%8+1);
  407. X    switch(linetype) {
  408. X       case -1 :  /* use dotted line for axis */
  409. X               fprintf(outfile,"L1\nB50\n");
  410. X            break;
  411. X       default :  /* use solid line for all others */
  412. X            fprintf(outfile,"L0\n");
  413. X                break;
  414. X       }
  415. }
  416. X
  417. X
  418. DXY_move(x,y)
  419. int x,y;
  420. {
  421. X    fprintf(outfile,"M%d,%d\n",x,y);
  422. }
  423. X
  424. X
  425. DXY_vector(x,y)
  426. int x,y;
  427. {
  428. X    fprintf(outfile,"D%d,%d\n",x,y);
  429. }
  430. X
  431. X
  432. DXY_put_text(x,y,str)
  433. int x, y;
  434. char *str;
  435. {
  436. X    if (dxy_angle == 1 ) 
  437. X        /* vertical */
  438. X        DXY_move(x + DXY_VCHAR/4,y);
  439. X    else
  440. X        /* horiz */
  441. X        DXY_move(x,y - DXY_VCHAR/4);
  442. X    fprintf(outfile,"P%s\n",str);
  443. }
  444. X
  445. X
  446. int DXY_text_angle(ang)
  447. int ang;
  448. {
  449. X    dxy_angle = ang;
  450. X    fprintf(outfile,"Q%d\n",ang);
  451. X    return TRUE;
  452. }
  453. X
  454. X
  455. DXY_reset()
  456. {
  457. X    /* Home pen */
  458. X    fprintf(outfile,"H\n");
  459. }
  460. X
  461. SHAR_EOF
  462. chmod 0666 gnuplot/term/dxy.trm ||
  463. echo 'restore of gnuplot/term/dxy.trm failed'
  464. Wc_c="`wc -c < 'gnuplot/term/dxy.trm'`"
  465. test 2238 -eq "$Wc_c" ||
  466.     echo 'gnuplot/term/dxy.trm: original size 2238, current size' "$Wc_c"
  467. rm -f _shar_wnt_.tmp
  468. fi
  469. # ============= gnuplot/term/eepic.trm ==============
  470. if test -f 'gnuplot/term/eepic.trm' -a X"$1" != X"-c"; then
  471.     echo 'x - skipping gnuplot/term/eepic.trm (File already exists)'
  472.     rm -f _shar_wnt_.tmp
  473. else
  474. > _shar_wnt_.tmp
  475. echo 'x - extracting gnuplot/term/eepic.trm (Text)'
  476. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/eepic.trm' &&
  477. /* GNUPLOT - eepic.trm */
  478. /*
  479. X * Copyright (C) 1990   
  480. X *
  481. X * Permission to use, copy, and distribute this software and its
  482. X * documentation for any purpose with or without fee is hereby granted, 
  483. X * provided that the above copyright notice appear in all copies and 
  484. X * that both that copyright notice and this permission notice appear 
  485. X * in supporting documentation.
  486. X *
  487. X * Permission to modify the software is granted, but not the right to
  488. X * distribute the modified code.  Modifications are to be distributed 
  489. X * as patches to released version.
  490. X *  
  491. X * This software  is provided "as is" without express or implied warranty.
  492. X * 
  493. X * This file is included by ../term.c.
  494. X *
  495. X * This terminal driver supports:
  496. X *   The EEPIC macros for LaTeX. 
  497. X *
  498. X * AUTHORS
  499. X *   David Kotz
  500. X *
  501. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  502. X * 
  503. X */
  504. /*
  505. X *  This file contains the eepic terminal driver, intended for use with the 
  506. X *  eepic.sty macro package for LaTeX. This is an alternative to the 
  507. X *  latex driver. You need eepic.sty, epic.sty, and a printer driver that
  508. X *  supports the tpic \specials.
  509. X *
  510. X * Although dotted and dashed lines are possible with EEPIC, and are
  511. X * tempting, they do not work well for high-sample-rate curves, mushing
  512. X * the dashes all together into a solid line. For now anyway, the EEPIC
  513. X * driver will have only solid lines. Anyone got a solution?
  514. X *
  515. X * LATEX must also be defined.
  516. X */
  517. X
  518. #define EEPIC_PTS_PER_INCH (72.27)
  519. #define DOTS_PER_INCH (300)    /* resolution of printer we expect to use */
  520. #define EEPIC_UNIT (EEPIC_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
  521. X
  522. /* 5 inches wide by 3 inches high (default) */
  523. #define EEPIC_XMAX (5*DOTS_PER_INCH)  /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0) */
  524. #define EEPIC_YMAX (3*DOTS_PER_INCH)  /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0) */
  525. X
  526. #define EEPIC_HTIC (5*DOTS_PER_INCH/72)        /* (5./EEPIC_UNIT) */
  527. #define EEPIC_VTIC (5*DOTS_PER_INCH/72)        /* (5./EEPIC_UNIT) */
  528. #define EEPIC_HCHAR (DOTS_PER_INCH*53/10/72)    /* (5.3/EEPIC_UNIT) */
  529. #define EEPIC_VCHAR (DOTS_PER_INCH*11/72)    /* (11./EEPIC_UNIT) */
  530. X
  531. static unsigned int EEPIC_posx;
  532. static unsigned int EEPIC_posy;
  533. enum JUSTIFY eepic_justify=LEFT;
  534. static int eepic_angle=0;
  535. X
  536. /* for DOTS point style */
  537. #define EEPIC_TINY_DOT "\\rule{.1pt}{.1pt}"
  538. X
  539. /* POINTS */
  540. #define EEPIC_POINT_TYPES 12    /* we supply more point types */
  541. static char *EEPIC_points[] = {
  542. X    "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Diamond$}}",
  543. X    "\\makebox(0,0){$+$}",
  544. X    "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Box$}}",
  545. X    "\\makebox(0,0){$\\times$}",
  546. X    "\\makebox(0,0){$\\triangle$}",
  547. X    "\\makebox(0,0){$\\star$}",
  548. X    "\\circle{12}", "\\circle{18}", "\\circle{24}",
  549. X    "\\circle*{12}", "\\circle*{18}", "\\circle*{24}"
  550. };
  551. X
  552. /* LINES */
  553. #define EEPIC_NUMLINES 5        /* number of linetypes below */
  554. static char *EEPIC_lines[] = {
  555. X    "\\thicklines \\path",            /* -2 border */
  556. X    "\\thinlines \\drawline[-50]",        /* -1 axes */
  557. X    "\\thinlines \\path",            /*  0 solid thin  */
  558. X    "\\thicklines \\path",            /*  1 solid thick */
  559. X    "\\Thicklines \\path",            /*  2 solid Thick */
  560. };
  561. /* These are other possibilities
  562. X    "\\thinlines \\dottedline{30}",
  563. X    "\\thinlines \\drawline[-30]",    
  564. X    "\\thinlines \\dottedline{60}",
  565. X    "\\thinlines \\drawline[-60]",    
  566. X    "\\thinlines \\dashline[-10]{20}[6]"
  567. */
  568. static int EEPIC_type;        /* current line type */
  569. static BOOLEAN EEPIC_inline = FALSE; /* are we in the middle of a line */
  570. static void EEPIC_endline();    /* terminate any line in progress */
  571. static int EEPIC_linecount = 0; /* number of points in line so far */
  572. #define EEPIC_LINEMAX 50        /* max value for linecount */
  573. X
  574. /* ARROWS */
  575. /* we use the same code as for LATEX */
  576. static void best_latex_arrow(); /* figure out the best arrow */
  577. X
  578. EEPIC_init()
  579. {
  580. X    EEPIC_posx = EEPIC_posy = 0;
  581. X    EEPIC_linetype(-1);
  582. X    fprintf(outfile, "%% GNUPLOT: LaTeX picture using EEPIC macros\n");
  583. X    fprintf(outfile, "\\setlength{\\unitlength}{%fpt}\n", EEPIC_UNIT);
  584. }
  585. X
  586. X
  587. EEPIC_scale(xs, ys)
  588. X    double xs, ys;            /* scaling factors */
  589. {
  590. X    register struct termentry *t = &term_tbl[term];
  591. X
  592. X    /* we change the table for use in graphics.c and EEPIC_graphics */
  593. X    t->xmax = (unsigned int)(EEPIC_XMAX * xs);
  594. X    t->ymax = (unsigned int)(EEPIC_YMAX * ys);
  595. X
  596. X    return(TRUE);
  597. }
  598. X
  599. EEPIC_graphics()
  600. {
  601. X    register struct termentry *t = &term_tbl[term];
  602. X
  603. X    fprintf(outfile, "\\begin{picture}(%d,%d)(0,0)\n", t->xmax, t->ymax);
  604. X    fprintf(outfile, "\\tenrm\n");
  605. }
  606. X
  607. X
  608. EEPIC_text()
  609. {
  610. X    EEPIC_endline();
  611. X    fprintf(outfile, "\\end{picture}\n");
  612. }
  613. X
  614. X
  615. EEPIC_linetype(linetype)
  616. X    int linetype;
  617. {
  618. X    EEPIC_endline();
  619. X
  620. X    if (linetype >= EEPIC_NUMLINES-2)
  621. X     linetype %= (EEPIC_NUMLINES-2);
  622. X
  623. X    EEPIC_type = linetype;
  624. }
  625. X
  626. X
  627. X
  628. EEPIC_move(x,y)
  629. X    unsigned int x,y;
  630. {
  631. X    EEPIC_endline();
  632. X
  633. X    EEPIC_posx = x;
  634. X    EEPIC_posy = y;
  635. }
  636. X
  637. X
  638. EEPIC_point(x,y, number)        /* version of line_and_point */
  639. X    unsigned int x,y;
  640. X    int number;                /* type of point */
  641. {
  642. X    EEPIC_move(x,y);
  643. X    
  644. X    /* Print the character defined by 'number'; number < 0 means 
  645. X      to use a dot, otherwise one of the defined points. */
  646. X    fprintf(outfile, "\\put(%d,%d){%s}\n", x, y, 
  647. X          (number < 0 ? EEPIC_TINY_DOT
  648. X           : EEPIC_points[number % EEPIC_POINT_TYPES]));
  649. }
  650. X
  651. X
  652. EEPIC_vector(ux,uy)
  653. X    unsigned int ux,uy;
  654. {
  655. X    if (!EEPIC_inline) {
  656. X       EEPIC_inline = TRUE;
  657. X
  658. X       /* Start a new line. This depends on line type */
  659. X       fprintf(outfile, "%s(%u,%u)", 
  660. X             EEPIC_lines[EEPIC_type+2], 
  661. X             EEPIC_posx, EEPIC_posy);
  662. X       EEPIC_linecount = 1;
  663. X    } else {
  664. X       /* Even though we are in middle of a path, 
  665. X        * we may want to start a new path command. 
  666. X        * If they are too long then latex will choke.
  667. X        */
  668. X       if (EEPIC_linecount++ >= EEPIC_LINEMAX) {
  669. X          fprintf(outfile, "\n");
  670. X          fprintf(outfile, "%s(%u,%u)", 
  671. X                EEPIC_lines[EEPIC_type+2], 
  672. X                EEPIC_posx, EEPIC_posy);
  673. X          EEPIC_linecount = 1;
  674. X       }
  675. X    }
  676. X    fprintf(outfile, "(%u,%u)", ux,uy);
  677. X    EEPIC_posx = ux;
  678. X    EEPIC_posy = uy;
  679. }
  680. X
  681. static void
  682. EEPIC_endline()
  683. {
  684. X    if (EEPIC_inline) {
  685. X       fprintf(outfile, "\n");
  686. X       EEPIC_inline = FALSE;
  687. X    }
  688. }
  689. X
  690. X
  691. EEPIC_arrow(sx,sy, ex,ey, head)
  692. X    int sx,sy, ex,ey;
  693. X    BOOLEAN head;
  694. {
  695. X    best_latex_arrow(sx,sy, ex,ey, 2, head); /* call latex routine */
  696. X
  697. X    EEPIC_posx = ex;
  698. X    EEPIC_posy = ey;
  699. }
  700. X
  701. X
  702. EEPIC_put_text(x, y, str)
  703. X    int x,y;                /* reference point of string */
  704. X    char str[];            /* the text */
  705. {
  706. X    EEPIC_endline();
  707. X
  708. X    fprintf(outfile, "\\put(%d,%d)",x,y);
  709. X    switch(eepic_angle) {  
  710. X        case 0: {
  711. X          switch(eepic_justify) {
  712. X             case LEFT: {
  713. X                fprintf(outfile,
  714. X                       "{\\makebox(0,0)[l]{%s}}\n", str);
  715. X                break;
  716. X             }
  717. X             case CENTRE: {
  718. X                fprintf(outfile,
  719. X                       "{\\makebox(0,0){%s}}\n", str);
  720. X                break;
  721. X             }
  722. X             case RIGHT: {
  723. X                fprintf(outfile,
  724. X                       "{\\makebox(0,0)[r]{%s}}\n", str);
  725. X                break;
  726. X             }
  727. X          }
  728. X          break;
  729. X       }
  730. X       case 1: {            /* put text in a short stack */
  731. X          switch(eepic_justify) {
  732. X             case LEFT: {
  733. X                fprintf(outfile,
  734. X                       "{\\makebox(0,0)[lb]{\\shortstack{%s}}}\n", str);
  735. X                break;
  736. X             }
  737. X             case CENTRE: {
  738. X                fprintf(outfile,
  739. X                       "{\\makebox(0,0)[l]{\\shortstack{%s}}}\n", str);
  740. X                break;
  741. X             }
  742. X             case RIGHT: {
  743. X                fprintf(outfile,
  744. X                       "{\\makebox(0,0)[lt]{\\shortstack{%s}}}\n", str);
  745. X                break;
  746. X             }
  747. X          }
  748. X          break;
  749. X       }    
  750. X    }
  751. }
  752. X
  753. X
  754. X
  755. int EEPIC_justify_text(mode)
  756. X    enum JUSTIFY mode;
  757. {
  758. X    eepic_justify = mode;
  759. X    return (TRUE);
  760. }
  761. X
  762. int EEPIC_text_angle(angle)
  763. X    int angle;
  764. {
  765. X    /* we can't really write text vertically, but this will 
  766. X      put the ylabel centred at the left of the plot, and
  767. X      then we'll make a \shortstack */
  768. X    eepic_angle = angle;
  769. X    return (TRUE);
  770. }
  771. X
  772. EEPIC_reset()
  773. {
  774. X    EEPIC_endline();
  775. X    EEPIC_posx = EEPIC_posy = 0;
  776. }
  777. X
  778. SHAR_EOF
  779. chmod 0644 gnuplot/term/eepic.trm ||
  780. echo 'restore of gnuplot/term/eepic.trm failed'
  781. Wc_c="`wc -c < 'gnuplot/term/eepic.trm'`"
  782. test 7640 -eq "$Wc_c" ||
  783.     echo 'gnuplot/term/eepic.trm: original size 7640, current size' "$Wc_c"
  784. rm -f _shar_wnt_.tmp
  785. fi
  786. # ============= gnuplot/term/epson.trm ==============
  787. if test -f 'gnuplot/term/epson.trm' -a X"$1" != X"-c"; then
  788.     echo 'x - skipping gnuplot/term/epson.trm (File already exists)'
  789.     rm -f _shar_wnt_.tmp
  790. else
  791. > _shar_wnt_.tmp
  792. echo 'x - extracting gnuplot/term/epson.trm (Text)'
  793. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/epson.trm' &&
  794. /* GNUPLOT - epson.trm */
  795. /*
  796. X * Copyright (C) 1990   
  797. X *
  798. X * Permission to use, copy, and distribute this software and its
  799. X * documentation for any purpose with or without fee is hereby granted, 
  800. X * provided that the above copyright notice appear in all copies and 
  801. X * that both that copyright notice and this permission notice appear 
  802. X * in supporting documentation.
  803. X *
  804. X * Permission to modify the software is granted, but not the right to
  805. X * distribute the modified code.  Modifications are to be distributed 
  806. X * as patches to released version.
  807. X *  
  808. X * This software  is provided "as is" without express or implied warranty.
  809. X * 
  810. X * This file is included by ../term.c.
  811. X *
  812. X * This terminal driver supports:
  813. X *  epson_lx800, nec_cp6c, nec_cp6d, nec_cp6b, starc,
  814. X *  epson_60dpi, tandy_60dpi
  815. X *
  816. X * AUTHORS
  817. X *  Russell Lang
  818. X *  William Wilson
  819. X *
  820. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  821. X * 
  822. X */
  823. X
  824. /* The following epson lx800 driver uses generic bit mapped graphics
  825. X   routines to build up a bit map in memory. */
  826. /* by Russell Lang, rjl@monu1.cc.monash.edu.au */
  827. /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
  828. /* EPSON_init changes outfile to binary mode on PC's */
  829. X
  830. #ifdef EPSONP
  831. X
  832. #define EPSONXMAX    512 
  833. #define EPSONYMAX    384
  834. X
  835. #define EPSONXLAST (EPSONXMAX - 1)
  836. #define EPSONYLAST (EPSONYMAX - 1)
  837. X
  838. #define EPSONVCHAR        FNT5X9_VCHAR      
  839. #define EPSONHCHAR        FNT5X9_HCHAR        
  840. #define EPSONVTIC        6
  841. #define EPSONHTIC        6
  842. X
  843. EPSONinit()
  844. {
  845. #ifdef PC
  846. X    reopen_binary();
  847. #endif
  848. #ifdef vms
  849. X    reopen_binary();
  850. #endif
  851. }
  852. X
  853. X
  854. EPSONgraphics()
  855. {
  856. X    b_charsize(FNT5X9);
  857. X    b_makebitmap((unsigned int)(EPSONXMAX*xsize),
  858. X                 (unsigned int)(EPSONYMAX*ysize),1);
  859. }
  860. X
  861. X
  862. EPSONtext()
  863. {
  864. X    epson_dump();
  865. X    b_freebitmap();
  866. }
  867. X
  868. X
  869. #define EPSONlinetype b_setlinetype
  870. #define EPSONmove b_move
  871. #define EPSONvector b_vector
  872. #define EPSONput_text b_put_text
  873. #define EPSON_text_angle b_text_angle
  874. X
  875. EPSONreset()
  876. {
  877. #ifdef vms
  878. X    fflush_binary();
  879. #endif
  880. }
  881. X
  882. X
  883. /* output file must be binary mode for epson_dump */
  884. epson_dump()
  885. {
  886. X  register unsigned int x;
  887. X  int j;
  888. X    for (j=(b_ysize/8)-1; j>=0; j--) {
  889. X        /* select plotter graphics mode (square pixels) */
  890. X        fprintf(outfile,"\033J\030");    /* line feed 8/72" = 8 dots */
  891. X        fprintf(outfile,"\r\033*\005");
  892. X        (void) fputc((char)(b_xsize%256),outfile);
  893. X        (void) fputc((char)(b_xsize/256),outfile);
  894. X        for (x=0; x<b_xsize; x++) {
  895. X            (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
  896. X        }
  897. X    }
  898. #ifdef PC
  899. X    fprintf(stderr,"Print using: COPY /B\n");
  900. #endif
  901. }
  902. X
  903. #endif /* EPSONP */
  904. X
  905. X
  906. /* The following NEC CP6 Pinwriter driver uses generic bit mapped graphics
  907. X   routines to build up a bit map in memory. */
  908. /* by Russell Lang, rjl@monu1.cc.monash.edu.au */
  909. /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
  910. /* NECinit changes outfile to binary mode for PC's */
  911. X
  912. /* Add a Monochrome NEC printer (for faster speed and line types) jdc */
  913. X
  914. #ifdef NEC
  915. X
  916. #define NECXMAX    400 
  917. #define NECYMAX    320
  918. X
  919. #define NECXLAST (NECXMAX - 1)
  920. #define NECYLAST (NECYMAX - 1)
  921. X
  922. #define NECVCHAR        FNT5X9_VCHAR      
  923. #define NECHCHAR        FNT5X9_HCHAR        
  924. #define NECVTIC        6
  925. #define NECHTIC        6
  926. X
  927. /* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
  928. static unsigned int neccolor[] = {1,8,4,2,10,12,6,14};
  929. static unsigned int necpcolor[]= {0,2,1,4};
  930. X
  931. NECinit()
  932. {
  933. #ifdef PC
  934. X    reopen_binary();
  935. #endif
  936. #ifdef vms
  937. X    reopen_binary();
  938. #endif
  939. }
  940. X
  941. X
  942. /* Monochrome only NEC CP6 printer (set term nec_cp6m or nec_cp6d). */
  943. /* will probably work with NEC P6 printer */
  944. NECMgraphics()
  945. {
  946. X    b_charsize(FNT5X9);
  947. X    b_makebitmap((unsigned int)(NECXMAX*xsize),
  948. X                 (unsigned int)(NECYMAX*ysize),1);
  949. }
  950. X
  951. /* Color ribbon in NEC CP6 printer (set term nec_cp6c) */
  952. NECCgraphics()
  953. {
  954. X    b_charsize(FNT5X9);
  955. X    b_makebitmap((unsigned int)(NECXMAX*xsize),
  956. X                 (unsigned int)(NECYMAX*ysize),4);
  957. }
  958. X
  959. X
  960. NECdraft_text()
  961. {
  962. X    nec_draft_dump();
  963. X    b_freebitmap();
  964. }
  965. X
  966. NECtext()
  967. {
  968. X    nec_dump();
  969. X    b_freebitmap();
  970. }
  971. X
  972. NECClinetype(linetype)
  973. int linetype;
  974. {
  975. X    if (linetype>=6)
  976. X        linetype %= 6;
  977. X    b_setvalue(neccolor[linetype+2]);
  978. }
  979. X
  980. #define NECMlinetype b_setlinetype
  981. #define NECmove b_move
  982. #define NECvector b_vector
  983. #define NECput_text b_put_text
  984. #define NEC_text_angle b_text_angle
  985. X
  986. X    
  987. NECreset()
  988. {
  989. #ifdef vms
  990. X    fflush_binary();
  991. #endif
  992. }
  993. X
  994. X
  995. /* output file must be binary mode for nec_dump */
  996. nec_dump()
  997. {
  998. unsigned int x;
  999. unsigned int plane,offset;
  1000. int j;
  1001. unsigned int column8;
  1002. unsigned long column24;
  1003. char column3, column2, column1;
  1004. X    fprintf(outfile,"\033P\033l\005");  /* 10cpi, left margin 5 char */
  1005. X    for (j=(b_ysize/8)-1;j>=0;j--) {
  1006. X            fprintf(outfile,"\033J\030");  /* 24/180" line feed */
  1007. X            for (plane=0; plane<b_planes; plane++) {
  1008. X                offset=plane*b_psize;
  1009. X                if (b_planes>1) {
  1010. X                    /* select colour for plane */
  1011. X                    fprintf(outfile,"\033r");
  1012. X                    (void) fputc((char)necpcolor[plane],outfile);
  1013. X                }
  1014. X                /* select plotter graphics mode (square pixels) */
  1015. X                fprintf(outfile,"\r\033*\047");
  1016. X                (void) fputc((char)((b_xsize*3)%256),outfile);
  1017. X                (void) fputc((char)((b_xsize*3)/256),outfile);
  1018. X                for (x=0; x<b_xsize; x++) {
  1019. X                    column8= (unsigned int)(*((*b_p)[j+offset]+x));
  1020. X                    column24=0;
  1021. X                    if (column8&0x01) column24|=(long)0x000007;
  1022. X                    if (column8&0x02) column24|=(long)0x000038;
  1023. X                    if (column8&0x04) column24|=(long)0x0001c0;
  1024. X                    if (column8&0x08) column24|=(long)0x000e00;
  1025. X                    if (column8&0x10) column24|=(long)0x007000;
  1026. X                    if (column8&0x20) column24|=(long)0x038000;
  1027. X                    if (column8&0x40) column24|=(long)0x1c0000;
  1028. X                    if (column8&0x80) column24|=(long)0xe00000;
  1029. X                    column1 = (char) ( column24      & (long)0xff);
  1030. X                    column2 = (char) ((column24>>8)  & (long)0xff);
  1031. X                    column3 = (char) ((column24>>16) & (long)0xff);
  1032. X                    (void) fputc(column3,outfile);
  1033. X                    (void) fputc(column2,outfile);
  1034. X                    (void) fputc(column1,outfile);
  1035. X                    (void) fputc(column3,outfile);
  1036. X                    (void) fputc(column2,outfile);
  1037. X                    (void) fputc(column1,outfile);
  1038. X                    (void) fputc(column3,outfile);
  1039. X                    (void) fputc(column2,outfile);
  1040. X                    (void) fputc(column1,outfile);
  1041. X                }
  1042. X            }
  1043. X    }
  1044. X    fprintf(outfile,"\r\033l");
  1045. X    (void) fputc('\0',outfile);                /* set left margin to 0 */
  1046. X    if (b_planes > 1) {
  1047. X        fprintf(outfile,"\033r");
  1048. X        (void) fputc('\0',outfile);                /* set color to black */
  1049. X    }
  1050. #ifdef PC
  1051. X    fprintf(stderr,"Print using: COPY /B\n");
  1052. #endif
  1053. #ifdef vms
  1054. X    fflush_binary();
  1055. #endif
  1056. }
  1057. X
  1058. /* output file must be binary mode for nec_dump */
  1059. nec_draft_dump()
  1060. {
  1061. unsigned int x;
  1062. unsigned int plane,offset;
  1063. int j;
  1064. X    fprintf(outfile,"\033P\033l\005\r");  /* 10cpi, left margin 5 char */
  1065. X    for (j=(b_ysize/8)-1;j>=0;j--) {
  1066. X            fprintf(outfile,"\033J\030");  /* 24/180" line feed */
  1067. X            for (plane=0; plane<b_planes; plane++) {
  1068. X                offset=plane*b_psize;
  1069. X                if (b_planes>1) {
  1070. X                    /* select colour for plane */
  1071. X                    fprintf(outfile,"\033r");
  1072. X                    (void) fputc((char)necpcolor[plane],outfile);
  1073. X                }
  1074. X                /* select plotter graphics mode (square pixels) */
  1075. X                fprintf(outfile,"\r\033*");
  1076. X                (void) fputc('\0',outfile);
  1077. X                (void) fputc((char)(b_xsize%256),outfile);
  1078. X                (void) fputc((char)(b_xsize/256),outfile);
  1079. X                for (x=0; x<b_xsize; x++) {
  1080. X                    (void) fputc( (char)(*((*b_p)[j+offset]+x)), outfile );
  1081. X                }
  1082. X            }
  1083. X    }
  1084. X    fprintf(outfile,"\r\033l");
  1085. X    (void) fputc('\0',outfile);                /* set left margin to 0 */
  1086. X    if (b_planes > 1) {
  1087. X        fprintf(outfile,"\033r");
  1088. X        (void) fputc('\0',outfile);                /* set color to black */
  1089. X    }
  1090. #ifdef PC
  1091. X    fprintf(stderr,"Print using: COPY /B\n");
  1092. #endif
  1093. }
  1094. X
  1095. #endif /* NEC */
  1096. X
  1097. #ifdef STARC
  1098. /* The following Star color driver uses generic bit mapped graphics
  1099. X   routines to build up a bit map in memory. */
  1100. /* Star Color changes made by William Wilson, wew@naucse.cse.nau.edu */
  1101. /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
  1102. /* STARC_init changes outfile to binary mode on PC's */
  1103. X
  1104. #define STARCXMAX    512 
  1105. #define STARCYMAX    384
  1106. X
  1107. #define STARCXLAST (STARCXMAX - 1)
  1108. #define STARCYLAST (STARCYMAX - 1)
  1109. X
  1110. #define STARCVCHAR        FNT5X9_VCHAR      
  1111. #define STARCHCHAR        FNT5X9_HCHAR        
  1112. #define STARCVTIC        6
  1113. #define STARCHTIC        6
  1114. X
  1115. /* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
  1116. static unsigned int STARCcolor[] = {1,8,4,2,10,12,6,14};
  1117. static unsigned int STARCpcolor[]= {0,2,1,4};
  1118. X
  1119. STARCinit()
  1120. {
  1121. #ifdef PC
  1122. X    reopen_binary();
  1123. #endif
  1124. #ifdef vms
  1125. X    reopen_binary();
  1126. #endif
  1127. }
  1128. X
  1129. X
  1130. STARCgraphics()
  1131. {
  1132. X    b_charsize(FNT5X9);
  1133. X    b_makebitmap((unsigned int)(STARCXMAX*xsize),
  1134. X                 (unsigned int)(STARCYMAX*ysize),4);
  1135. }
  1136. X
  1137. X
  1138. STARCtext()
  1139. {
  1140. X    STARC_dump();
  1141. X    b_freebitmap();
  1142. }
  1143. X
  1144. STARClinetype(linetype)
  1145. int linetype;
  1146. {
  1147. X    if (linetype>=6)
  1148. X        linetype %= 6;
  1149. X    b_setvalue(STARCcolor[linetype+2]);
  1150. }
  1151. X
  1152. X
  1153. #define STARCmove b_move
  1154. #define STARCvector b_vector
  1155. #define STARCput_text b_put_text
  1156. #define STARC_text_angle b_text_angle
  1157. X
  1158. STARCreset()
  1159. {
  1160. #ifdef vms
  1161. X    fflush_binary();
  1162. #endif
  1163. }
  1164. X
  1165. X
  1166. /* output file must be binary mode for STARC_dump */
  1167. STARC_dump()
  1168. {
  1169. unsigned int x;
  1170. unsigned int plane,offset;
  1171. int j;
  1172. X    for (j=(b_ysize/8)-1;j>=0;j--) {
  1173. X        fprintf(outfile,"\033J\030");    /* line feed 8/72" = 8 dots */
  1174. X        for (plane=0; plane<b_planes; plane++) {
  1175. X            offset=plane*b_psize;
  1176. X            if (b_planes>1) {
  1177. X                /* select colour for plane */
  1178. X                fprintf(outfile,"\033r");
  1179. X                (void) fputc((char)STARCpcolor[plane],outfile);
  1180. X            }
  1181. X            /* select plotter graphics mode (square pixels) */
  1182. X            fprintf(outfile,"\r\033*\005");
  1183. X            (void) fputc((char)(b_xsize%256),outfile);
  1184. X            (void) fputc((char)(b_xsize/256),outfile);
  1185. X            for (x=0; x<b_xsize; x++) {
  1186. X                (void) fputc( (char)(*((*b_p)[j+offset]+x)), outfile );
  1187. X            }
  1188. X        }
  1189. X    }
  1190. X    if (b_planes > 1) {
  1191. X        fprintf(outfile,"\033r");
  1192. X        (void) fputc('\0',outfile);                /* set color to black */
  1193. X    }
  1194. #ifdef PC
  1195. X    fprintf(stderr,"Print using: COPY /B\n");
  1196. #endif
  1197. }
  1198. X
  1199. #endif /* STARC */
  1200. X
  1201. X
  1202. #ifdef EPS60
  1203. X
  1204. /* make the total dimensions 8 inches by 5 inches */
  1205. #define EPS60XMAX    480
  1206. #define EPS60YMAX    360
  1207. X
  1208. #define EPS60XLAST (EPS60XMAX - 1)
  1209. #define EPS60YLAST (EPS60YMAX - 1)
  1210. X
  1211. EPS60graphics()
  1212. {
  1213. X    b_charsize(FNT5X9);
  1214. X    b_makebitmap((unsigned int)(EPS60XMAX*xsize),
  1215. X                 (unsigned int)(EPS60YMAX*ysize),1);
  1216. }
  1217. X
  1218. X
  1219. EPS60text()
  1220. {
  1221. X    eps60_dump();
  1222. X    b_freebitmap();
  1223. }
  1224. X
  1225. X
  1226. X
  1227. /* output file must be binary mode for eps60_dump */
  1228. eps60_dump()
  1229. {
  1230. X  register unsigned int x;
  1231. X  int j;
  1232. X    fprintf(outfile,"\033%c\030",'3'); /* set line spacing 24/216" = 8 dots */
  1233. X    for (j=(b_ysize/8)-1; j>=0; j--) {
  1234. X        /* select printer graphics mode 'K' */
  1235. X        fprintf(outfile,"\r\n\033K");
  1236. X        (void) fputc((char)(b_xsize%256),outfile);
  1237. X        (void) fputc((char)(b_xsize/256),outfile);
  1238. X        for (x=0; x<b_xsize; x++) {
  1239. X            (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
  1240. X        }
  1241. X    }
  1242. X    fprintf(outfile,"\033%c\044\r\n",'3'); /* set line spacing 36/216" = 1/6" */
  1243. #ifdef PC
  1244. X    fprintf(stderr,"Print using: COPY /B\n");
  1245. #endif
  1246. }
  1247. X
  1248. #endif /* EPS60 */
  1249. X
  1250. #ifdef TANDY60
  1251. X
  1252. /* The only difference between TANDY60 and EPS60 is the inclusion
  1253. X   of codes to swap the Tandy printer into IBM mode and back
  1254. X   into Tandy mode.  For a Tandy already in IBM mode, use EPS60. */
  1255. X
  1256. X
  1257. TANDY60text()
  1258. {
  1259. #ifdef PC
  1260. X    fprintf(stderr, "Inserting Tandy/IBM mode conversion codes\n");
  1261. #endif
  1262. X    /* Switch to IBM mode, and leave 3 inches above the plot so as
  1263. X       to get rough vertical centring on the page.  Perform the
  1264. X       centring by setting 1" line feeds and issuing 3 of them. */
  1265. X    fprintf(outfile, "\033!\033%c%c\n\n\n", '3',216);
  1266. X    eps60_dump();
  1267. X    b_freebitmap();
  1268. X    /* A form feed must be sent before switching back to Tandy mode,
  1269. X       or else the form setting will be messed up. */
  1270. X    fprintf(outfile, "\f\033!");
  1271. }
  1272. X
  1273. X
  1274. #endif  /* TANDY60 */
  1275. SHAR_EOF
  1276. chmod 0666 gnuplot/term/epson.trm ||
  1277. echo 'restore of gnuplot/term/epson.trm failed'
  1278. Wc_c="`wc -c < 'gnuplot/term/epson.trm'`"
  1279. test 11330 -eq "$Wc_c" ||
  1280.     echo 'gnuplot/term/epson.trm: original size 11330, current size' "$Wc_c"
  1281. rm -f _shar_wnt_.tmp
  1282. fi
  1283. # ============= gnuplot/term/fig.trm ==============
  1284. if test -f 'gnuplot/term/fig.trm' -a X"$1" != X"-c"; then
  1285.     echo 'x - skipping gnuplot/term/fig.trm (File already exists)'
  1286.     rm -f _shar_wnt_.tmp
  1287. else
  1288. > _shar_wnt_.tmp
  1289. echo 'x - extracting gnuplot/term/fig.trm (Text)'
  1290. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/fig.trm' &&
  1291. /* GNUPLOT - fig.trm */
  1292. /*
  1293. X * Copyright (C) 1990
  1294. X *
  1295. X * Permission to use, copy, and distribute this software and its
  1296. X * documentation for any purpose with or without fee is hereby granted,
  1297. X * provided that the above copyright notice appear in all copies and
  1298. X * that both that copyright notice and this permission notice appear
  1299. X * in supporting documentation.
  1300. X *
  1301. X * Permission to modify the software is granted, but not the right to
  1302. X * distribute the modified code.  Modifications are to be distributed
  1303. X * as patches to released version.
  1304. X *
  1305. X * This software  is provided "as is" without express or implied warranty.
  1306. X *
  1307. X * This file is included by ../term.c.
  1308. X *
  1309. X * This terminal driver supports:
  1310. X *  Fig graphics language
  1311. X *
  1312. X * AUTHORS
  1313. X *  Micah Beck, David Kotz
  1314. X *
  1315. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  1316. X *
  1317. X */
  1318. X
  1319. #ifdef MSDOS
  1320. #define long int
  1321. #endif /* MSDOS */
  1322. X
  1323. /*
  1324. X * Original for Fig code output by Micah Beck, 1989
  1325. X * Department of Computer Science, Cornell University
  1326. X * Updated by David Kotz for gnuplot 2.0
  1327. X * More efficient output Ian by Dall
  1328. X */
  1329. #include "object.h"                     /* from the TransFig distribution */
  1330. #define FIG_DEFAULT (-1)
  1331. #define FIG_ROMAN_FONT (0)
  1332. #ifndef FIG_RES
  1333. /* Must be 80 for the Fig editor, but may be increased if used
  1334. X * only by TransFig filters.
  1335. X * Represents resolution per inch.
  1336. X */
  1337. #define FIG_RES         80
  1338. #endif
  1339. #define FIG_COORD_SYS   2
  1340. #define FIG_MAGIC       "#FIG 1.4-TFX"
  1341. #define FIG_HTIC        (5*FIG_RES/80)
  1342. #define FIG_VTIC        (5*FIG_RES/80)
  1343. #define FIG_FONT_S      FIG_DEFAULT
  1344. #define FIG_HCHAR       (6*FIG_RES/80) /* Change if FIG_FONT_S is changed */
  1345. #define FIG_VCHAR       (12*FIG_RES/80) /* Change if FIG_FONT_S is changed */
  1346. #define FIG_ARROW_WIDTH FIG_HTIC
  1347. #define FIG_ARROW_HEIGHT FIG_HTIC
  1348. static long FIG_xbase = FIG_RES/2;
  1349. static long FIG_ybase = FIG_RES/2;
  1350. static long FIG_posx;
  1351. static long FIG_posy;
  1352. static int FIG_poly_vec_cnt;
  1353. enum FIG_poly_stat {FIG_poly_new, FIG_poly_part};
  1354. static enum FIG_poly_stat FIG_polyvec_stat;
  1355. /* 5 inches wide by 3 inches high */
  1356. #define FIG_XMAX (5 * FIG_RES)
  1357. #define FIG_YMAX (3 * FIG_RES)
  1358. #define FIG_XOFF (FIG_RES/4)
  1359. #define FIG_YOFF (FIG_RES/4)
  1360. static int FIG_type;            /* negative types use real lines */
  1361. static float FIG_spacing;       /* length of dash or dot spacing */
  1362. static int FIG_justify;         /* Fig justification T_*_JUSTIFIED */
  1363. static float FIG_angle;         /* Fig text angle 0=horiz, Pi/2=vert */
  1364. #define FIG_POINT_TYPES POINT_TYPES /* we use the same points */
  1365. static
  1366. X  FIG_poly_clean(stat)
  1367. enum FIG_poly_stat stat;
  1368. {
  1369. X  if(stat == FIG_poly_part)
  1370. X        fprintf(outfile, " 9999 9999\n");
  1371. X  FIG_polyvec_stat = FIG_poly_new;
  1372. }
  1373. FIG_init()
  1374. {
  1375. X    FIG_posx = FIG_posy = 0;
  1376. X    FIG_polyvec_stat = FIG_poly_new;
  1377. X    FIG_linetype(-1);
  1378. X    FIG_justify_text(LEFT);
  1379. X    FIG_text_angle(0);
  1380. X    fprintf(outfile, "%s\n", FIG_MAGIC);
  1381. X    fprintf(outfile, "%d %d\n", FIG_RES, FIG_COORD_SYS);
  1382. }
  1383. FIG_graphics()
  1384. {
  1385. X    FIG_posx = FIG_posy = 0;
  1386. X    FIG_polyvec_stat = FIG_poly_new;
  1387. X    /* there is no way to have separate pictures in a FIG file */
  1388. }
  1389. FIG_text()
  1390. {
  1391. X    /* there is no way to have separate pictures in a FIG file */
  1392. X    FIG_poly_clean(FIG_polyvec_stat);
  1393. X    FIG_posx = FIG_posy = 0;
  1394. X    fflush(outfile);
  1395. }
  1396. /* Line types for FIG work like this:
  1397. X *  -2 : solid (border)
  1398. X *  -1 : dashed 4 (axes)
  1399. X *   0 : solid (first curve)
  1400. X *   1 : dotted 3
  1401. X *   2 : dashed 3
  1402. X *   3 : dotted 6
  1403. X *   4 : dashed 6
  1404. X *   ... ...
  1405. X */
  1406. FIG_linetype(linetype)
  1407. X        int linetype;                   /* expect linetype >= -2 */
  1408. {
  1409. X    int last_FIG_type = FIG_type;
  1410. X    int last_FIG_spacing = FIG_spacing;
  1411. X    switch (linetype) {
  1412. X           case 0:
  1413. X           case -2: {
  1414. X                  FIG_type = 0; /* solid line */
  1415. X                  FIG_spacing = 0.0;
  1416. X                  break;
  1417. X           }
  1418. X           case -1: {
  1419. X                  FIG_type = 1; /* dashed */
  1420. X                  FIG_spacing = 4.0; /* dash length */
  1421. X                  break;
  1422. X           }
  1423. X           default: {
  1424. X                  linetype = abs(linetype); /* shouldn't be negative anyway */
  1425. X                  /* now linetype >= 1 */
  1426. X                  FIG_type = linetype % 2 + 1; /* dotted, dashed, ... */
  1427. X                  FIG_spacing = (linetype+1) / 2 * 3;
  1428. X                  break;
  1429. X           }
  1430. X    }
  1431. X    if (FIG_type != last_FIG_type || FIG_spacing != last_FIG_spacing)
  1432. X      FIG_poly_clean(FIG_polyvec_stat);
  1433. }
  1434. FIG_move(x,y)
  1435. X        unsigned int x,y;
  1436. {
  1437. X    int last_FIG_posx = FIG_posx;
  1438. X    int last_FIG_posy = FIG_posy;
  1439. X    FIG_posx = x;
  1440. X    FIG_posy = y;
  1441. X    if (FIG_posx != last_FIG_posx || FIG_posy != last_FIG_posy)
  1442. X          FIG_poly_clean(FIG_polyvec_stat);
  1443. }
  1444. FIG_vector(ux,uy)
  1445. X     unsigned int ux,uy;
  1446. {
  1447. X  int x=ux, y=uy;
  1448. X  if (FIG_polyvec_stat != FIG_poly_part)
  1449. X    {
  1450. X      fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
  1451. X              O_POLYLINE, T_POLYLINE,
  1452. X              FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
  1453. X              0, 0);
  1454. X      fprintf(outfile, "%d %d",
  1455. X              FIG_XOFF + FIG_posx, FIG_YMAX + FIG_YOFF - FIG_posy);
  1456. X      FIG_poly_vec_cnt = 1;
  1457. X      FIG_polyvec_stat = FIG_poly_part;
  1458. X    }
  1459. X  fprintf(outfile, " %d %d",
  1460. X          FIG_XOFF +  x, FIG_YMAX + FIG_YOFF-y);
  1461. X  FIG_poly_vec_cnt++;
  1462. X  if (FIG_poly_vec_cnt > 50)
  1463. X    FIG_poly_clean(FIG_polyvec_stat);
  1464. X  FIG_posx = x;
  1465. X  FIG_posy = y;
  1466. }
  1467. FIG_arrow(sx, sy, ex, ey, head)
  1468. X        int sx, sy;     /* start coord */
  1469. X        int ex, ey;     /* end coord */
  1470. X    BOOLEAN head;
  1471. {
  1472. X    FIG_poly_clean(FIG_polyvec_stat);
  1473. X        fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
  1474. X                O_POLYLINE, T_POLYLINE,
  1475. X                FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
  1476. X                head ? 1 : 0, 0);
  1477. X        /* arrow line */
  1478. X    if ( head )
  1479. X            fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
  1480. X                    0, 0, 1.0,
  1481. X            (double)FIG_ARROW_WIDTH, (double)FIG_ARROW_HEIGHT);
  1482. X        fprintf(outfile, "%d %d %d %d 9999 9999\n",
  1483. X                FIG_XOFF + sx, FIG_YOFF + FIG_YMAX - sy,
  1484. X        FIG_XOFF + ex, FIG_YOFF + FIG_YMAX - ey);
  1485. X        FIG_posx = ex;
  1486. X        FIG_posy = ey;
  1487. }
  1488. FIG_put_text(x, y, str)
  1489. X        int x, y;
  1490. X        char *str;
  1491. {
  1492. X  if (strlen(str) == 0) return;
  1493. X  FIG_poly_clean(FIG_polyvec_stat);
  1494. X    y = y - FIG_VCHAR/2;                /* assuming vertical center justified */
  1495. X    fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
  1496. X                  O_TEXT, FIG_justify,
  1497. X                  FIG_ROMAN_FONT, FIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_angle,
  1498. X                  FIG_DEFAULT, FIG_VCHAR, FIG_HCHAR*strlen(str), FIG_XOFF + x,
  1499. X        FIG_YMAX + FIG_YOFF-y, str);
  1500. }
  1501. int FIG_justify_text(mode)
  1502. X        enum JUSTIFY mode;
  1503. {
  1504. X    switch(mode) {
  1505. X           case LEFT: FIG_justify = T_LEFT_JUSTIFIED; break;
  1506. X           case CENTRE: FIG_justify = T_CENTER_JUSTIFIED; break;
  1507. X           case RIGHT: FIG_justify = T_RIGHT_JUSTIFIED; break;
  1508. X           /* shouldn't happen */
  1509. X           default: FIG_justify = T_LEFT_JUSTIFIED; break;
  1510. X    }
  1511. X    return (TRUE);
  1512. }
  1513. int FIG_text_angle(angle)
  1514. X        int angle;
  1515. {
  1516. X    if (angle)
  1517. X         FIG_angle = Pi / 2.0;  /* vertical is pi/2 radians */
  1518. X    else
  1519. X         FIG_angle = 0.0;               /* horizontal */
  1520. X    return (TRUE);
  1521. }
  1522. FIG_reset()
  1523. {
  1524. X    FIG_poly_clean(FIG_polyvec_stat);
  1525. X    FIG_posx = FIG_posy = 0;
  1526. X    fflush(outfile);
  1527. }
  1528. X
  1529. #ifdef MSDOS
  1530. #undef long
  1531. #endif /* MSDOS */
  1532. SHAR_EOF
  1533. chmod 0644 gnuplot/term/fig.trm ||
  1534. echo 'restore of gnuplot/term/fig.trm failed'
  1535. Wc_c="`wc -c < 'gnuplot/term/fig.trm'`"
  1536. test 7494 -eq "$Wc_c" ||
  1537.     echo 'gnuplot/term/fig.trm: original size 7494, current size' "$Wc_c"
  1538. rm -f _shar_wnt_.tmp
  1539. fi
  1540. # ============= gnuplot/term/hp26.trm ==============
  1541. if test -f 'gnuplot/term/hp26.trm' -a X"$1" != X"-c"; then
  1542.     echo 'x - skipping gnuplot/term/hp26.trm (File already exists)'
  1543.     rm -f _shar_wnt_.tmp
  1544. else
  1545. > _shar_wnt_.tmp
  1546. echo 'x - extracting gnuplot/term/hp26.trm (Text)'
  1547. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/hp26.trm' &&
  1548. /* GNUPLOT - hp26.trm */
  1549. /*
  1550. X * Copyright (C) 1990   
  1551. X *
  1552. X * Permission to use, copy, and distribute this software and its
  1553. X * documentation for any purpose with or without fee is hereby granted, 
  1554. X * provided that the above copyright notice appear in all copies and 
  1555. X * that both that copyright notice and this permission notice appear 
  1556. X * in supporting documentation.
  1557. X *
  1558. X * Permission to modify the software is granted, but not the right to
  1559. X * distribute the modified code.  Modifications are to be distributed 
  1560. X * as patches to released version.
  1561. X *  
  1562. X * This software  is provided "as is" without express or implied warranty.
  1563. X * 
  1564. X * This file is included by ../term.c.
  1565. X *
  1566. X * This terminal driver supports:
  1567. X *  HP2623A 
  1568. X *
  1569. X * AUTHORS
  1570. X *   hplvlch!ch (Chuck Heller) 
  1571. X * 
  1572. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  1573. X * 
  1574. X */
  1575. X
  1576. X
  1577. #define HP26_XMAX 512
  1578. #define HP26_YMAX 390
  1579. X
  1580. #define HP26_XLAST (HP26_XMAX - 1)
  1581. #define HP26_YLAST (HP26_XMAX - 1)
  1582. X
  1583. /* Assume a character size of 1, or a 7 x 10 grid. */
  1584. #define HP26_VCHAR    10
  1585. #define HP26_HCHAR    7
  1586. #define HP26_VTIC    (HP26_YMAX/70)        
  1587. #define HP26_HTIC    (HP26_XMAX/75)        
  1588. X
  1589. HP26_init()
  1590. {
  1591. X    /*    The HP2623A needs no initialization. */
  1592. }
  1593. X
  1594. X
  1595. HP26_graphics()
  1596. {
  1597. X    /*    Clear and enable the display */
  1598. X
  1599. X    fputs("\033*daZ\033*dcZ",outfile);
  1600. }
  1601. X
  1602. X
  1603. HP26_text()
  1604. {
  1605. X    fputs("\033*dT",outfile);    /* back to text mode */
  1606. }
  1607. X
  1608. X
  1609. HP26_linetype(linetype)
  1610. int linetype;
  1611. {
  1612. #define    SOLID    1
  1613. #define LINE4    4
  1614. #define LINE5    5
  1615. #define LINE6    6
  1616. #define LINE8    8
  1617. #define    DOTS    7
  1618. #define LINE9    9
  1619. #define LINE10    10
  1620. X
  1621. static int map[2+9] = {    SOLID,    /* border */
  1622. X                        SOLID,    /* axes */
  1623. X                        DOTS,    /* plot 0 */
  1624. X                        LINE4,    /* plot 1 */
  1625. X                        LINE5,    /* plot 2 */
  1626. X                        LINE6,    /* plot 3 */
  1627. X                        LINE8,    /* plot 4 */
  1628. X                        LINE9,    /* plot 5 */
  1629. X                        LINE10,    /* plot 6 */
  1630. X                        SOLID,    /* plot 7 */
  1631. X                        SOLID    /* plot 8 */ };
  1632. X
  1633. X    if (linetype >= 9)
  1634. X        linetype %= 9;
  1635. X    fprintf(outfile,"\033*m%dB",map[linetype + 2]);
  1636. }
  1637. X
  1638. X
  1639. HP26_move(x,y)
  1640. int x,y;
  1641. {
  1642. X    fprintf(outfile,"\033*pa%d,%dZ",x,y);
  1643. }
  1644. X
  1645. X
  1646. HP26_vector(x,y)
  1647. int x,y;
  1648. {
  1649. X    fprintf(outfile,"\033*pb%d,%dZ",x,y);
  1650. }
  1651. X
  1652. X
  1653. HP26_put_text(x,y,str)
  1654. int x, y;
  1655. char *str;
  1656. {
  1657. X    HP26_move(x,y - HP26_VCHAR/2);
  1658. X    fputs("\033*dS",outfile);
  1659. X    fprintf(outfile,"\033*m3Q\033*l%s\n",str);
  1660. X    fputs("\033*dT",outfile);
  1661. }
  1662. X
  1663. X
  1664. X
  1665. HP26_reset()
  1666. {
  1667. }
  1668. X
  1669. SHAR_EOF
  1670. chmod 0666 gnuplot/term/hp26.trm ||
  1671. echo 'restore of gnuplot/term/hp26.trm failed'
  1672. Wc_c="`wc -c < 'gnuplot/term/hp26.trm'`"
  1673. test 2262 -eq "$Wc_c" ||
  1674.     echo 'gnuplot/term/hp26.trm: original size 2262, current size' "$Wc_c"
  1675. rm -f _shar_wnt_.tmp
  1676. fi
  1677. # ============= gnuplot/term/hp2648.trm ==============
  1678. if test -f 'gnuplot/term/hp2648.trm' -a X"$1" != X"-c"; then
  1679.     echo 'x - skipping gnuplot/term/hp2648.trm (File already exists)'
  1680.     rm -f _shar_wnt_.tmp
  1681. else
  1682. > _shar_wnt_.tmp
  1683. echo 'x - extracting gnuplot/term/hp2648.trm (Text)'
  1684. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/hp2648.trm' &&
  1685. /* GNUPLOT -  hp2648.trm */
  1686. /*
  1687. X * Copyright (C) 1990   
  1688. X *
  1689. X * Permission to use, copy, and distribute this software and its
  1690. X * documentation for any purpose with or without fee is hereby granted, 
  1691. X * provided that the above copyright notice appear in all copies and 
  1692. X * that both that copyright notice and this permission notice appear 
  1693. X * in supporting documentation.
  1694. X *
  1695. X * Permission to modify the software is granted, but not the right to
  1696. X * distribute the modified code.  Modifications are to be distributed 
  1697. X * as patches to released version.
  1698. X *  
  1699. X * This software  is provided "as is" without express or implied warranty.
  1700. X * 
  1701. X * This file is included by ../term.c.
  1702. X *
  1703. X * This terminal driver supports:
  1704. X *  HP2648 and HP2647
  1705. X *
  1706. X * AUTHORS
  1707. X *  Russell Lang
  1708. X * 
  1709. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  1710. X * 
  1711. X */
  1712. X
  1713. #define HP2648XMAX 720             
  1714. #define HP2648YMAX 360
  1715. X
  1716. #define HP2648XLAST (HP2648XMAX - 1)
  1717. #define HP2648YLAST (HP2648YMAX - 1)
  1718. X
  1719. #define HP2648VCHAR        12      
  1720. #define HP2648HCHAR        7        
  1721. #define HP2648VTIC        8
  1722. #define HP2648HTIC        8
  1723. X
  1724. X
  1725. HP2648init()
  1726. {
  1727. X    fprintf(outfile,"\033*m1m1n136,1cZ");
  1728. /*                   1     2 3     4
  1729. X    1. mode
  1730. X    2. textsize=1
  1731. X    3. textangle=1
  1732. X        4. define line type 2 to be *   *   *   * etc.
  1733. */
  1734. }
  1735. X
  1736. X
  1737. HP2648graphics()
  1738. {
  1739. X    fprintf(outfile,"\033*dacZ");
  1740. /*                   1     23
  1741. X    1. mode
  1742. X    2. clear grahics screen
  1743. X    3. graphics video on
  1744. */
  1745. }
  1746. X
  1747. X
  1748. HP2648text()
  1749. {
  1750. }
  1751. X
  1752. X
  1753. HP2648linetype(linetype)
  1754. int linetype;
  1755. {
  1756. X    static int hpline[] = {1,7,1,4,5,6,8,9,10,7,2};
  1757. X    fprintf(outfile,"\033*m%dbZ",hpline[(linetype+2)%11]);
  1758. }
  1759. X
  1760. X
  1761. HP2648move(x,y)
  1762. int x,y;
  1763. {
  1764. X    fprintf(outfile,"\033*paf%d,%dZ",x,y);
  1765. X    /*               1     23     4
  1766. X    1    plot mode
  1767. X    2    "pen up"
  1768. X    3    goto absolute x,y
  1769. X    4    end command
  1770. X    */
  1771. }
  1772. X
  1773. X
  1774. HP2648vector(x,y)
  1775. int x,y;
  1776. {
  1777. X    fprintf(outfile,"\033*pbf%d,%dZ",x,y);
  1778. X    /*                     1 
  1779. X    1    "pen down"
  1780. X    */
  1781. }
  1782. X
  1783. X
  1784. HP2648put_text(x,y,str)
  1785. int x, y;
  1786. char *str;
  1787. {
  1788. X    HP2648move(x,y-HP2648VCHAR/2 + 1);
  1789. X    fprintf(outfile,"\033*l%s\n",str);
  1790. }
  1791. X
  1792. X
  1793. int HP2648_text_angle(ang)
  1794. int ang;
  1795. {
  1796. X    fprintf(outfile,"\033*m%dnZ\n",ang+1);
  1797. X    return TRUE;
  1798. }
  1799. X    
  1800. HP2648reset()
  1801. {
  1802. }
  1803. X
  1804. SHAR_EOF
  1805. chmod 0666 gnuplot/term/hp2648.trm ||
  1806. echo 'restore of gnuplot/term/hp2648.trm failed'
  1807. Wc_c="`wc -c < 'gnuplot/term/hp2648.trm'`"
  1808. test 2113 -eq "$Wc_c" ||
  1809.     echo 'gnuplot/term/hp2648.trm: original size 2113, current size' "$Wc_c"
  1810. rm -f _shar_wnt_.tmp
  1811. fi
  1812. # ============= gnuplot/term/hpgl.trm ==============
  1813. if test -f 'gnuplot/term/hpgl.trm' -a X"$1" != X"-c"; then
  1814.     echo 'x - skipping gnuplot/term/hpgl.trm (File already exists)'
  1815.     rm -f _shar_wnt_.tmp
  1816. else
  1817. > _shar_wnt_.tmp
  1818. echo 'x - extracting gnuplot/term/hpgl.trm (Text)'
  1819. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/hpgl.trm' &&
  1820. /* GNUPLOT - hpgl.trm */
  1821. /*
  1822. X * Copyright (C) 1990   
  1823. X *
  1824. X * Permission to use, copy, and distribute this software and its
  1825. X * documentation for any purpose with or without fee is hereby granted, 
  1826. X * provided that the above copyright notice appear in all copies and 
  1827. X * that both that copyright notice and this permission notice appear 
  1828. X * in supporting documentation.
  1829. X *
  1830. X * Permission to modify the software is granted, but not the right to
  1831. X * distribute the modified code.  Modifications are to be distributed 
  1832. X * as patches to released version.
  1833. X *  
  1834. X * This software  is provided "as is" without express or implied warranty.
  1835. X * 
  1836. X * This file is included by ../term.c.
  1837. X *
  1838. X * This terminal driver supports:
  1839. X *  hpgl, hp7580b, HP Laserjet III
  1840. X *
  1841. X * AUTHORS
  1842. X *  Colin Kelley, Thomas Williams, Russell Lang
  1843. X * 
  1844. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  1845. X * 
  1846. X */
  1847. X
  1848. #define HPGL_XMAX 15200
  1849. #define HPGL_YMAX 10000
  1850. X
  1851. #define HPGL_XLAST (HPGL_XMAX - 1)
  1852. #define HPGL_YLAST (HPGL_XMAX - 1)
  1853. X
  1854. /* HPGL_VCHAR, HPGL_HCHAR  are not used */
  1855. #define HPGL_VCHAR    (HPGL_YMAX/100*32/10) /* 3.2% */
  1856. #define HPGL_HCHAR    (HPGL_XMAX/100*12/10) /* 1.2% */
  1857. #define HPGL_VTIC    (HPGL_YMAX/70)        
  1858. #define HPGL_HTIC    (HPGL_YMAX/70)        
  1859. X
  1860. int HPGL_ang = 0;
  1861. X
  1862. HPGL_init()
  1863. {
  1864. X    fputs("\033.Y\n",outfile);
  1865. /*           1
  1866. X    1. enable eavesdropping
  1867. */
  1868. }
  1869. X
  1870. HPLJIII_PORT_init()
  1871. {
  1872. X      fputs("\033E\033&l1X\033&l0O\033%0B;PW0.15\n",outfile);
  1873. }
  1874. X
  1875. HPLJIII_LAND_init()
  1876. {
  1877. X    fputs("\033E\033&l1X\033&l1O\033%0B;PW0.15\n",outfile);
  1878. }
  1879. X
  1880. X
  1881. HPGL_graphics()
  1882. {
  1883. X    fprintf(outfile,
  1884. X    "IN;\nSC0,%d,0,%d;\nSR%f,%f;\n",
  1885. X        HPGL_XMAX,HPGL_YMAX,
  1886. X        ((double)(HPGL_HCHAR)*200/3/HPGL_XMAX),
  1887. X        ((double)(HPGL_VCHAR)*100/2/HPGL_YMAX) );
  1888. /*     1    2             3 
  1889. X    1. reset to power-up defaults
  1890. X    2. set SCaling
  1891. X    3. set character size
  1892. */
  1893. X    HPGL_ang = 0;
  1894. }
  1895. X
  1896. X
  1897. HPGL_text()
  1898. {
  1899. X    fputs("PU;\nSP0;\n\033.Z\0",outfile);
  1900. /*           1    2     3
  1901. X    1. pen up
  1902. X    2. park pen
  1903. X    3. disable eavesdropping
  1904. */
  1905. }
  1906. X
  1907. X
  1908. HPGL_linetype(linetype)
  1909. int linetype;
  1910. {
  1911. /* allow for 6 pens */
  1912. X    fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%6+1); 
  1913. }
  1914. X
  1915. X
  1916. HP75_linetype(linetype)
  1917. int linetype;
  1918. {
  1919. /* allow for 4 pens */
  1920. X    fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%4+1); 
  1921. }
  1922. X
  1923. X
  1924. /* some early HPGL plotters (e.g. HP7220C) require the
  1925. X * Pen Up/Down and Pen (move) Absolute commands to be separate
  1926. X */
  1927. HPGL_move(x,y)
  1928. int x,y;
  1929. {
  1930. X    fprintf(outfile,"PU;PA%d,%d;\n",x,y);
  1931. }
  1932. X
  1933. X
  1934. HPGL_vector(x,y)
  1935. int x,y;
  1936. {
  1937. X    fprintf(outfile,"PD;PA%d,%d;\n",x,y);
  1938. }
  1939. X
  1940. X
  1941. HPGL_put_text(x,y,str)
  1942. int x, y;
  1943. char *str;
  1944. {
  1945. X    if (HPGL_ang == 1)
  1946. X        HPGL_move(x + HPGL_VCHAR/4,y);
  1947. X    else
  1948. X        HPGL_move(x,y - HPGL_VCHAR/4);
  1949. X    fprintf(outfile,"LB%s\003\n",str);
  1950. }
  1951. X
  1952. X
  1953. int HPGL_text_angle(ang)
  1954. int ang;
  1955. {
  1956. X    HPGL_ang = ang;
  1957. X    if (ang == 1)
  1958. X        /* vertical */
  1959. X        fprintf(outfile,"DI0,1;\n");
  1960. X    else
  1961. X        /* horizontal */
  1962. X        fprintf(outfile,"DI1,0;\n");
  1963. X    return TRUE;
  1964. }
  1965. X
  1966. X
  1967. HPGL_reset()
  1968. {
  1969. }
  1970. X
  1971. HPLJIII_reset()
  1972. {
  1973. X    fputs("\033E\n",outfile);
  1974. }
  1975. SHAR_EOF
  1976. chmod 0644 gnuplot/term/hpgl.trm ||
  1977. echo 'restore of gnuplot/term/hpgl.trm failed'
  1978. Wc_c="`wc -c < 'gnuplot/term/hpgl.trm'`"
  1979. test 2857 -eq "$Wc_c" ||
  1980.     echo 'gnuplot/term/hpgl.trm: original size 2857, current size' "$Wc_c"
  1981. rm -f _shar_wnt_.tmp
  1982. fi
  1983. # ============= gnuplot/term/hpljii.trm ==============
  1984. if test -f 'gnuplot/term/hpljii.trm' -a X"$1" != X"-c"; then
  1985.     echo 'x - skipping gnuplot/term/hpljii.trm (File already exists)'
  1986.     rm -f _shar_wnt_.tmp
  1987. else
  1988. > _shar_wnt_.tmp
  1989. echo 'x - extracting gnuplot/term/hpljii.trm (Text)'
  1990. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/hpljii.trm' &&
  1991. /* GNUPLOT - hpljii.trm */
  1992. SHAR_EOF
  1993. true || echo 'restore of gnuplot/term/hpljii.trm failed'
  1994. fi
  1995. echo 'End of  part 15'
  1996. echo 'File gnuplot/term/hpljii.trm is continued in part 16'
  1997. echo 16 > _shar_seq_.tmp
  1998. exit 0
  1999.  
  2000. exit 0 # Just in case...
  2001. -- 
  2002. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  2003. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  2004. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  2005. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  2006.