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

  1. Newsgroups: comp.sources.misc
  2. From: gershon%gr@cs.utah.edu (Elber Gershon)
  3. Subject:  v24i040:  gnuplot3 - interactive function plotting utility, Part18/26
  4. Message-ID: <1991Oct28.002342.12603@sparky.imd.sterling.com>
  5. X-Md4-Signature: f174e0f3272f7425b1b51e2304a17260
  6. Date: Mon, 28 Oct 1991 00:23:42 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 40
  11. Archive-name: gnuplot3/part18
  12. Environment: UNIX, MS-DOS, VMS
  13. Supersedes: gnuplot2: Volume 11, Issue 65-79
  14.  
  15. #!/bin/sh
  16. # this is Part.18 (part 18 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file gnuplot/term/dxf.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" != 18; 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/dxf.trm'
  34. else
  35. echo 'x - continuing file gnuplot/term/dxf.trm'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term/dxf.trm' &&
  37. X
  38. X    stl = 0; while (str[stl] != '\0') ++stl; /* get string length */
  39. X
  40. X    if (vector_was_last) fprintf(outfile,"  0\nSEQEND\n");
  41. X    vector_was_last = FALSE;
  42. X    fprintf(outfile,"  0\nTEXT\n  8\n%s\n",layer_name[TEXT_LAYER]);
  43. X    if (dxf_angle != 90.0)
  44. X    {
  45. X       switch (dxf_justify)
  46. X       {
  47. X           case LEFT  : xleftpos = (float) x;
  48. X                 yleftpos = (float)(y-DXF_VCHAR/4.0);
  49. X                 xrightpos = (float)(x+stl*DXF_TEXTWIDTH);
  50. X                 yrightpos = yleftpos; break;
  51. X           case RIGHT : xleftpos = (float)(x-stl*DXF_TEXTWIDTH);
  52. X                 yleftpos = (float)(y-DXF_VCHAR/4.0);
  53. X                 xrightpos = (float) x;
  54. X                 yrightpos = yleftpos; break;
  55. X        case CENTRE: xleftpos = (float)(x-stl*DXF_TEXTWIDTH/2.0);
  56. X                 yleftpos = (float)(y-DXF_VCHAR/4.0);
  57. X                 xrightpos = (float) x;  /* center point */
  58. X                 yrightpos = yleftpos;
  59. X                 break;
  60. X        }
  61. X    }
  62. X    else
  63. X    {
  64. X        switch (dxf_justify)
  65. X        {
  66. X           case LEFT  : xleftpos = (float)(x+DXF_VCHAR/4.0);
  67. X                 yleftpos = (float) y;
  68. X                 xrightpos = xleftpos;
  69. X                 yrightpos = (float)(y+stl*DXF_TEXTWIDTH); break;
  70. X           case RIGHT : xleftpos = (float)(x+DXF_VCHAR/4.0);
  71. X                 yleftpos = (float)(y-stl*DXF_HCHAR);
  72. X                 xrightpos = xleftpos;
  73. X                 yrightpos = (float) y; break;
  74. X        case CENTRE: xleftpos = (float)(x+DXF_VCHAR/4.0);
  75. X                 yleftpos = (float)(y-stl*DXF_TEXTWIDTH/2.0);
  76. X                 xrightpos = xleftpos;
  77. X                 yrightpos = (float) y;  /* center point */
  78. X                 break;
  79. X        }
  80. X    }
  81. X    fprintf(outfile," 10\n%-6.3f\n 20\n%-6.3f\n 30\n0.000\n",
  82. X                xleftpos/DXF_UNIT,yleftpos/DXF_UNIT);
  83. X    fprintf(outfile," 40\n%-6.3f\n  1\n%s\n 50\n%-6.3f\n",
  84. X            DXF_TEXTHEIGHT/DXF_UNIT,str,dxf_angle);
  85. X    fprintf(outfile,"  7\n%s\n",text_style);
  86. X    if (dxf_justify != LEFT)
  87. X    {
  88. X        fprintf(outfile," 72\n%d\n",dxf_justify);
  89. X        fprintf(outfile," 11\n%-6.3f\n 21\n%-6.3f\n 31\n0.000\n",
  90. X                xrightpos/DXF_UNIT,yrightpos/DXF_UNIT);
  91. X    }
  92. }
  93. X
  94. DXF_text_angle(angle)
  95. X    int angle;
  96. {
  97. X    dxf_angle = 0.0;
  98. X    if (angle == 1) dxf_angle = 90.0;
  99. X    return(TRUE);
  100. }
  101. X
  102. DXF_justify_text(mode)
  103. X    enum JUSTIFY mode;
  104. {
  105. X    dxf_justify = mode;
  106. X    return(TRUE);
  107. }
  108. X
  109. DXF_reset()
  110. {
  111. X    DXF_posx = DXF_posy = 0;
  112. }
  113. X
  114. X
  115. SHAR_EOF
  116. echo 'File gnuplot/term/dxf.trm is complete' &&
  117. chmod 0644 gnuplot/term/dxf.trm ||
  118. echo 'restore of gnuplot/term/dxf.trm failed'
  119. Wc_c="`wc -c < 'gnuplot/term/dxf.trm'`"
  120. test 9980 -eq "$Wc_c" ||
  121.     echo 'gnuplot/term/dxf.trm: original size 9980, current size' "$Wc_c"
  122. rm -f _shar_wnt_.tmp
  123. fi
  124. # ============= gnuplot/term/qms.trm ==============
  125. if test -f 'gnuplot/term/qms.trm' -a X"$1" != X"-c"; then
  126.     echo 'x - skipping gnuplot/term/qms.trm (File already exists)'
  127.     rm -f _shar_wnt_.tmp
  128. else
  129. > _shar_wnt_.tmp
  130. echo 'x - extracting gnuplot/term/qms.trm (Text)'
  131. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/qms.trm' &&
  132. /* GNUPLOT - qms.trm */
  133. /*
  134. X * Copyright (C) 1990   
  135. X *
  136. X * Permission to use, copy, and distribute this software and its
  137. X * documentation for any purpose with or without fee is hereby granted, 
  138. X * provided that the above copyright notice appear in all copies and 
  139. X * that both that copyright notice and this permission notice appear 
  140. X * in supporting documentation.
  141. X *
  142. X * Permission to modify the software is granted, but not the right to
  143. X * distribute the modified code.  Modifications are to be distributed 
  144. X * as patches to released version.
  145. X *  
  146. X * This software  is provided "as is" without express or implied warranty.
  147. X * 
  148. X * This file is included by ../term.c.
  149. X *
  150. X * This terminal driver supports:
  151. X *  QMS laser printers
  152. X *
  153. X * AUTHORS
  154. X *  Colin Kelley, Thomas Williams, Russell Lang
  155. X * 
  156. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  157. X * 
  158. X */
  159. X
  160. #define QMS_XMAX 9000
  161. #define QMS_YMAX 6000
  162. X
  163. #define QMS_XLAST (QMS_XMAX - 1)
  164. #define QMS_YLAST (QMS_YMAX - 1)
  165. X
  166. #define QMS_VCHAR        120
  167. #define QMS_HCHAR        70
  168. #define QMS_VTIC        70
  169. #define QMS_HTIC        70
  170. X
  171. int qms_line = 0;    /* to remember current line type */
  172. X
  173. QMS_init()
  174. {
  175. /* This was just ^IOL, but at Rutgers at least we need some more stuff */
  176. X  fprintf(outfile,"^PY^-\n^IOL\n^ISYNTAX00000^F^IB11000^IJ00000^IT00000\n");
  177. /*                 ^ QUIC on    ^set defaults  ^ set botttom,top,left margins
  178. X                          ^landscape         ^free format   */
  179. /* set defaults are: implicit decimal point, units in inches, 
  180. X   numbers left justified, units in 1/1000 inch, do not ignore spaces */
  181. /* margins are in 1/1000 inch units */
  182. }
  183. X
  184. X
  185. QMS_graphics()
  186. {
  187. X    fprintf(outfile,"^IGV\n");
  188. /*                     ^enter graphics vector mode */
  189. }
  190. X
  191. X
  192. X
  193. QMS_text()
  194. {
  195. /* added ^-, because ^, after an ^I command doesn't actually print a page */
  196. /* Did anybody try this code out?  [uhh...-cdk] */
  197. X    fprintf(outfile,"^IGE\n^-^,");
  198. /*                     ^exit graphics vector mode
  199. X                           ^pass terminator
  200. X                             ^print page  */
  201. }
  202. X
  203. X
  204. QMS_linetype(linetype)
  205. int linetype;
  206. {
  207. static int width[2+9] = {7, 3, 3, 3, 3, 5, 5, 5, 7, 7, 7};
  208. static int type[2+9] =  {0, 1, 0, 2, 3, 0, 2, 3, 0, 2, 3};
  209. /*
  210. X * I don't know about Villanova, but on our printer, using ^V without
  211. X * previously setting up a pattern crashes the microcode.
  212. X * [nope, doesn't crash here. -cdk]
  213. X * [it generates a controller error here on dotted lines. - rjl]
  214. X */
  215. /* Code to define patterns added by rjl
  216. X * According to the manual it should work - but it doesn't
  217. X */
  218. X    qms_line = linetype;
  219. X    if (linetype >= 9)
  220. X        linetype %= 9;
  221. X    fprintf(outfile,"^PW%02d\n",width[linetype+2]); 
  222. /*                     ^width in dots */
  223. X    switch (type[linetype+2]) {
  224. X        case 1 :    /* short dash */
  225. X            fprintf(outfile,"^PV102025^G\n^V1\n");
  226. /* ^PV = define pattern vector, 1 = pattern number,
  227. X   02 = number of pen downs and ups, 025 = .025" length of ups/downs */
  228. X            break;
  229. X        case 2 :    /* medium dash */
  230. X            fprintf(outfile,"^PV202050^G\n^V2\n");
  231. X            break;
  232. X        case 3 :    /* long dash */
  233. X            fprintf(outfile,"^PV302100^G\n^V3\n");
  234. X            break;
  235. X        default:
  236. X        case 0 :
  237. X            fprintf(outfile,"^V0\n");
  238. X            break;
  239. X    }
  240. }
  241. X
  242. X
  243. QMS_move(x,y)
  244. int x,y;
  245. {
  246. X    fprintf(outfile,"^U%05d:%05d\n", 1000 + x, QMS_YLAST + 1000 - y);
  247. /*                     ^pen up vector*/
  248. }
  249. X
  250. X
  251. QMS_vector(x2,y2)
  252. int x2,y2;
  253. {
  254. X    fprintf(outfile,"^D%05d:%05d\n", 1000 + x2, QMS_YLAST + 1000 - y2);
  255. /*                     ^pen down vector*/
  256. }
  257. X
  258. X
  259. QMS_put_text(x,y,str)
  260. unsigned int x,y;
  261. char str[];
  262. {
  263. char ch;
  264. X    QMS_move(x,y + QMS_VCHAR/3);
  265. X    fputs("^IGE\n",outfile);
  266. X    ch = *str++;
  267. X    while(ch!='\0') {
  268. X        if (ch=='^')
  269. X            putc('^',outfile);
  270. X        putc(ch,outfile);
  271. X        ch = *str++;
  272. X    }
  273. X    fputs("\n^IGV\n",outfile);
  274. X    QMS_linetype(qms_line); /* restore line type */
  275. }
  276. X
  277. X
  278. QMS_reset()
  279. {
  280. X    fprintf(outfile,"^PN^-\n");
  281. /*                     ^QUIC off*/
  282. }
  283. X
  284. SHAR_EOF
  285. chmod 0666 gnuplot/term/qms.trm ||
  286. echo 'restore of gnuplot/term/qms.trm failed'
  287. Wc_c="`wc -c < 'gnuplot/term/qms.trm'`"
  288. test 3785 -eq "$Wc_c" ||
  289.     echo 'gnuplot/term/qms.trm: original size 3785, current size' "$Wc_c"
  290. rm -f _shar_wnt_.tmp
  291. fi
  292. # ============= gnuplot/term/regis.trm ==============
  293. if test -f 'gnuplot/term/regis.trm' -a X"$1" != X"-c"; then
  294.     echo 'x - skipping gnuplot/term/regis.trm (File already exists)'
  295.     rm -f _shar_wnt_.tmp
  296. else
  297. > _shar_wnt_.tmp
  298. echo 'x - extracting gnuplot/term/regis.trm (Text)'
  299. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/regis.trm' &&
  300. /* GNUPLOT - regis.trm */
  301. /*
  302. X * Copyright (C) 1990   
  303. X *
  304. X * Permission to use, copy, and distribute this software and its
  305. X * documentation for any purpose with or without fee is hereby granted, 
  306. X * provided that the above copyright notice appear in all copies and 
  307. X * that both that copyright notice and this permission notice appear 
  308. X * in supporting documentation.
  309. X *
  310. X * Permission to modify the software is granted, but not the right to
  311. X * distribute the modified code.  Modifications are to be distributed 
  312. X * as patches to released version.
  313. X *  
  314. X * This software  is provided "as is" without express or implied warranty.
  315. X * 
  316. X * This file is included by ../term.c.
  317. X *
  318. X * This terminal driver supports:
  319. X *  REGIS devices
  320. X *
  321. X * AUTHORS
  322. X *  Colin Kelley, Thomas Williams
  323. X * 
  324. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  325. X * 
  326. X */
  327. X
  328. #define REGISXMAX 800             
  329. #define REGISYMAX 440
  330. X
  331. #define REGISXLAST (REGISXMAX - 1)
  332. #define REGISYLAST (REGISYMAX - 1)
  333. X
  334. #define REGISVCHAR        20      
  335. #define REGISHCHAR        9
  336. #define REGISVTIC        8
  337. #define REGISHTIC        6
  338. X
  339. int REGISang = 0;
  340. X
  341. REGISinit()
  342. {
  343. X    fprintf(outfile,"\033[r\033[24;1H");
  344. /*                   1     2
  345. X    1. reset scrolling region
  346. X    2. locate cursor on bottom line
  347. */
  348. }
  349. X
  350. X
  351. /* thanks to calmasd!dko (Dan O'Neill) for adding S(E) for vt125s */
  352. REGISgraphics()
  353. {
  354. X    fprintf(outfile,"\033[2J\033P1pS(C0)S(E)");
  355. /*                   1      2      3    4   5
  356. X    1. clear screen
  357. X    2. enter ReGIS graphics
  358. X    3. turn off graphics diamond cursor
  359. X    4. clear graphics screen
  360. */
  361. X    (void) REGIStext_angle(0); /* select text size and angle */ 
  362. }
  363. X
  364. X
  365. REGIStext()
  366. {
  367. X    fprintf(outfile,"\033\\\033[24;1H");
  368. /*                       1    2
  369. X    1. Leave ReGIS graphics mode
  370. X     2. locate cursor on last line of screen
  371. */
  372. }
  373. X
  374. X
  375. REGISlinetype(linetype)
  376. int     linetype;
  377. {
  378. X      /* This will change color in order G,R,B,G-dot,R-dot,B-dot */
  379. static int in_map[9 + 2] = {2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1};
  380. static int lt_map[9 + 2] = {1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6};
  381. X
  382. X    if (linetype >= 9)
  383. X        linetype %= 9;
  384. X    fprintf(outfile, "W(I%d)", in_map[linetype + 2]);
  385. X    fprintf(outfile, "W(P%d)", lt_map[linetype + 2]);
  386. }
  387. X
  388. X
  389. REGISmove(x,y)
  390. int x,y;
  391. {
  392. X    fprintf(outfile,"P[%d,%d]",x,REGISYLAST-y,x,REGISYLAST-y);
  393. }
  394. X
  395. X
  396. REGISvector(x,y)
  397. int x,y;
  398. {
  399. X    fprintf(outfile,"v[]v[%d,%d]",x,REGISYLAST - y);
  400. /* the initial v[] is needed to get the first pixel plotted */
  401. }
  402. X
  403. X
  404. /* put_text and text_angle by rjl */
  405. REGISput_text(x,y,str)
  406. int x, y;
  407. char *str;
  408. {
  409. X    if (REGISang==1)
  410. X        REGISmove(x-REGISVCHAR/2-1,y);
  411. X    else
  412. X        REGISmove(x,y+REGISVCHAR/2-1);
  413. X    (void) putc('T',outfile); (void) putc('\'',outfile);
  414. X    while (*str) {
  415. X        (void) putc(*str,outfile);
  416. X        if (*str == '\'')
  417. X            (void) putc('\'',outfile);    /* send out another one */
  418. X        str++;
  419. X    }
  420. X    (void) putc('\'',outfile);
  421. }
  422. X
  423. X
  424. int REGIStext_angle(ang)
  425. int ang;
  426. {
  427. X    REGISang = ang;
  428. X    if (ang == 1)
  429. X        fputs("T(D90,S1)",outfile);
  430. X    else
  431. X        fputs("T(D0,S1)",outfile);
  432. X    return TRUE;
  433. }
  434. X
  435. X
  436. REGISreset()
  437. {
  438. X    fprintf(outfile,"\033[2J\033[24;1H");
  439. }
  440. X
  441. SHAR_EOF
  442. chmod 0666 gnuplot/term/regis.trm ||
  443. echo 'restore of gnuplot/term/regis.trm failed'
  444. Wc_c="`wc -c < 'gnuplot/term/regis.trm'`"
  445. test 2967 -eq "$Wc_c" ||
  446.     echo 'gnuplot/term/regis.trm: original size 2967, current size' "$Wc_c"
  447. rm -f _shar_wnt_.tmp
  448. fi
  449. # ============= gnuplot/term/sun.trm ==============
  450. if test -f 'gnuplot/term/sun.trm' -a X"$1" != X"-c"; then
  451.     echo 'x - skipping gnuplot/term/sun.trm (File already exists)'
  452.     rm -f _shar_wnt_.tmp
  453. else
  454. > _shar_wnt_.tmp
  455. echo 'x - extracting gnuplot/term/sun.trm (Text)'
  456. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/sun.trm' &&
  457. /* GNUPLOT - sun.trm */
  458. /*
  459. X * Copyright (C) 1990   
  460. X *
  461. X * Permission to use, copy, and distribute this software and its
  462. X * documentation for any purpose with or without fee is hereby granted, 
  463. X * provided that the above copyright notice appear in all copies and 
  464. X * that both that copyright notice and this permission notice appear 
  465. X * in supporting documentation.
  466. X *
  467. X * Permission to modify the software is granted, but not the right to
  468. X * distribute the modified code.  Modifications are to be distributed 
  469. X * as patches to released version.
  470. X *  
  471. X * This software  is provided "as is" without express or implied warranty.
  472. X * 
  473. X * This file is included by ../term.c.
  474. X *
  475. X * This terminal driver supports:
  476. X *   SUNview windowing system
  477. X *
  478. X * AUTHORS
  479. X *  Maurice Castro
  480. X * 
  481. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  482. X * 
  483. X */
  484. X
  485. #include <suntool/sunview.h>
  486. #include <suntool/canvas.h>
  487. #include <suntool/scrollbar.h>
  488. #include <suntool/panel.h>
  489. #include <pixrect/pixrect_hs.h>
  490. X
  491. #define SUN_XMAX 600
  492. #define SUN_YMAX 512
  493. X
  494. #define SUN_VCHAR (12)        /* default, will be changed */
  495. #define SUN_HCHAR (8)        /* default, will be changed */
  496. #define SUN_VTIC (SUN_YMAX/80)
  497. #define SUN_HTIC (SUN_XMAX/80)
  498. #define MARGIN 5
  499. #define MINWIN 128
  500. X
  501. static Frame frame;
  502. static Canvas canvas;
  503. static Pixwin *pw;
  504. static struct pixfont *sun_font = NULL;
  505. X
  506. static enum JUSTIFY sun_justify=LEFT;
  507. X
  508. static Notify_value local_notice_destroy();
  509. X
  510. extern Notify_error notify_dispatch();
  511. X  
  512. /* dotted line generator */
  513. unsigned int sun_value = 1;    /* this can be used for colour */
  514. unsigned int sun_line_mask = 0xffff;    /* 16 bit mask for dotted lines */
  515. static unsigned int sun_pattern[] = {0xffff, 0x1111,
  516. X    0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
  517. int sun_mask_count = 0;
  518. unsigned int sun_lastx, sun_lasty;    /* last pixel set - used by sun_line */
  519. X
  520. X
  521. SUN_init()
  522. {
  523. X  struct termentry *t = &term_tbl[term];
  524. X  struct pr_subregion bound;
  525. X
  526. X  frame = window_create(NULL, FRAME, 
  527. X            FRAME_LABEL,               "Gnuplot",
  528. X            0);
  529. X  notify_interpose_destroy_func(frame,local_notice_destroy);
  530. X  canvas = window_create(frame, CANVAS,
  531. X            CANVAS_AUTO_EXPAND,        TRUE,
  532. X            CANVAS_AUTO_SHRINK,        TRUE,
  533. X            CANVAS_MARGIN,             MARGIN,
  534. X            0);
  535. X  notify_do_dispatch();
  536. X  pw = canvas_pixwin(canvas);
  537. X  window_set(frame, WIN_SHOW, TRUE, 0);
  538. X
  539. X  /* figure out font and rough size */
  540. X  sun_font = pf_default();
  541. X  pf_textbound(&bound, 1, sun_font, "M");
  542. X  t->v_char = bound.size.y;
  543. X  t->h_char = bound.size.x;
  544. X
  545. X  return;
  546. }
  547. X
  548. SUN_graphics()
  549. {
  550. X  term_tbl[term].xmax = (int) window_get(canvas,CANVAS_WIDTH);
  551. X  term_tbl[term].ymax = (int) window_get(canvas,CANVAS_HEIGHT);
  552. X  pw_writebackground(pw,0,0,term_tbl[term].xmax, term_tbl[term].ymax, PIX_SRC );
  553. X  notify_dispatch();
  554. X  /* do not let the user make the window too small */
  555. X  if ((term_tbl[term].xmax)<MINWIN)
  556. X  {
  557. X      window_set(frame,
  558. X            WIN_WIDTH,                MINWIN+2*MARGIN+24,
  559. X            0);
  560. X      notify_dispatch();
  561. X      SUN_graphics();
  562. X      }
  563. X  if ((term_tbl[term].ymax) <MINWIN)
  564. X  {
  565. X      window_set(frame,
  566. X            WIN_HEIGHT,               MINWIN+2*MARGIN+24,
  567. X            0);
  568. X      notify_dispatch();
  569. X      SUN_graphics();
  570. X      }
  571. X  notify_dispatch();
  572. X  return;
  573. }
  574. X
  575. SUN_text()
  576. {
  577. X  notify_dispatch();
  578. X  return; /* enter text from another window!!! */
  579. }
  580. X
  581. SUN_linetype(linetype)
  582. int linetype;
  583. {
  584. X    if (linetype>=7)
  585. X        linetype %= 7;
  586. X    sun_line_mask = sun_pattern[linetype+2];
  587. X    sun_mask_count=0;
  588. }
  589. X
  590. X
  591. SUN_move(x, y)
  592. unsigned int x, y;
  593. {
  594. X  sun_lastx = x;
  595. X  sun_lasty = y;
  596. X  notify_dispatch();
  597. X  return;
  598. }
  599. X
  600. SUN_vector(x, y)
  601. unsigned int x, y;
  602. {
  603. X  if ( (x>=term_tbl[term].xmax) || (y>=term_tbl[term].ymax) )
  604. X    return;
  605. X  sun_line(sun_lastx,x,sun_lasty,y);
  606. X  canvas_pixwin(canvas);
  607. X  notify_dispatch();
  608. X  return;
  609. }
  610. X
  611. X
  612. SUN_put_text(x,y,str)
  613. unsigned int x, y;
  614. char *str;
  615. {
  616. X  struct pr_subregion bound;
  617. X
  618. X  if ( (x>=term_tbl[term].xmax) || (y>=term_tbl[term].ymax) )
  619. X    return;
  620. X
  621. X  pf_textbound(&bound, strlen(str), sun_font, str);
  622. X  y = term_tbl[term].ymax-1-y + bound.size.y/3; /* vertical centering */
  623. X
  624. X  switch(sun_justify) {
  625. X     case LEFT:   break;
  626. X     case CENTRE: x -= bound.size.x/2; break;
  627. X     case RIGHT:  x -= bound.size.x; break;
  628. X  }
  629. X  pw_text(pw, x,y, PIX_SRC | PIX_DST, 0, str); 
  630. X  canvas_pixwin(canvas);
  631. X  notify_dispatch();
  632. X  return;
  633. }
  634. X
  635. int SUN_justify_text(mode)
  636. X    enum JUSTIFY mode;
  637. {
  638. X    sun_justify = mode;
  639. X    return (TRUE);
  640. }
  641. X  
  642. X  
  643. X
  644. X
  645. SUN_reset()
  646. {
  647. X  
  648. X  term_tbl[term].xmax = SUN_XMAX;
  649. X  term_tbl[term].ymax = SUN_YMAX;
  650. X  window_set(frame, WIN_SHOW, FALSE, 0);
  651. X  return;
  652. }
  653. X
  654. X
  655. X
  656. sun_setmaskpixel(x,y,value)
  657. unsigned int x,y,value;
  658. {
  659. X    /* dotted line generator */
  660. X    if ((sun_line_mask>>sun_mask_count)&(unsigned int)(1)) {
  661. X        pw_put(pw,x,term_tbl[term].ymax-1-y,sun_value);
  662. X    }
  663. X    sun_mask_count= (sun_mask_count+1) % 16;
  664. X    sun_lastx= x;  /* last pixel set with mask */
  665. X    sun_lasty= y;
  666. }
  667. X
  668. X
  669. X
  670. X
  671. sun_line(x1,x2,y1,y2)
  672. unsigned int x1,x2,y1,y2;
  673. {
  674. int runcount;
  675. int dx,dy;
  676. int xinc,yinc;
  677. unsigned int xplot,yplot;
  678. X
  679. X    runcount=0;
  680. X    dx = abs((int)(x1)-(int)(x2));
  681. X    if (x2>x1)  xinc=  1;
  682. X    if (x2==x1) xinc=  0;
  683. X    if (x2<x1)  xinc= -1;
  684. X    dy = abs((int)(y1)-(int)(y2));
  685. X    if (y2>y1)  yinc=  1;
  686. X    if (y2==y1) yinc=  0;
  687. X    if (y2<y1)  yinc= -1;
  688. X    xplot=x1;
  689. X    yplot=y1;
  690. X    if (dx>dy) {
  691. X        /* iterate x */
  692. X        if ( (sun_line_mask==0xffff) ||
  693. X            ((xplot!=sun_lastx) && (yplot!=sun_lasty)) )
  694. X            sun_setmaskpixel(xplot,yplot,sun_value);
  695. X        while (xplot!=x2) { 
  696. X            xplot+=xinc;
  697. X            runcount+=dy;
  698. X            if (runcount>=(dx-runcount)) {
  699. X                yplot+=yinc;
  700. X                runcount-=dx;
  701. X            }
  702. X            sun_setmaskpixel(xplot,yplot,sun_value);
  703. X        } 
  704. X    } else {
  705. X        /* iterate y */
  706. X        if ( (sun_line_mask==0xffff) ||
  707. X            ((xplot!=sun_lastx) && (yplot!=sun_lasty)) )
  708. X            sun_setmaskpixel(xplot,yplot,sun_value);
  709. X        while (yplot!=y2) {
  710. X            yplot+=yinc;
  711. X            runcount+=dx;
  712. X            if (runcount>=(dy-runcount)) {
  713. X                xplot+=xinc;
  714. X                runcount-=dy;
  715. X            }
  716. X            sun_setmaskpixel(xplot,yplot,sun_value);
  717. X        } 
  718. X    }
  719. }
  720. X
  721. X
  722. static Notify_value local_notice_destroy(frame, status)
  723. X   Frame frame;
  724. X   Destroy_status status;
  725. {
  726. X   if (status != DESTROY_CHECKING)
  727. X   {
  728. X      SUN_reset();
  729. X      term_init = FALSE;
  730. X      }
  731. X   return(NOTIFY_DONE);
  732. X   }
  733. X
  734. SHAR_EOF
  735. chmod 0666 gnuplot/term/sun.trm ||
  736. echo 'restore of gnuplot/term/sun.trm failed'
  737. Wc_c="`wc -c < 'gnuplot/term/sun.trm'`"
  738. test 6147 -eq "$Wc_c" ||
  739.     echo 'gnuplot/term/sun.trm: original size 6147, current size' "$Wc_c"
  740. rm -f _shar_wnt_.tmp
  741. fi
  742. # ============= gnuplot/term/t410x.trm ==============
  743. if test -f 'gnuplot/term/t410x.trm' -a X"$1" != X"-c"; then
  744.     echo 'x - skipping gnuplot/term/t410x.trm (File already exists)'
  745.     rm -f _shar_wnt_.tmp
  746. else
  747. > _shar_wnt_.tmp
  748. echo 'x - extracting gnuplot/term/t410x.trm (Text)'
  749. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/t410x.trm' &&
  750. /* GNUPLOT - t410x.trm */
  751. /*
  752. X * Copyright (C) 1990   
  753. X *
  754. X * Permission to use, copy, and distribute this software and its
  755. X * documentation for any purpose with or without fee is hereby granted, 
  756. X * provided that the above copyright notice appear in all copies and 
  757. X * that both that copyright notice and this permission notice appear 
  758. X * in supporting documentation.
  759. X *
  760. X * Permission to modify the software is granted, but not the right to
  761. X * distribute the modified code.  Modifications are to be distributed 
  762. X * as patches to released version.
  763. X *  
  764. X * This software  is provided "as is" without express or implied warranty.
  765. X * 
  766. X * This file is included by ../term.c.
  767. X *
  768. X * This terminal driver supports: Tektronix 410x and 420x series terminals
  769. X *
  770. X * AUTHORS
  771. X *   Colin Kelley, Thomas Williams
  772. X * 
  773. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  774. X * 
  775. X */
  776. X
  777. /* Tektronix 410X and 420X driver written by Cary D. Renzema.
  778. X * email address: caryr@vice.ico.tek.com
  779. X *
  780. X * I've tested this driver on the following terminals: 4106, 4107A, 4109
  781. X * and 4207.  It should work, without editing, on other terminals in the
  782. X * 410x and 420x families.  It will probably need to be changed to work
  783. X * on a 4105 (screen size and character rotation are two guesses).  This
  784. X * file can also be used as a start for a 411x driver.
  785. X *
  786. X * Cary R.
  787. X * April 5, 1990
  788. X */
  789. X
  790. #ifdef T410X
  791. X
  792. #define T410XXMAX 4095
  793. #define T410XYMAX 3131
  794. X
  795. #define T410XVCHAR    71
  796. #define T410XHCHAR    51
  797. #define T410XVTIC    36
  798. #define T410XHTIC    36    
  799. X
  800. static int T410X_angle=0;
  801. X
  802. T410X_init()
  803. {
  804. X    (void) fprintf(outfile, "\033%%!0\033MN0\033MCB7C;\033MQ1\033MT1");
  805. X    (void) fprintf(outfile, "\033MG1\033RK!\033SK!\033LZ\033%%!1");
  806. /*
  807. X     1. set tek mode
  808. X     2. set character path to 0 (characters placed equal to rotation)
  809. X     3. set character size to 59 height
  810. X     4. set character precision to string
  811. X     5. set character text index to 1
  812. X     6. set character write mode to overstrike
  813. X     7. clear the view
  814. X     8. clear the segments
  815. X     9. clear the dialog buffer
  816. X    10. set ansi mode
  817. */
  818. X    (void) fflush(outfile);
  819. }
  820. X
  821. X
  822. T410X_reset()
  823. {
  824. X    (void) fprintf(outfile, "\033%%!0\033LZ\033%%!1");
  825. /*
  826. X    1. set tek mode
  827. X    2. clear the dialog buffer
  828. X    3. set ansi mode
  829. */
  830. X    (void) fflush(outfile);
  831. }
  832. X
  833. X
  834. T410X_graphics()
  835. {
  836. X    (void) fprintf(outfile, "\033%%!0\033\014\033LV0");
  837. /*
  838. X    1. set tek mode
  839. X    2. clear the screen
  840. X    3. set dialog area invisible
  841. */
  842. X    (void) fflush(outfile);
  843. }
  844. X
  845. T410X_text()
  846. {
  847. X    (void) fprintf(outfile, "\033LV1\033%%!1");
  848. /*
  849. X    1. set dialog area visible
  850. X    2. set ansi mode
  851. */
  852. X    (void) fflush(outfile);
  853. }
  854. X
  855. X
  856. T410X_move(x, y)
  857. unsigned int x, y;
  858. {
  859. X    (void) fprintf(outfile, "\033LF");
  860. X    (void) T410X_encode_x_y(x, y);
  861. X    (void) fflush(outfile);
  862. }
  863. X
  864. X
  865. T410X_vector(x, y)
  866. unsigned int x, y;
  867. {
  868. X    (void) fprintf(outfile, "\033LG");
  869. X    (void) T410X_encode_x_y(x, y);
  870. X    (void) fflush(outfile);
  871. }
  872. X
  873. X
  874. T410X_point(x, y, number)
  875. unsigned int x, y;
  876. int number;
  877. {
  878. X    (void) fprintf(outfile, "\033MM");
  879. X    (void) T410X_encode_int(max(number, 0)%11);
  880. X    (void) fprintf(outfile, "\033LH");
  881. X    (void) T410X_encode_x_y(x, y);
  882. X    (void) fflush(outfile);
  883. }
  884. X
  885. X
  886. T410X_linetype(linetype)
  887. int linetype;
  888. {
  889. X    switch (linetype) {
  890. X        case -1:
  891. X            (void) fprintf(outfile, "\033ML5");
  892. X            break;
  893. X        case -2:
  894. X            (void) fprintf(outfile, "\033ML?");
  895. X            break;
  896. X        default:
  897. X            (void) fprintf(outfile, "\033ML");
  898. X            (void) T410X_encode_int(linetype%14+2);
  899. X            break;
  900. X    }
  901. X    (void) fprintf(outfile, "\033MV");
  902. X    (void) T410X_encode_int(max(linetype, 0)%8);
  903. X    (void) fflush(outfile);
  904. }
  905. X
  906. X
  907. T410X_put_text(x, y, str)
  908. unsigned int x, y;
  909. char str[];
  910. {
  911. X    extern int T410X_angle;
  912. X
  913. X    if (T410X_angle == 0) {
  914. X        (void) T410X_move(x, y-T410XVCHAR/2+6);
  915. X        (void) fprintf(outfile, "\033MR00");
  916. X    } else {
  917. X        (void) T410X_move(x+T410XHCHAR/2-6, y);
  918. X        (void) fprintf(outfile, "\033MRE:0");
  919. X    }
  920. X    (void) fprintf(outfile, "\033LT");
  921. X    (void) T410X_encode_int(strlen(str));
  922. X    (void) fputs(str, outfile);
  923. X    (void) fflush(outfile);
  924. }
  925. X
  926. T410X_text_angle(ang)
  927. int ang;
  928. {
  929. X    extern int T410X_angle;
  930. X
  931. X    T410X_angle = ang;
  932. X    return(TRUE);
  933. }
  934. X
  935. /* These last two routines are based on fortran code found in the
  936. X * 4106/4107/4109/CX PROGRAMMERS manual.
  937. X */
  938. X
  939. T410X_encode_x_y(x, y)
  940. unsigned int x, y;
  941. {
  942. X    static char chix=0, chiy=0, cloy=0, ceb=0;
  943. X
  944. X    register unsigned int hix, lox, hiy, loy, eb, lx, ly;
  945. X
  946. X    lx = (x <= T410XXMAX) ? x : T410XXMAX;
  947. X    ly = (y <= T410XYMAX) ? y : T410XYMAX;
  948. X
  949. X    hix = lx/128 + 32;
  950. X    lox = (lx/4)%32 + 64;
  951. X    hiy = ly/128 + 32;
  952. X    loy = (ly/4)%32 + 96;
  953. X    eb = (ly%4)*4 + lx%4 + 96;
  954. X
  955. X    if (chiy != hiy) (void) putc(hiy, outfile);
  956. X    if (ceb != eb) (void) putc(eb, outfile);
  957. X    if ((cloy!=loy) || (ceb!=eb) || (chix!=hix)) (void) putc(loy, outfile);
  958. X    if (chix != hix) (void) putc(hix, outfile);
  959. X    (void) putc(lox, outfile);
  960. X
  961. X    chix = hix;
  962. X    chiy = hiy;
  963. X    cloy = loy;
  964. X    ceb = eb;
  965. }
  966. X
  967. X
  968. T410X_encode_int(number)
  969. int number;
  970. {
  971. X    register unsigned int mag, hi1, hi2, lo;
  972. X
  973. X    mag = abs(number);
  974. X
  975. X    hi1 = mag/1024 + 64;
  976. X    hi2 = (mag/16)%64 + 64;
  977. X    lo = mag%16 + 32;
  978. X
  979. X    if (number >= 0) lo += 16;
  980. X
  981. X    if (hi1 != 64) (void) putc(hi1, outfile);
  982. X    if ((hi2 != 64) || (hi1 != 64)) (void) putc(hi2, outfile);
  983. X    (void) putc(lo, outfile);
  984. X
  985. }
  986. X
  987. X
  988. #endif /* T410X */
  989. SHAR_EOF
  990. chmod 0666 gnuplot/term/t410x.trm ||
  991. echo 'restore of gnuplot/term/t410x.trm failed'
  992. Wc_c="`wc -c < 'gnuplot/term/t410x.trm'`"
  993. test 5056 -eq "$Wc_c" ||
  994.     echo 'gnuplot/term/t410x.trm: original size 5056, current size' "$Wc_c"
  995. rm -f _shar_wnt_.tmp
  996. fi
  997. # ============= gnuplot/term/tek.trm ==============
  998. if test -f 'gnuplot/term/tek.trm' -a X"$1" != X"-c"; then
  999.     echo 'x - skipping gnuplot/term/tek.trm (File already exists)'
  1000.     rm -f _shar_wnt_.tmp
  1001. else
  1002. > _shar_wnt_.tmp
  1003. echo 'x - extracting gnuplot/term/tek.trm (Text)'
  1004. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/tek.trm' &&
  1005. /* GNUPLOT - tek.trm */
  1006. /*
  1007. X * Copyright (C) 1990   
  1008. X *
  1009. X * Permission to use, copy, and distribute this software and its
  1010. X * documentation for any purpose with or without fee is hereby granted, 
  1011. X * provided that the above copyright notice appear in all copies and 
  1012. X * that both that copyright notice and this permission notice appear 
  1013. X * in supporting documentation.
  1014. X *
  1015. X * Permission to modify the software is granted, but not the right to
  1016. X * distribute the modified code.  Modifications are to be distributed 
  1017. X * as patches to released version.
  1018. X *  
  1019. X * This software  is provided "as is" without express or implied warranty.
  1020. X * 
  1021. X * This file is included by ../term.c.
  1022. X *
  1023. X * This terminal driver supports:
  1024. X *  tek40xx, bitgraph, kermit_color_tek40xx, kermit_mono_tek40xx, selanar
  1025. X *  ln03plus
  1026. X *
  1027. X * AUTHORS
  1028. X *   Colin Kelley, Thomas Williams, Russell Lang
  1029. X * 
  1030. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  1031. X * 
  1032. X */
  1033. X
  1034. #ifdef TEK
  1035. X
  1036. #define TEK40XMAX 1024
  1037. #define TEK40YMAX 780
  1038. X
  1039. #define TEK40XLAST (TEK40XMAX - 1)
  1040. #define TEK40YLAST (TEK40YMAX - 1)
  1041. X
  1042. #define TEK40VCHAR        25
  1043. #define TEK40HCHAR        14
  1044. #define TEK40VTIC        11
  1045. #define TEK40HTIC        11    
  1046. X
  1047. #define HX 0x20        /* bit pattern to OR over 5-bit data */
  1048. #define HY 0x20
  1049. #define LX 0x40
  1050. #define LY 0x60
  1051. X
  1052. #define LOWER5 31
  1053. #define UPPER5 (31<<5)
  1054. X
  1055. X
  1056. TEK40init()
  1057. {
  1058. }
  1059. X
  1060. X
  1061. TEK40graphics()
  1062. {
  1063. #ifdef vms
  1064. X    term_pasthru();
  1065. #endif /* vms */
  1066. X    fprintf(outfile,"\033\014");
  1067. /*                   1
  1068. X    1. clear screen
  1069. */
  1070. X    (void) fflush(outfile);
  1071. X    sleep(1);  
  1072. X    /* sleep 1 second to allow screen time to clear on real 
  1073. X       tektronix terminals */
  1074. }
  1075. X
  1076. TEK40text()
  1077. {
  1078. X    TEK40move(0,12);
  1079. X    fprintf(outfile,"\037");
  1080. /*                   1
  1081. X    1. into alphanumerics
  1082. */
  1083. #ifdef vms
  1084. X    term_nopasthru();
  1085. #endif /* vms */
  1086. }
  1087. X
  1088. X
  1089. TEK40linetype(linetype)
  1090. int linetype;
  1091. {
  1092. }
  1093. X
  1094. TEK40move(x,y)
  1095. unsigned int x,y;
  1096. {
  1097. X    (void) putc('\035', outfile);    /* into graphics */
  1098. X    TEK40vector(x,y);
  1099. }
  1100. X
  1101. X
  1102. TEK40vector(x,y)
  1103. unsigned int x,y;
  1104. {
  1105. X    (void) putc((HY | (y & UPPER5)>>5), outfile);
  1106. X    (void) putc((LY | (y & LOWER5)), outfile);
  1107. X    (void) putc((HX | (x & UPPER5)>>5), outfile);
  1108. X    (void) putc((LX | (x & LOWER5)), outfile);
  1109. }
  1110. X
  1111. X
  1112. TEK40put_text(x,y,str)
  1113. unsigned int x,y;
  1114. char str[];
  1115. {
  1116. X    TEK40move(x,y-11);
  1117. X    fprintf(outfile,"\037%s\n",str);
  1118. }
  1119. X
  1120. X
  1121. TEK40reset()
  1122. {
  1123. }
  1124. X
  1125. #endif /* TEK */
  1126. X
  1127. X
  1128. X
  1129. /* thanks to dukecdu!evs (Ed Simpson) for the BBN BitGraph driver */
  1130. X
  1131. #ifdef BITGRAPH
  1132. X
  1133. #define BG_XMAX                 768 /* width of plot area */
  1134. #define BG_YMAX                 768 /* height of plot area */
  1135. #define BG_SCREEN_HEIGHT    1024 /* full screen height */
  1136. X
  1137. #define BG_XLAST     (BG_XMAX - 1)
  1138. #define BG_YLAST     (BG_YMAX - 1)
  1139. X
  1140. #define BG_VCHAR    16
  1141. #define BG_HCHAR     9
  1142. #define BG_VTIC         8
  1143. #define BG_HTIC         8    
  1144. X
  1145. X
  1146. #define BG_init TEK40init
  1147. X
  1148. #define BG_graphics TEK40graphics
  1149. X
  1150. X
  1151. #define BG_linetype TEK40linetype
  1152. X
  1153. #define BG_move TEK40move
  1154. X
  1155. #define BG_vector TEK40vector
  1156. X
  1157. X
  1158. BG_text()
  1159. {
  1160. X    BG_move(0, BG_SCREEN_HEIGHT - 2 * BG_VCHAR);
  1161. X    fprintf(outfile,"\037");
  1162. /*                   1
  1163. X    1. into alphanumerics
  1164. */
  1165. }
  1166. X
  1167. X
  1168. BG_put_text(x,y,str)
  1169. unsigned int x,y;
  1170. char str[];
  1171. {
  1172. X    BG_move(x,y-11);
  1173. X    fprintf(outfile,"\037%s\n",str);
  1174. }
  1175. X
  1176. X
  1177. #define BG_reset TEK40reset
  1178. X
  1179. #endif /* BITGRAPH */
  1180. X
  1181. X
  1182. /* Color and Monochrome specials for the MS-Kermit Tektronix Emulator
  1183. X   by Russell Lang,  eln272v@monu1.cc.monash.oz  */
  1184. X
  1185. #ifdef KERMIT
  1186. X
  1187. #define KTEK40HCHAR        13
  1188. X
  1189. KTEK40graphics()
  1190. {
  1191. #ifdef vms
  1192. X        term_mode_tek();
  1193. X    term_pasthru();
  1194. #endif /* vms */
  1195. X    fprintf(outfile,"\033\014");
  1196. /*                   1
  1197. X    1. clear screen
  1198. */
  1199. X    /* kermit tektronix emulation doesn't need to wait */
  1200. }
  1201. X
  1202. KTEK40Ctext()
  1203. {
  1204. X    TEK40text();
  1205. X    KTEK40Clinetype(0);  /* change to green */
  1206. #ifdef vms
  1207. X    term_nopasthru();
  1208. #endif /* vms */
  1209. }
  1210. X
  1211. /* special color linetypes for MS-DOS Kermit v2.31 tektronix emulator */
  1212. /*    0 = normal, 1 = bright 
  1213. X    foreground color (30-37) = 30 + colors
  1214. X        where colors are   1=red, 2=green, 4=blue */
  1215. static char *kermit_color[15]= {"\033[0;37m","\033[1;30m",
  1216. X        "\033[0;32m","\033[0;36m","\033[0;31m","\033[0;35m",
  1217. X        "\033[1;34m","\033[1;33m","\033[1;31m","\033[1;37m",
  1218. X        "\033[1;35m","\033[1;32m","\033[1;36m","\033[0;34m",
  1219. X        "\033[0;33m"};
  1220. X
  1221. KTEK40Clinetype(linetype)
  1222. int linetype;
  1223. {
  1224. X    if (linetype >= 13)
  1225. X        linetype %= 13;
  1226. X    fprintf(outfile,"%s",kermit_color[linetype+2]);
  1227. }
  1228. X
  1229. X
  1230. /* linetypes for MS-DOS Kermit v2.30 tektronix emulator */
  1231. /* `=solid, a=fine dots, b=short dashes, c=dash dot, 
  1232. X   d=long dash dot, e=dash dot dot */
  1233. static char *kerm_linetype = "`a`abcde" ;
  1234. X
  1235. KTEK40Mlinetype(linetype)
  1236. int linetype;
  1237. {
  1238. X    if (linetype >= 6)
  1239. X        linetype %= 6;
  1240. X    fprintf(outfile,"\033%c",kerm_linetype[linetype+2]);
  1241. }
  1242. X
  1243. KTEK40reset()
  1244. {
  1245. X    fprintf(outfile,"\030\n");  /* turn off Tek emulation */
  1246. #ifdef vms
  1247. X    term_mode_native();
  1248. #endif /* vms */
  1249. }
  1250. X
  1251. #endif /* KERMIT */
  1252. X
  1253. X
  1254. /* thanks to sask!macphed (Geoff Coleman and Ian Macphedran) for the
  1255. X   Selanar driver */
  1256. X
  1257. #ifdef SELANAR
  1258. X
  1259. SEL_init()
  1260. {
  1261. X    fprintf(outfile,"\033\062");
  1262. /*                    1
  1263. X    1. set to ansi mode
  1264. */
  1265. }
  1266. X
  1267. X
  1268. SEL_graphics()
  1269. {
  1270. X    fprintf(outfile,"\033[H\033[J\033\061\033\014");
  1271. /*                   1           2       3
  1272. X    1. clear ANSI screen
  1273. X    2. set to TEK mode
  1274. X    3. clear screen
  1275. */
  1276. }
  1277. X
  1278. X
  1279. SEL_text()
  1280. {
  1281. X    TEK40move(0,12);
  1282. X    fprintf(outfile,"\033\062");
  1283. /*                   1
  1284. X    1. into ANSI mode
  1285. */
  1286. }
  1287. X
  1288. SEL_reset()
  1289. {
  1290. X    fprintf(outfile,"\033\061\033\012\033\062\033[H\033[J");
  1291. /*                   1        2       3      4
  1292. 1       set tek mode
  1293. 2       clear screen
  1294. 3       set ansi mode
  1295. 4       clear screen
  1296. */
  1297. }
  1298. #endif /* SELANAR */
  1299. X
  1300. #ifdef VTTEK
  1301. X
  1302. VTTEK40init()
  1303. {
  1304. X        fprintf(outfile,"\033[?38h");
  1305. X        fflush(outfile);
  1306. X        sleep(1);
  1307. X        /* sleep 1 second to allow screen time to clear on some terminals */
  1308. #ifdef vms
  1309. X        term_mode_tek();
  1310. #endif /* vms */
  1311. }
  1312. X
  1313. VTTEK40reset()
  1314. {
  1315. X        fprintf(outfile,"\033[?38l");
  1316. X        fflush(outfile);
  1317. X        sleep(1);
  1318. X        /* sleep 1 second to allow screen time to clear on some terminals */
  1319. #ifdef vms
  1320. X        term_mode_native();
  1321. #endif /* vms */
  1322. }
  1323. X
  1324. /* linetypes for VT-type terminals in tektronix emulator mode */
  1325. /* `=solid, a=fine dots, b=short dashes, c=dash dot,
  1326. X   d=long dash dot, h=bold solid, i=bold fine dots, j=bold short dashes,
  1327. X   k=bold dash dot, l=bold long dash dot */
  1328. static char *vt_linetype = "`a`abcdhijkl" ;
  1329. static int last_vt_linetype = 0;
  1330. VTTEK40linetype(linetype)
  1331. int linetype;
  1332. {
  1333. X        if (linetype >= 10)
  1334. X                linetype %= 10;
  1335. X        fprintf(outfile,"\033%c",vt_linetype[linetype+2]);
  1336. X        last_vt_linetype = linetype;
  1337. }
  1338. X
  1339. VTTEK40put_text(x,y,str)
  1340. unsigned int x,y;
  1341. char str[];
  1342. {
  1343. X        int linetype;
  1344. X        linetype = last_vt_linetype;
  1345. X        VTTEK40linetype(0);
  1346. X        TEK40put_text(x,y,str);
  1347. X        VTTEK40linetype(linetype);
  1348. }
  1349. X
  1350. #endif /* VTTEK */
  1351. X
  1352. #ifdef LN03P
  1353. X
  1354. LN03Pinit()
  1355. {
  1356. X    fprintf(outfile,"\033[?38h");
  1357. }
  1358. X
  1359. LN03Preset()
  1360. {
  1361. X    fprintf(outfile,"\033[?38l");
  1362. }
  1363. #endif LN03P
  1364. SHAR_EOF
  1365. chmod 0644 gnuplot/term/tek.trm ||
  1366. echo 'restore of gnuplot/term/tek.trm failed'
  1367. Wc_c="`wc -c < 'gnuplot/term/tek.trm'`"
  1368. test 6716 -eq "$Wc_c" ||
  1369.     echo 'gnuplot/term/tek.trm: original size 6716, current size' "$Wc_c"
  1370. rm -f _shar_wnt_.tmp
  1371. fi
  1372. # ============= gnuplot/term/unixpc.trm ==============
  1373. if test -f 'gnuplot/term/unixpc.trm' -a X"$1" != X"-c"; then
  1374.     echo 'x - skipping gnuplot/term/unixpc.trm (File already exists)'
  1375.     rm -f _shar_wnt_.tmp
  1376. else
  1377. > _shar_wnt_.tmp
  1378. echo 'x - extracting gnuplot/term/unixpc.trm (Text)'
  1379. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/unixpc.trm' &&
  1380. /* GNUPLOT - unixpc.trm */
  1381. /*
  1382. X * Copyright (C) 1990   
  1383. X *
  1384. X * Permission to use, copy, and distribute this software and its
  1385. X * documentation for any purpose with or without fee is hereby granted, 
  1386. X * provided that the above copyright notice appear in all copies and 
  1387. X * that both that copyright notice and this permission notice appear 
  1388. X * in supporting documentation.
  1389. X *
  1390. X * Permission to modify the software is granted, but not the right to
  1391. X * distribute the modified code.  Modifications are to be distributed 
  1392. X * as patches to released version.
  1393. X *  
  1394. X * This software  is provided "as is" without express or implied warranty.
  1395. X * 
  1396. X * This file is included by ../term.c.
  1397. X *
  1398. X * This terminal driver supports:
  1399. X *  Unix PC's (ATT 3b1)
  1400. X *
  1401. X * AUTHORS
  1402. X *    John Campbell
  1403. X * 
  1404. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  1405. X * 
  1406. X */
  1407. X
  1408. /*
  1409. >From: John Campbell (...!arizona!naucse!jdc)
  1410. X
  1411. I originally ported gnuplot to the ATT 3b1 (ATT7300) on 12/4/88, and then
  1412. added the minimal code needed to bring it up to 2.0 level on 1/28/90.  The 
  1413. 3b1, as I view it, is a 720x300 bitmapped, monochrome display (often people 
  1414. don't use the top 12 scan lines and thus the effective size is 720x288).  I 
  1415. tried to maximize the size of the graph area, by using these top 12 lines 
  1416. (normally reserved) and set up a signal handler to restore them upon exit, 
  1417. abort, etc.
  1418. X
  1419. Line styles were "fudged" (they do not know the aspect ratio).  The same
  1420. line style may look different depending upon the slope of the curve.  Due to
  1421. this only 4 line styles were implemented.  While more line types are possible,
  1422. the current styles were chosen as distinguishable.
  1423. X
  1424. The 3b1 has 4 "special" rows at the bottom that I could not use in graphics
  1425. mode.  It has been suggested that we use these lines for command prompting.
  1426. Others have requested that we have a graphics window and a command window.
  1427. My experience with gnuplot only includes relatively dumb graphics devices--
  1428. hence gnuplot "looks and feels" normal to me the way I implemented it.
  1429. I welcome either of these changes from someone else, however.
  1430. */
  1431. X
  1432. #include <sys/window.h>   /* Started with tam.h--too much trouble. */
  1433. #include <sys/signal.h>
  1434. #include <errno.h>
  1435. X
  1436. #define uPC_HIGH_BIT    (0x8000)
  1437. X
  1438. typedef unsigned short Scr_type;
  1439. typedef unsigned char Scr_kluge;
  1440. X
  1441. #define uPC_XMAX 720
  1442. #define uPC_YMAX 300
  1443. X
  1444. #define uPC_XSIZE       45 /* Short ints. */
  1445. #define uPC_YSIZE uPC_YMAX
  1446. X
  1447. Scr_type uPC_display[uPC_YSIZE][uPC_XSIZE];
  1448. int uPC_width = 2*uPC_XSIZE;
  1449. int uPC_sx=0, uPC_sy=0;
  1450. int uPC_cur_linetype=0;
  1451. int uPC_angle = 0;
  1452. unsigned short uPC_raster_count=0;
  1453. static Scr_type lookup[] = {
  1454. X      0x0001, 0x0002, 0x0004, 0x0008,
  1455. X      0x0010, 0x0020, 0x0040, 0x0080,
  1456. X      0x0100, 0x0200, 0x0400, 0x0800,
  1457. X      0x1000, 0x2000, 0x4000, 0x8000,
  1458. X   };
  1459. X
  1460. #define uPC_XLAST (uPC_XMAX - 1)
  1461. #define uPC_YLAST (uPC_YMAX - 1)
  1462. X
  1463. #define uPC_VCHAR FNT5X9_VCHAR
  1464. #define uPC_HCHAR FNT5X9_HCHAR
  1465. #define uPC_VTIC  uPC_VCHAR/2  /* Was 8  */
  1466. #define uPC_HTIC  uPC_HCHAR    /* Was 12 */
  1467. X
  1468. extern errno, sys_nerr;
  1469. extern char *sys_errlist[];
  1470. X
  1471. static struct urdata uPC_ur = {(unsigned short *)uPC_display, 2*uPC_XSIZE, 0, 0,
  1472. X                           0, 0, 0, 0, uPC_XMAX, uPC_YMAX, SRCSRC, DSTOR, 0};
  1473. X
  1474. #define IfErrOut(e1,e2,s1,s2) if (e1 e2) {\
  1475. fprintf(stderr, "%s:: %s %s\n", sys_errlist[errno], s1, s2);\
  1476. uPC_fixwind(0);\
  1477. exit(-1);}
  1478. X
  1479. uPC_init()
  1480. {
  1481. /* This routine will ioctl to change 0 size */
  1482. X   int i;
  1483. X   struct uwdata uw;
  1484. X   int uPC_fixwind();
  1485. X   short gw;
  1486. X
  1487. /* Check that we are on the bitmapped window. */
  1488. X   if (iswind() != 0) {
  1489. X      fprintf (stderr, "Sorry--must run from the bitmapped terminal\n");
  1490. X      exit(-1);
  1491. X   }
  1492. X   for (i=1; i<=16; i++) {
  1493. X      if (i != SIGINT && i != SIGFPE)  /* Two are caught in plot.c */
  1494. X         signal (i, uPC_fixwind);
  1495. X   }
  1496. X
  1497. /* Increase the screen size */
  1498. X   uw.uw_x = 0;
  1499. X   uw.uw_y = 0;   /* Leave room for top status line. */
  1500. X   uw.uw_width = uPC_XMAX;      /* 720 */
  1501. X   uw.uw_height = uPC_YMAX;     /* 288 normal--we clobber 12 (top row)*/
  1502. X   uw.uw_uflags = 1;         /* Creates with no border */
  1503. X
  1504. X   IfErrOut (ioctl(1, WIOCSETD, &uw), <0, "ioctl failed on", "WIOCSETD");
  1505. }
  1506. X
  1507. X
  1508. uPC_graphics()
  1509. {
  1510. /* This routine will clear the uPC_display buffer and window. */
  1511. X   register Scr_type *j;
  1512. X   register int i;
  1513. X
  1514. X   j = (Scr_type *)uPC_display;
  1515. X   i = uPC_YSIZE*uPC_XSIZE + 1;
  1516. X
  1517. X   while (--i)
  1518. X      *j++ = 0;
  1519. /*
  1520. X   Position the cursor to the bottom of the screen so when we come back to
  1521. X   text mode we are just below the graph.
  1522. */
  1523. X   printf ("\033[25;1H");
  1524. X
  1525. X   uPC_ur.ur_dstop = DSTSRC;   /* replace (clear screen). */
  1526. X   IfErrOut (ioctl(1, WIOCRASTOP, &uPC_ur), <0,
  1527. X      "ioctl failed", "WIOCRASTOP");
  1528. X   uPC_ur.ur_dstop = DSTOR;   /* Or in (show text) */
  1529. }
  1530. X
  1531. X
  1532. uPC_text()
  1533. {
  1534. /* This routine will flush the display. */
  1535. X
  1536. X   IfErrOut (ioctl(1, WIOCRASTOP, &uPC_ur), <0,
  1537. X      "ioctl failed", "WIOCRASTOP");
  1538. }
  1539. X
  1540. X
  1541. uPC_linetype(linetype)
  1542. int linetype;
  1543. {
  1544. /* This routine records the current linetype. */
  1545. X   if (uPC_cur_linetype != linetype) {
  1546. X      uPC_raster_count = 0;
  1547. X      uPC_cur_linetype = linetype;
  1548. X   }
  1549. }
  1550. X
  1551. X
  1552. uPC_move(x,y)
  1553. unsigned int x,y;
  1554. {
  1555. /* This routine just records x and y in uPC_sx, uPC_sy */
  1556. X   uPC_sx = x;
  1557. X   uPC_sy = y;
  1558. }
  1559. X
  1560. X
  1561. /* Was just (*(a)|=(b)) */
  1562. #define uPC_PLOT(a,b)   (uPC_cur_linetype != 0 ? uPC_plot_word (a,b) :\
  1563. X                                (*(a)|=(b)))
  1564. X
  1565. uPC_plot_word(a,b)
  1566. Scr_type *a, b;
  1567. /*
  1568. X   Weak attempt to make line styles.  The real problem is the aspect
  1569. X   ratio.  This routine is called only when a bit is to be turned on in
  1570. X   a horizontal word.  A better line style routine would know something
  1571. X   about the slope of the line around the current point (in order to
  1572. X   change weighting).
  1573. X
  1574. X   This yields 3 working linetypes plus a usable axis line type.
  1575. */
  1576. {
  1577. /* Various line types */
  1578. X   switch (uPC_cur_linetype) {
  1579. X   case -1:
  1580. X   /* Distinguish between horizontal and vertical axis. */
  1581. X      if (uPC_sx > uPC_XMAX/8 && uPC_sx < 7*uPC_XMAX/8) {
  1582. X      /* Fuzzy tolerance because we don't know exactly where the y axis is */
  1583. X         if (++uPC_raster_count % 2 == 0) *(a) |= b;
  1584. X      }
  1585. X      else {
  1586. X      /* Due to aspect ratio, take every other y pixel and every third x. */
  1587. X         *(a) |= (b & 0x9999);
  1588. X      }
  1589. X   break;
  1590. X   case 1:
  1591. X   case 5:
  1592. X   /* Make a |    |----|    |----| type of line. */
  1593. X      if ((1<<uPC_raster_count) & 0xF0F0) *(a) |= b;
  1594. X      if (++uPC_raster_count > 15) uPC_raster_count = 0;
  1595. X   break;
  1596. X   case 2:
  1597. X   case 6:
  1598. X   /* Make a |----|----|----|--- |    | type of line. */
  1599. X      if ((1<<uPC_raster_count) & 0x0EFFF) *(a) |= b;
  1600. X      if (++uPC_raster_count > 19) uPC_raster_count = 0;
  1601. X   break;
  1602. X   case 3:
  1603. X   case 7:
  1604. X   /* Make a | -  | -  | -  | -  | type of line. */
  1605. X      if ((1<<uPC_raster_count) & 0x4444) *(a) |= b;
  1606. X      if (++uPC_raster_count > 15) uPC_raster_count = 0;
  1607. X   break;
  1608. X   case 4:
  1609. X   case 8:
  1610. X   default:
  1611. X      *(a) |= b;
  1612. X   break;
  1613. X   }
  1614. }
  1615. X
  1616. uPC_vector(x,y)
  1617. unsigned int x,y;
  1618. {
  1619. /* This routine calls line with x,y */
  1620. X   int x1 = uPC_sx, y1=uPC_sy, x2 = x, y2 = y;
  1621. X   register int  c, e, dx, dy, width;
  1622. X   register Scr_type mask, *a;
  1623. X
  1624. /* Record new sx, sy for next call to the vector routine. */
  1625. X   uPC_sx = x2;
  1626. X   uPC_sy = y2;
  1627. X
  1628. X   a = &uPC_display[(uPC_YSIZE - 1) - y1][x1 >> 4];
  1629. X   mask = lookup[x1 & 0x0f];
  1630. X   width = uPC_width;
  1631. X
  1632. X   if ((dx = x2 - x1) > 0) {
  1633. X      if ((dy = y2 - y1) > 0) {
  1634. X         if (dx > dy) {         /* dx > 0, dy > 0, dx > dy */
  1635. X            dy <<= 1;
  1636. X            e = dy - dx;
  1637. X            c = dx + 2;
  1638. X            dx <<= 1;
  1639. X
  1640. X            while (--c) {
  1641. X               uPC_PLOT(a, mask);
  1642. X               if (e >= 0) {
  1643. X                  (Scr_kluge *)a -= width;
  1644. X                  e -= dx;
  1645. X               }
  1646. X               if (mask & uPC_HIGH_BIT) {
  1647. X                  mask = 1;
  1648. X                  a++;
  1649. X               } else
  1650. X                  mask <<= 1;
  1651. X               e += dy;
  1652. X            }
  1653. X         } else {            /* dx > 0, dy > 0, dx <= dy */
  1654. X            dx <<= 1;
  1655. X            e = dx - dy;
  1656. X            c = dy + 2;
  1657. X            dy <<= 1;
  1658. X
  1659. X            while (--c) {
  1660. X               uPC_PLOT(a, mask);
  1661. X               if (e >= 0) {
  1662. X                  if (mask & uPC_HIGH_BIT) {
  1663. X                     mask = 1;
  1664. X                     a++;
  1665. X                  } else
  1666. X                     mask <<= 1;
  1667. X                  e -= dy;
  1668. X               }
  1669. X               (Scr_kluge *)a -= width;
  1670. X               e += dx;
  1671. X            }
  1672. X         }
  1673. X      } else {
  1674. X         dy = -dy;
  1675. X         if (dx > dy) {         /* dx > 0, dy <= 0, dx > dy */
  1676. X            dy <<= 1;
  1677. X            e = dy - dx;
  1678. X            c = dx + 2;
  1679. X            dx <<= 1;
  1680. X
  1681. X            while (--c) {
  1682. X               uPC_PLOT(a, mask);
  1683. X               if (e >= 0) {
  1684. X                  (Scr_kluge *)a += width;
  1685. X                  e -= dx;
  1686. X               }
  1687. X               if (mask & uPC_HIGH_BIT) {
  1688. X                  mask = 1;
  1689. X                  a++;
  1690. X               } else
  1691. X                  mask <<= 1;
  1692. X               e += dy;
  1693. X            }
  1694. X         } else {            /* dx > 0, dy <= 0, dx <= dy */
  1695. X            dx <<= 1;
  1696. X            e = dx - dy;
  1697. X            c = dy + 2;
  1698. X            dy <<= 1;
  1699. X
  1700. X            while (--c) {
  1701. X               uPC_PLOT(a, mask);
  1702. X               if (e >= 0) {
  1703. X                  if (mask & uPC_HIGH_BIT) {
  1704. X                     mask = 1;
  1705. X                     a++;
  1706. X                  } else
  1707. X                     mask <<= 1;
  1708. X                  e -= dy;
  1709. X               }
  1710. X               (Scr_kluge *)a += width;
  1711. X               e += dx;
  1712. X            }
  1713. X         }
  1714. X      }
  1715. X   } else {
  1716. X      dx = -dx;
  1717. X      if ((dy = y2 - y1) > 0) {
  1718. X         if (dx > dy) {         /* dx <= 0, dy > 0, dx > dy */
  1719. X            dy <<= 1;
  1720. X            e = dy - dx;
  1721. X            c = dx + 2;
  1722. X            dx <<= 1;
  1723. X
  1724. X            while (--c) {
  1725. X               uPC_PLOT(a, mask);
  1726. X               if (e >= 0) {
  1727. X                  (Scr_kluge *)a -= width;
  1728. X                  e -= dx;
  1729. X               }
  1730. X               if (mask & 1) {
  1731. X                  mask = uPC_HIGH_BIT;
  1732. X                  a--;
  1733. X               } else
  1734. X                  mask >>= 1;
  1735. X               e += dy;
  1736. X            }
  1737. X         } else {            /* dx <= 0, dy > 0, dx <= dy */
  1738. X            dx <<= 1;
  1739. X            e = dx - dy;
  1740. X            c = dy + 2;
  1741. X            dy <<= 1;
  1742. X
  1743. X            while (--c) {
  1744. X               uPC_PLOT(a, mask);
  1745. X               if (e >= 0) {
  1746. X                  if (mask & 1) {
  1747. X                     mask = uPC_HIGH_BIT;
  1748. X                     a--;
  1749. X                  } else
  1750. X                     mask >>= 1;
  1751. X                  e -= dy;
  1752. X               }
  1753. X               (Scr_kluge *)a -= width;
  1754. X               e += dx;
  1755. X            }
  1756. X         }
  1757. X      } else {
  1758. X         dy = -dy;
  1759. X         if (dx > dy) {         /* dx <= 0, dy <= 0, dx > dy */
  1760. X            dy <<= 1;
  1761. X            e = dy - dx;
  1762. X            c = dx + 2;
  1763. X            dx <<= 1;
  1764. X
  1765. X            while (--c) {
  1766. X               uPC_PLOT(a, mask);
  1767. X               if (e >= 0) {
  1768. X                  (Scr_kluge *)a += width;
  1769. X                  e -= dx;
  1770. X               }
  1771. X               if (mask & 1) {
  1772. X                  mask = uPC_HIGH_BIT;
  1773. X                  a--;
  1774. X               } else
  1775. X                  mask >>= 1;
  1776. X               e += dy;
  1777. X            }
  1778. X         } else {            /* dx <= 0, dy <= 0, dx <= dy */
  1779. X            dx <<= 1;
  1780. X            e = dx - dy;
  1781. X            c = dy + 2;
  1782. X            dy <<= 1;
  1783. X
  1784. X            while (--c) {
  1785. X               uPC_PLOT(a, mask);
  1786. X               if (e >= 0) {
  1787. X                  if (mask & 1) {
  1788. X                     mask = uPC_HIGH_BIT;
  1789. X                     a--;
  1790. X                  } else
  1791. X                     mask >>= 1;
  1792. X                  e -= dy;
  1793. X               }
  1794. X               (Scr_kluge *)a += width;
  1795. X               e += dx;
  1796. X            }
  1797. X         }
  1798. X      }
  1799. X   }
  1800. }
  1801. X
  1802. X
  1803. #ifdef uPC_NOT_USED
  1804. /* Added by Russell Lang, eln272v@monu1.cc.monash.oz
  1805. X   This placement to the nearest character cell worked, and I'm leaving
  1806. X   it here so the calculations involved won't be lost!  (jdc)
  1807. */
  1808. uPC_put_text(x,y,str)
  1809. unsigned int x,y;
  1810. char str[];
  1811. {
  1812. /* This routine puts the text at the cursor location nearest
  1813. X   to (x,y).  Obviously the exact postion would look better */
  1814. X
  1815. /* Just use the ANSI escape sequence CUP (iswind said that was ok!) */
  1816. X   printf ("\033[%d;%dH%s\033[25;1H", (int)(24-(y-uPC_VCHAR/2)*25/uPC_YMAX), 
  1817. X                (int)(x*80/uPC_XMAX), str); 
  1818. X   fflush (stdout);
  1819. }
  1820. #endif
  1821. X
  1822. X
  1823. uPC_put_text(x,y,str)
  1824. unsigned int x,y;
  1825. char str[];
  1826. {
  1827. X   if (uPC_angle == 1)
  1828. X      x += uPC_VCHAR/2;
  1829. X   else
  1830. X      y -= uPC_VCHAR/2;
  1831. X
  1832. X   switch (uPC_angle) {
  1833. X      case 0:
  1834. X         for (; *str; ++str, x += uPC_HCHAR)
  1835. X            uPC_putc (x, y, *str, uPC_angle);
  1836. X      break;
  1837. X      case 1:
  1838. X         for (; *str; ++str, y += uPC_HCHAR)
  1839. X            uPC_putc (x, y, *str, uPC_angle);
  1840. X      break;
  1841. X   }
  1842. }
  1843. X
  1844. X
  1845. uPC_putc (x, y, c, angle)
  1846. unsigned int x, y;
  1847. int c, angle;
  1848. /*
  1849. X   Put a character at an x,y location in the bit map (using the fnt5x9
  1850. X   array.  This is mostly just copied from the bitmap.c driver.
  1851. */
  1852. {
  1853. X   int i, j, k;
  1854. X   register Scr_type mask, *a;
  1855. X   char_row fc;
  1856. X   unsigned int pixelon;
  1857. X
  1858. X   i = c - ' ';
  1859. X   for (j=0; j<FNT5X9_VBITS; j++) {
  1860. X      fc = fnt5x9[i][j];
  1861. X      for (k=0; k<FNT5X9_HBITS; k++) {
  1862. X         pixelon = ((unsigned int)(fc))>>k & 1;
  1863. X         if (pixelon) {
  1864. X            switch (angle) {
  1865. X            case 0:
  1866. X               mask = lookup[x+k+1 & 0x0f];
  1867. X               a = &uPC_display[(uPC_YSIZE - 1) - (y+j)][(x+k+1) >> 4];
  1868. X            break;
  1869. X            case 1:
  1870. X               mask = lookup[x-j & 0x0f];
  1871. X               a = &uPC_display[(uPC_YSIZE - 1) - (y+k+1)][(x-j) >> 4];
  1872. X            break;
  1873. X            }
  1874. X            *(a) |= (mask);  /* see uPC_PLOT macro */
  1875. X         }
  1876. X      }
  1877. X   }
  1878. }
  1879. X
  1880. X
  1881. uPC_text_angle (ang)
  1882. int ang;
  1883. {
  1884. X   uPC_angle = ang;
  1885. X   return TRUE;
  1886. }
  1887. X
  1888. X
  1889. uPC_reset()
  1890. {
  1891. /* Reset window to normal size. */
  1892. X   uPC_fixwind (0);
  1893. }
  1894. X
  1895. X
  1896. X
  1897. uPC_fixwind(signo)
  1898. int signo;
  1899. {
  1900. X   static struct uwdata wreset = { 0, 12, 720, 288, 0x1};
  1901. X   struct utdata ut;
  1902. X
  1903. /* Reset the window to the right size. */
  1904. X   ioctl(1, WIOCSETD, &wreset);   /* 0, not wncur here! */
  1905. X
  1906. /* Scroll the screen once. (avoids typing over the same line) */
  1907. X   fprintf (stderr, "\n");
  1908. X
  1909. X   if (signo) {
  1910. X      if (signo == SIGILL || signo == SIGTRAP || signo == SIGPWR)
  1911. X         signal (signo, SIG_DFL);
  1912. X      kill (0,signo);  /* Redo the signal (as if we never trapped it). */
  1913. X   }
  1914. }
  1915. SHAR_EOF
  1916. chmod 0644 gnuplot/term/unixpc.trm ||
  1917. echo 'restore of gnuplot/term/unixpc.trm failed'
  1918. Wc_c="`wc -c < 'gnuplot/term/unixpc.trm'`"
  1919. test 14242 -eq "$Wc_c" ||
  1920.     echo 'gnuplot/term/unixpc.trm: original size 14242, current size' "$Wc_c"
  1921. rm -f _shar_wnt_.tmp
  1922. fi
  1923. # ============= gnuplot/term/unixplot.trm ==============
  1924. if test -f 'gnuplot/term/unixplot.trm' -a X"$1" != X"-c"; then
  1925.     echo 'x - skipping gnuplot/term/unixplot.trm (File already exists)'
  1926.     rm -f _shar_wnt_.tmp
  1927. else
  1928. > _shar_wnt_.tmp
  1929. echo 'x - extracting gnuplot/term/unixplot.trm (Text)'
  1930. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/unixplot.trm' &&
  1931. /* GNUPLOT -- unixplot.trm */
  1932. /*
  1933. X * Copyright (C) 1990   
  1934. X *
  1935. X * Permission to use, copy, and distribute this software and its
  1936. X * documentation for any purpose with or without fee is hereby granted, 
  1937. X * provided that the above copyright notice appear in all copies and 
  1938. X * that both that copyright notice and this permission notice appear 
  1939. X * in supporting documentation.
  1940. X *
  1941. X * Permission to modify the software is granted, but not the right to
  1942. X * distribute the modified code.  Modifications are to be distributed 
  1943. X * as patches to released version.
  1944. X *  
  1945. X * This software  is provided "as is" without express or implied warranty.
  1946. X * 
  1947. X * This file is included by ../term.c.
  1948. X *
  1949. X * This terminal driver supports:
  1950. X *  Unix plot(5) graphics language
  1951. X *
  1952. X * AUTHORS
  1953. X *  Colin Kelley, Thomas Williams, Russell Lang
  1954. X * 
  1955. X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  1956. X * 
  1957. X */
  1958. X
  1959. /*
  1960. Unixplot library writes to stdout.  A fix was put in place by
  1961. ..!arizona!naucse!jdc to let set term and set output redirect
  1962. stdout.  All other terminals write to outfile.
  1963. */
  1964. X
  1965. #define UP_XMAX 4096
  1966. #define UP_YMAX 4096
  1967. X
  1968. #define UP_XLAST (UP_XMAX - 1)
  1969. #define UP_YLAST (UP_YMAX - 1)
  1970. X
  1971. #define UP_VCHAR (UP_YMAX/30)    /* just a guess--no way to know this! */
  1972. #define UP_HCHAR (UP_XMAX/60)    /* just a guess--no way to know this! */
  1973. #define UP_VTIC (UP_YMAX/80)
  1974. #define UP_HTIC (UP_XMAX/80)
  1975. X
  1976. UP_init()
  1977. {
  1978. X    openpl();
  1979. X    space(0, 0, UP_XMAX, UP_YMAX);
  1980. }
  1981. X
  1982. X
  1983. UP_graphics()
  1984. {
  1985. X    erase();
  1986. }
  1987. X
  1988. X
  1989. UP_text()
  1990. {
  1991. }
  1992. X
  1993. X
  1994. UP_linetype(linetype)
  1995. int linetype;
  1996. SHAR_EOF
  1997. true || echo 'restore of gnuplot/term/unixplot.trm failed'
  1998. fi
  1999. echo 'End of  part 18'
  2000. echo 'File gnuplot/term/unixplot.trm is continued in part 19'
  2001. echo 19 > _shar_seq_.tmp
  2002. exit 0
  2003.  
  2004. exit 0 # Just in case...
  2005. -- 
  2006. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  2007. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  2008. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  2009. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  2010.