home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / gnuplotp.lzh / gnuplot#1.4 / patch1c
Encoding:
Text File  |  1990-10-12  |  72.2 KB  |  2,624 lines

  1. diff -c ./term/eepic.trm ../patch/term/eepic.trm
  2. *** ./term/eepic.trm    Tue Mar 27 09:03:33 1990
  3. --- ../patch/term/eepic.trm    Wed Sep 12 09:38:06 1990
  4. ***************
  5. *** 44,51
  6.   #define EEPIC_UNIT (EEPIC_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
  7.   
  8.   /* 5 inches wide by 3 inches high (default) */
  9. ! #define EEPIC_XMAX (unsigned int)(EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0)
  10. ! #define EEPIC_YMAX (unsigned int)(EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0)
  11.   
  12.   #define EEPIC_HTIC (5./EEPIC_UNIT)
  13.   #define EEPIC_VTIC (5./EEPIC_UNIT)
  14.  
  15. --- 44,51 -----
  16.   #define EEPIC_UNIT (EEPIC_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
  17.   
  18.   /* 5 inches wide by 3 inches high (default) */
  19. ! #define EEPIC_XMAX (5*DOTS_PER_INCH)  /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0) */
  20. ! #define EEPIC_YMAX (3*DOTS_PER_INCH)  /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0) */
  21.   
  22.   #define EEPIC_HTIC (5*DOTS_PER_INCH/72)        /* (5./EEPIC_UNIT) */
  23.   #define EEPIC_VTIC (5*DOTS_PER_INCH/72)        /* (5./EEPIC_UNIT) */
  24. ***************
  25. *** 47,56
  26.   #define EEPIC_XMAX (unsigned int)(EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0)
  27.   #define EEPIC_YMAX (unsigned int)(EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0)
  28.   
  29. ! #define EEPIC_HTIC (5./EEPIC_UNIT)
  30. ! #define EEPIC_VTIC (5./EEPIC_UNIT)
  31. ! #define EEPIC_HCHAR (5.3/EEPIC_UNIT)
  32. ! #define EEPIC_VCHAR (11./EEPIC_UNIT)
  33.   
  34.   static unsigned int EEPIC_posx;
  35.   static unsigned int EEPIC_posy;
  36.  
  37. --- 47,56 -----
  38.   #define EEPIC_XMAX (5*DOTS_PER_INCH)  /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0) */
  39.   #define EEPIC_YMAX (3*DOTS_PER_INCH)  /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0) */
  40.   
  41. ! #define EEPIC_HTIC (5*DOTS_PER_INCH/72)        /* (5./EEPIC_UNIT) */
  42. ! #define EEPIC_VTIC (5*DOTS_PER_INCH/72)        /* (5./EEPIC_UNIT) */
  43. ! #define EEPIC_HCHAR (DOTS_PER_INCH*53/10/72)    /* (5.3/EEPIC_UNIT) */
  44. ! #define EEPIC_VCHAR (DOTS_PER_INCH*11/72)    /* (11./EEPIC_UNIT) */
  45.   
  46.   static unsigned int EEPIC_posx;
  47.   static unsigned int EEPIC_posy;
  48. ***************
  49. *** 92,97
  50.   static int EEPIC_type;        /* current line type */
  51.   static BOOLEAN EEPIC_inline = FALSE; /* are we in the middle of a line */
  52.   static void EEPIC_endline();    /* terminate any line in progress */
  53.   
  54.   /* ARROWS */
  55.   /* we use the same code as for LATEX */
  56.  
  57. --- 92,99 -----
  58.   static int EEPIC_type;        /* current line type */
  59.   static BOOLEAN EEPIC_inline = FALSE; /* are we in the middle of a line */
  60.   static void EEPIC_endline();    /* terminate any line in progress */
  61. + static int EEPIC_linecount = 0; /* number of points in line so far */
  62. + #define EEPIC_LINEMAX 50        /* max value for linecount */
  63.   
  64.   /* ARROWS */
  65.   /* we use the same code as for LATEX */
  66. ***************
  67. *** 181,186
  68.          fprintf(outfile, "%s(%u,%u)", 
  69.                EEPIC_lines[EEPIC_type+2], 
  70.                EEPIC_posx, EEPIC_posy);
  71.       }
  72.   
  73.       /* add new point to line */
  74.  
  75. --- 183,201 -----
  76.          fprintf(outfile, "%s(%u,%u)", 
  77.                EEPIC_lines[EEPIC_type+2], 
  78.                EEPIC_posx, EEPIC_posy);
  79. +        EEPIC_linecount = 1;
  80. +     } else {
  81. +        /* Even though we are in middle of a path, 
  82. +         * we may want to start a new path command. 
  83. +         * If they are too long then latex will choke.
  84. +         */
  85. +        if (EEPIC_linecount++ >= EEPIC_LINEMAX) {
  86. +           fprintf(outfile, "\n");
  87. +           fprintf(outfile, "%s(%u,%u)", 
  88. +                 EEPIC_lines[EEPIC_type+2], 
  89. +                 EEPIC_posx, EEPIC_posy);
  90. +           EEPIC_linecount = 1;
  91. +        }
  92.       }
  93.       fprintf(outfile, "(%u,%u)", ux,uy);
  94.       EEPIC_posx = ux;
  95. ***************
  96. *** 182,189
  97.                EEPIC_lines[EEPIC_type+2], 
  98.                EEPIC_posx, EEPIC_posy);
  99.       }
  100. -     /* add new point to line */
  101.       fprintf(outfile, "(%u,%u)", ux,uy);
  102.       EEPIC_posx = ux;
  103.       EEPIC_posy = uy;
  104.  
  105. --- 197,202 -----
  106.             EEPIC_linecount = 1;
  107.          }
  108.       }
  109.       fprintf(outfile, "(%u,%u)", ux,uy);
  110.       EEPIC_posx = ux;
  111.       EEPIC_posy = uy;
  112. diff -c ./term/eps60.trm ../patch/term/eps60.trm
  113. *** ./term/eps60.trm    Mon Sep  3 16:07:23 1990
  114. --- ../patch/term/eps60.trm    Mon Sep  3 15:54:14 1990
  115. ***************
  116. *** 0
  117.  
  118. --- 1,106 -----
  119. + #ifdef EPS60
  120. + /* make the total dimensions 8 inches by 5 inches */
  121. + #define EPS60XMAX    480
  122. + #define EPS60YMAX    360
  123. + #define EPS60XLAST (EPS60XMAX - 1)
  124. + #define EPS60YLAST (EPS60YMAX - 1)
  125. + EPS60init()
  126. + {
  127. + char filename[MAX_ID_LEN+1];
  128. +     bm_xmax=EPS60XMAX;
  129. +     bm_ymax=EPS60YMAX;
  130. +     bm_planes=1;        /* one plane */
  131. +     bm_value=1;
  132. +     bm_setup();
  133. +     /* output for EPSON must be binary to stop non Unix computers
  134. +         changing \n to \r\n. 
  135. +         At present we only do this for PC's. 
  136. +         (Ultrix generates a run time error on the "wb" mode).
  137. +         if the output is not STDOUT, then the following code 
  138. +         reopens outfile with binary mode. */
  139. + #ifdef PC
  140. +     if (strcmp(outstr,"STDOUT")) {
  141. +         (void) fclose(outfile);
  142. +         (void) strcpy(filename,outstr+1);    /* remove quotes */
  143. +         filename[strlen(filename)-1] = '\0';
  144. +         if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
  145. +             if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  146. +                 os_error("cannot reopen file with binary type; output unknown",
  147. +                     NO_CARET);
  148. +             } 
  149. +             else {
  150. +     os_error("cannot reopen file with binary type; output reset to ascii", 
  151. +                     NO_CARET);
  152. +             }
  153. +         }
  154. +     }
  155. + #endif
  156. + }
  157. + /* output file must be binary mode for eps60_dump */
  158. + eps60_dump()
  159. + {
  160. + unsigned int x;
  161. + int j,k;
  162. + int num_bits = (sizeof(unsigned int)-1)*8;
  163. + #ifdef PC
  164. +     fprintf(stderr,"Dumping Epson-style 60-dpi graphics (21kbytes)\n");
  165. + #endif
  166. +     fprintf(outfile,"\0333\030"); /* set line spacing to 24/216" = 8 dots */
  167. +     for (j=bm_ipc-1;j>=0;j--) {
  168. +         for (k=num_bits;k>=0;k-=8) {
  169. +             /* select printer graphics mode 'K' */
  170. +             fprintf(outfile,"\r\n\033K");
  171. +             (void) fputc((char)(bm_xmax%256),outfile);
  172. +             (void) fputc((char)(bm_xmax/256),outfile);
  173. +             for (x=0; x<bm_xmax; x++) {
  174. +                 (void) fputc( (char)((bm_array[x*bm_ipc+j] >>k) &0xff), outfile );
  175. +             }
  176. +         }
  177. +     }
  178. +     fprintf(outfile,"\0333\044\r\n");  /* set line spacing to 36/216" = 1/6" */
  179. + #ifdef PC
  180. +     fprintf(stderr,"Print using: COPY /B\n");
  181. + #endif
  182. + }
  183. + EPS60text()
  184. + {
  185. +     eps60_dump();
  186. + }
  187. + #endif /* EPS60 */
  188. + #ifdef TANDY60
  189. + /* The only difference between TANDY60 and EPS60 is the inclusion
  190. +    of codes to swap the Tandy printer into IBM mode and back
  191. +    into Tandy mode.  For a Tandy already in IBM mode, use EPS60. */
  192. + TANDY60text()
  193. + {
  194. + #ifdef PC
  195. +     fprintf(stderr, "Inserting Tandy/IBM mode conversion codes\n");
  196. + #endif
  197. +     /* Switch to IBM mode, and leave 3 inches above the plot so as
  198. +        to get rough vertical centring on the page.  Perform the
  199. +        centring by setting 1" line feeds and issuing 3 of them. */
  200. +     fprintf(outfile, "\033!\0333%c\n\n\n", 216);
  201. +     eps60_dump();
  202. +     /* A form feed must be sent before switching back to Tandy mode,
  203. +        or else the form setting will be messed up. */
  204. +     fprintf(outfile, "\f\033!");
  205. + }
  206. + #endif  /* TANDY60 */
  207. diff -c ./term/epson.trm ../patch/term/epson.trm
  208. *** ./term/epson.trm    Tue Mar 27 09:02:27 1990
  209. --- ../patch/term/epson.trm    Wed Aug 29 10:04:57 1990
  210. ***************
  211. *** 696,698
  212.   
  213.   #endif /* NEC */
  214.   
  215.  
  216. --- 696,890 -----
  217.   
  218.   #endif /* NEC */
  219.   
  220. + /* The following Star color driver uses generic bit mapped graphics
  221. +    routines to build up a bit map in memory. */
  222. + /* Core from Epson driver by Russell Lang, eln272v@monu1.cc.monash.oz */
  223. + /* Star Color changes made by William Wilson, wew@naucse.cse.nau.edu */
  224. + /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
  225. + /* STARC_init changes outfile to binary mode on PC's */
  226. + #ifdef STARC
  227. + #ifndef EPSON
  228. + #define EPSON
  229. + #endif
  230. + /* EPSON must be defined */
  231. + #define STARCXMAX    400 
  232. + #define STARCYMAX    320
  233. + #define STARCXLAST (STARCXMAX - 1)
  234. + #define STARCYLAST (STARCYMAX - 1)
  235. + #define STARCVCHAR        11      
  236. + #define STARCHCHAR        7        
  237. + #define STARCVTIC        6
  238. + #define STARCHTIC        6
  239. + /* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
  240. + static unsigned int STARCcolor[] = {1,8,4,2,10,12,6,14};
  241. + static unsigned int STARCpcolor[]= {0,2,1,4};
  242. + unsigned int STARC_x=0, STARC_y=0;
  243. + int STARC_angle=0;
  244. + STARCinit()
  245. + {
  246. + char filename[MAX_ID_LEN+1];
  247. +   bm_planes=4;
  248. +     bm_xmax=STARCXMAX;
  249. +     bm_ymax=STARCYMAX;
  250. +     bm_value=1;                /* black */
  251. +     bm_line_mask=0xffff;    /* solid lines */
  252. +     bm_setup();
  253. +     /* output for STARC must be binary to stop non Unix computers
  254. +         changing \n to \r\n. 
  255. +         At present we only do this for PC's. 
  256. +         (Ultrix generates a run time error on the "wb" mode).
  257. +         if the output is not STDOUT, then the following code 
  258. +         reopens outfile with binary mode. */
  259. + #ifdef PC
  260. +     if (strcmp(outstr,"STDOUT")) {
  261. +         (void) fclose(outfile);
  262. +         (void) strcpy(filename,outstr+1);    /* remove quotes */
  263. +         filename[strlen(filename)-1] = '\0';
  264. +         if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL) {
  265. +             if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  266. +                 os_error("cannot reopen file with binary type; output unknown",
  267. +                     NO_CARET);
  268. +             } 
  269. +             else {
  270. +     os_error("cannot reopen file with binary type; output reset to ascii", 
  271. +                     NO_CARET);
  272. +             }
  273. +         }
  274. +     }
  275. + #endif
  276. + }
  277. + STARCgraphics()
  278. + {
  279. + unsigned int plane;
  280. + unsigned int fill=0;
  281. +     for (plane=0; plane<bm_planes; plane++)
  282. +         bm_cls(plane,fill);
  283. +     STARC_x=0;
  284. +     STARC_y=0;
  285. +     STARC_angle=0;
  286. + }
  287. + STARCtext()
  288. + {
  289. +     STARC_dump();
  290. + }
  291. + STARClinetype(linetype)
  292. + int linetype;
  293. + {
  294. +     if (linetype>=6)
  295. +         linetype %= 6;
  296. +     bm_value=STARCcolor[linetype+2];
  297. + }
  298. + STARCmove(x,y)
  299. + unsigned int x,y;
  300. + {
  301. +     STARC_x=x;
  302. +     STARC_y=y;
  303. + }
  304. + STARCvector(x,y)
  305. + unsigned int x,y;
  306. + {
  307. +     bm_line(STARC_x,x,STARC_y,y);
  308. +     STARC_x=x;
  309. +     STARC_y=y;
  310. + }
  311. + STARCput_text(x,y,str)
  312. + unsigned int x, y;
  313. + char *str;
  314. + {
  315. +     if (STARC_angle == 1)
  316. +         x += STARCVCHAR/2;
  317. +     else
  318. +         y -= STARCVCHAR/2;
  319. +    switch (STARC_angle) {
  320. +       case 0:
  321. +          for (; *str; ++str, x += STARCHCHAR)
  322. +             bm_putc (x, y, *str, STARC_angle);
  323. +                     break;
  324. +       case 1:
  325. +          for (; *str; ++str, y += STARCHCHAR)
  326. +             bm_putc (x, y, *str, STARC_angle);
  327. +                     break;
  328. +     }
  329. + }
  330. + int STARC_text_angle(ang)
  331. + int ang;
  332. + {
  333. +     STARC_angle=ang;
  334. +     return TRUE;
  335. + }
  336. +     
  337. + STARCreset()
  338. + {
  339. +     bm_release();
  340. + }
  341. + /* output file must be binary mode for STARC_dump */
  342. + STARC_dump()
  343. + {
  344. + unsigned int x;
  345. + unsigned int plane,offset;
  346. + int j,k;
  347. + int num_bits = (sizeof(unsigned int)-1)*8; 
  348. + unsigned int column8;
  349. + unsigned long column24;
  350. + char column3, column2, column1;
  351. + #ifdef PC
  352. + /*    if (bm_planes==4)*/
  353. +         fprintf(stderr,"Dumping STAR color graphics (65 kbytes)\n");
  354. + #endif
  355. +     fprintf(outfile,"\033A\010"); /* set line spacing to 8/72" = 8 dots */
  356. +     for (j=bm_ipc-1;j>=0;j--) {
  357. +         for (k=num_bits;k>=0;k-=8) {
  358. +             fprintf(outfile,"\n");
  359. +             for (plane=0; plane<bm_planes; plane++) {
  360. +                 offset=plane*bm_psize;
  361. +                 if (bm_planes>1) {
  362. +                     /* select colour for plane */
  363. +                     fprintf(outfile,"\033r");
  364. +                     (void) fputc((char)STARCpcolor[plane],outfile);
  365. +                     fprintf(outfile,"\r");
  366. +                 }
  367. +                 /* select plotter graphics mode (square pixels) */
  368. +                 fprintf(outfile,"\r\033*\005");
  369. +                 (void) fputc((char)(bm_xmax%256),outfile);
  370. +                 (void) fputc((char)(bm_xmax/256),outfile);
  371. +                 for (x=0; x<bm_xmax; x++) {
  372. +                     (void) fputc( (char)((bm_array[offset+x*bm_ipc+j] >>k) &0xff), outfile);
  373. +                 }
  374. +             }
  375. +         }
  376. +     }
  377. +     if (bm_planes > 1) {
  378. +         fprintf(outfile,"\033r");
  379. +         (void) fputc('\0',outfile);                /* set color to black */
  380. +     }
  381. +     fprintf(outfile,"\033A\014\r\n");    /* setline spacing to 12/72" */
  382. + #ifdef PC
  383. +     fprintf(stderr,"Print using: COPY /B\n");
  384. + #endif
  385. + }
  386. + #endif /* STARC */
  387. diff -c ./term/hpgl.trm ../patch/term/hpgl.trm
  388. *** ./term/hpgl.trm    Tue Mar 27 09:02:36 1990
  389. --- ../patch/term/hpgl.trm    Wed Sep 12 09:10:47 1990
  390. ***************
  391. *** 33,40
  392.   #define HPGL_YLAST (HPGL_XMAX - 1)
  393.   
  394.   /* HPGL_VCHAR, HPGL_HCHAR  are not used */
  395. ! #define HPGL_VCHAR    (int)(HPGL_YMAX*0.032+0.5) /* 3.2% */
  396. ! #define HPGL_HCHAR    (int)(HPGL_XMAX*0.012+0.5) /* 1.2% */
  397.   #define HPGL_VTIC    (HPGL_YMAX/70)        
  398.   #define HPGL_HTIC    (HPGL_YMAX/70)        
  399.   
  400.  
  401. --- 33,40 -----
  402.   #define HPGL_YLAST (HPGL_XMAX - 1)
  403.   
  404.   /* HPGL_VCHAR, HPGL_HCHAR  are not used */
  405. ! #define HPGL_VCHAR    (HPGL_YMAX/100*32/10) /* 3.2% */
  406. ! #define HPGL_HCHAR    (HPGL_XMAX/100*12/10) /* 1.2% */
  407.   #define HPGL_VTIC    (HPGL_YMAX/70)        
  408.   #define HPGL_HTIC    (HPGL_YMAX/70)        
  409.   
  410. diff -c ./term/hpljet.trm ../patch/term/hpljet.trm
  411. *** ./term/hpljet.trm    Tue Mar 27 09:02:43 1990
  412. --- ../patch/term/hpljet.trm    Tue Aug 28 21:00:50 1990
  413. ***************
  414. *** 397,404
  415.   {
  416.   }
  417.   
  418. ! /* put_text was added by Russell Lang, eln272v@monu1.cc.monash.oz
  419. !  * IT IS UNTESTED
  420.    */
  421.   /* Put text "str" at pixel position x,y
  422.   **/
  423.  
  424. --- 397,404 -----
  425.   {
  426.   }
  427.   
  428. ! /* put_text was added by Russell Lang, rjl@monu1.cc.monash.edu.au
  429. !  * Tested and repaired by Steve Wampler sbw@naucse.cse.nau.edu
  430.    */
  431.   /* Put text "str" at pixel position x,y
  432.   **/
  433. ***************
  434. *** 407,413
  435.   char str[];
  436.   {
  437.       fprintf(outfile, "\033&a%dH\033&a%dV",
  438. !             HPLJET_PX2DP(x), HPLJET_PX2DP(y) );
  439.       fputs(str, outfile);
  440.   }
  441.       
  442.  
  443. --- 407,415 -----
  444.   char str[];
  445.   {
  446.       fprintf(outfile, "\033&a%dH\033&a%dV",
  447. !             HPLJET_LMARG+HPLJET_PX2DP(x),
  448. !         HPLJET_PX2DP(HPLJETYMAX) + HPLJET_VC2DP(2) + 30 -
  449. !             HPLJET_PX2DP(y) );
  450.       fputs(str, outfile);
  451.   }
  452.       
  453. ***************
  454. *** 411,446
  455.       fputs(str, outfile);
  456.   }
  457.       
  458. - /*
  459. - ** Put text "str" to the lower right corner of the screen.
  460. - ** "row" is the row number [0:1].
  461. - ** Actually in the laserjet, put the text above the upper right corner.
  462. - */
  463. - HPLJETlrput_text(row,str)
  464. - unsigned int row;
  465. - char str[];
  466. - {
  467. -     
  468. -     fprintf(outfile, "\033&a%dH\033&a%dV",
  469. -             HPLJET_RMARG - HPLJET_HC2DP(strlen(str)), HPLJET_VC2DP(row));
  470. -     fputs(str, outfile);
  471. - }
  472. - /*
  473. - ** Put text "str" to the upper left corner of the screen.
  474. - ** "row" is the (serial) number of function to be plotted.
  475. - ** Actually in the laserjet, put the text under the lower left corner.
  476. - */
  477. - HPLJETulput_text(row,str)
  478. - unsigned int row;
  479. - char str[];
  480. - {
  481. -     fprintf(outfile, "\033&a%dH\033&a%dV",
  482. -             HPLJET_LMARG,
  483. -             HPLJET_VC2DP(row+3)+HPLJET_PX2DP(HPLJETYMAX));
  484. -     fputs(str, outfile);
  485. - }
  486.   
  487.   /*
  488.   ** RETURN to normal mode (exit gnuplot)
  489.  
  490. --- 413,418 -----
  491.       fputs(str, outfile);
  492.   }
  493.       
  494.   
  495.   /*
  496.   ** RETURN to normal mode (exit gnuplot)
  497. diff -c ./term/imagen.trm ../patch/term/imagen.trm
  498. *** ./term/imagen.trm    Tue Mar 27 09:03:23 1990
  499. --- ../patch/term/imagen.trm    Wed Sep 12 09:39:37 1990
  500. ***************
  501. *** 39,46
  502.   
  503.   #define IMAGEN_PTS_PER_INCH (300)
  504.   
  505. ! #define IMAGEN_XMAX (10.0 * IMAGEN_PTS_PER_INCH) /* 10.0 inches */
  506. ! #define IMAGEN_YMAX (7.5 * IMAGEN_PTS_PER_INCH) /* 7.5 inches */
  507.   
  508.   #define IMAGEN_FONTSIZE 12
  509.   
  510.  
  511. --- 39,46 -----
  512.   
  513.   #define IMAGEN_PTS_PER_INCH (300)
  514.   
  515. ! #define IMAGEN_XMAX (IMAGEN_PTS_PER_INCH * 10) /* 10.0 inches */
  516. ! #define IMAGEN_YMAX (IMAGEN_PTS_PER_INCH * 75 / 10) /* 7.5 inches */
  517.   
  518.   #define IMAGEN_FONTSIZE 12
  519.   
  520. diff -c ./term/latex.trm ../patch/term/latex.trm
  521. *** ./term/latex.trm    Tue Mar 27 09:03:31 1990
  522. --- ../patch/term/latex.trm    Wed Sep 12 09:27:09 1990
  523. ***************
  524. *** 17,23
  525.    * This file is included by ../term.c.
  526.    *
  527.    * This terminal driver supports:
  528. !  *   LaTeX pictures
  529.    *
  530.    * AUTHORS
  531.    *   David Kotz, Russell Lang
  532.  
  533. --- 17,24 -----
  534.    * This file is included by ../term.c.
  535.    *
  536.    * This terminal driver supports:
  537. !  *   LaTeX pictures (latex).
  538. !  *   LaTeX pictures with emTeX specials (emtex). 
  539.    *
  540.    * AUTHORS
  541.    *   David Kotz, Russell Lang
  542. ***************
  543. *** 39,46
  544.   #define LATEX_UNIT (LATEX_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
  545.   
  546.   /* 5 inches wide by 3 inches high (default) */
  547. ! #define LATEX_XMAX (unsigned int)(LATEX_PTS_PER_INCH/LATEX_UNIT*5.0)
  548. ! #define LATEX_YMAX (unsigned int)(LATEX_PTS_PER_INCH/LATEX_UNIT*3.0)
  549.   
  550.   #define LATEX_HTIC (5./LATEX_UNIT)
  551.   #define LATEX_VTIC (5./LATEX_UNIT)
  552.  
  553. --- 40,47 -----
  554.   #define LATEX_UNIT (LATEX_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
  555.   
  556.   /* 5 inches wide by 3 inches high (default) */
  557. ! #define LATEX_XMAX (5*DOTS_PER_INCH)  /* (LATEX_PTS_PER_INCH/LATEX_UNIT*5.0) */
  558. ! #define LATEX_YMAX (3*DOTS_PER_INCH)  /* (LATEX_PTS_PER_INCH/LATEX_UNIT*3.0) */
  559.   
  560.   #define LATEX_HTIC (5*DOTS_PER_INCH/72)        /* (5./LATEX_UNIT) */
  561.   #define LATEX_VTIC (5*DOTS_PER_INCH/72)        /* (5./LATEX_UNIT) */
  562. ***************
  563. *** 42,51
  564.   #define LATEX_XMAX (unsigned int)(LATEX_PTS_PER_INCH/LATEX_UNIT*5.0)
  565.   #define LATEX_YMAX (unsigned int)(LATEX_PTS_PER_INCH/LATEX_UNIT*3.0)
  566.   
  567. ! #define LATEX_HTIC (5./LATEX_UNIT)
  568. ! #define LATEX_VTIC (5./LATEX_UNIT)
  569. ! #define LATEX_HCHAR (5.3/LATEX_UNIT)
  570. ! #define LATEX_VCHAR (11./LATEX_UNIT)
  571.   
  572.   static int LATEX_posx;
  573.   static int LATEX_posy;
  574.  
  575. --- 43,52 -----
  576.   #define LATEX_XMAX (5*DOTS_PER_INCH)  /* (LATEX_PTS_PER_INCH/LATEX_UNIT*5.0) */
  577.   #define LATEX_YMAX (3*DOTS_PER_INCH)  /* (LATEX_PTS_PER_INCH/LATEX_UNIT*3.0) */
  578.   
  579. ! #define LATEX_HTIC (5*DOTS_PER_INCH/72)        /* (5./LATEX_UNIT) */
  580. ! #define LATEX_VTIC (5*DOTS_PER_INCH/72)        /* (5./LATEX_UNIT) */
  581. ! #define LATEX_HCHAR (DOTS_PER_INCH*53/10/72)    /* (5.3/LATEX_UNIT) */
  582. ! #define LATEX_VCHAR (DOTS_PER_INCH*11/72)    /* (11./LATEX_UNIT) */
  583.   
  584.   static int LATEX_posx;
  585.   static int LATEX_posy;
  586. ***************
  587. *** 60,66
  588.   /* POINTS */
  589.   #define LATEX_POINT_TYPES 12    /* we supply more point types */
  590.   static char *LATEX_points[] = {
  591. !     "\\makebox(0,0){$\\Diamond$}",
  592.       "\\makebox(0,0){$+$}",
  593.       "\\makebox(0,0){$\\Box$}",
  594.       "\\makebox(0,0){$\\times$}",
  595.  
  596. --- 61,67 -----
  597.   /* POINTS */
  598.   #define LATEX_POINT_TYPES 12    /* we supply more point types */
  599.   static char *LATEX_points[] = {
  600. !     "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Diamond$}}",
  601.       "\\makebox(0,0){$+$}",
  602.       "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Box$}}",
  603.       "\\makebox(0,0){$\\times$}",
  604. ***************
  605. *** 62,68
  606.   static char *LATEX_points[] = {
  607.       "\\makebox(0,0){$\\Diamond$}",
  608.       "\\makebox(0,0){$+$}",
  609. !     "\\makebox(0,0){$\\Box$}",
  610.       "\\makebox(0,0){$\\times$}",
  611.       "\\makebox(0,0){$\\triangle$}",
  612.       "\\makebox(0,0){$\\star$}",
  613.  
  614. --- 63,69 -----
  615.   static char *LATEX_points[] = {
  616.       "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Diamond$}}",
  617.       "\\makebox(0,0){$+$}",
  618. !     "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Box$}}",
  619.       "\\makebox(0,0){$\\times$}",
  620.       "\\makebox(0,0){$\\triangle$}",
  621.       "\\makebox(0,0){$\\star$}",
  622. ***************
  623. *** 78,89
  624.       float size;            /* size of dot, or thick of line in points */
  625.       float dotspace;            /* inter-dot space in points; 0 for lines */
  626.   } LATEX_lines[] = {
  627. !     {.4, 0},                /* thin solid line */
  628. !     {1.0, 0},                /* thick solid line */
  629. !     {2.0, 0},                /* Thick solid line */
  630. !     {.4, 5},                /* dotted line */
  631. !     {.4, 10},                /* widely dotted line */
  632. !     {.4, 15}                /* really widely dotted line */
  633.   };
  634.   /* for drawing dotted and solid lines */
  635.   static void LATEX_dot_line();
  636.  
  637. --- 79,90 -----
  638.       float size;            /* size of dot, or thick of line in points */
  639.       float dotspace;            /* inter-dot space in points; 0 for lines */
  640.   } LATEX_lines[] = {
  641. !     {.4, 0.0},                /* thin solid line */
  642. !     {1.0, 0.0},                /* thick solid line */
  643. !     {2.0, 0.0},                /* Thick solid line */
  644. !     {.4, 5.0},                /* dotted line */
  645. !     {.4, 10.0},                /* widely dotted line */
  646. !     {.4, 15.0}                /* really widely dotted line */
  647.   };
  648.   /* for drawing dotted and solid lines */
  649.   static void LATEX_dot_line();
  650. ***************
  651. *** 93,98
  652.   static BOOLEAN LATEX_moved = TRUE;    /* pen is up after move */
  653.   static float LATEX_dotsize;    /* size of LATEX_DOT in units */
  654.   
  655.   /* ARROWS */
  656.   /* the set of non-vertical/non-horizontal LaTeX vector slopes */
  657.   /* except negatives - they are handled specially */
  658.  
  659. --- 94,104 -----
  660.   static BOOLEAN LATEX_moved = TRUE;    /* pen is up after move */
  661.   static float LATEX_dotsize;    /* size of LATEX_DOT in units */
  662.   
  663. + #ifdef EMTEX
  664. + BOOLEAN emtex=FALSE; /* not currently using emtex */
  665. + static void EMTEX_solid_line();
  666. + #endif
  667.   /* ARROWS */
  668.   /* the set of non-vertical/non-horizontal LaTeX vector slopes */
  669.   /* except negatives - they are handled specially */
  670. ***************
  671. *** 109,114
  672.   
  673.   LATEX_init()
  674.   {
  675.       LATEX_posx = LATEX_posy = 0;
  676.       LATEX_linetype(-1);
  677.       fprintf(outfile, "%% GNUPLOT: LaTeX picture\n");
  678.  
  679. --- 115,123 -----
  680.   
  681.   LATEX_init()
  682.   {
  683. + #ifdef EMTEX
  684. +     emtex = FALSE;
  685. + #endif
  686.       LATEX_posx = LATEX_posy = 0;
  687.       LATEX_linetype(-1);
  688.       fprintf(outfile, "%% GNUPLOT: LaTeX picture\n");
  689. ***************
  690. *** 152,157
  691.       if (linetype >= LATEX_LINE_TYPES)
  692.        linetype %= LATEX_LINE_TYPES;
  693.   
  694.       LATEX_flushrule();
  695.   
  696.       if (linetype >= 0 && 
  697.  
  698. --- 161,169 -----
  699.       if (linetype >= LATEX_LINE_TYPES)
  700.        linetype %= LATEX_LINE_TYPES;
  701.   
  702. + #ifdef EMTEX
  703. +     if (!emtex)
  704. + #endif
  705.       LATEX_flushrule();
  706.   
  707.       if (linetype >= 0 && 
  708. ***************
  709. *** 155,167
  710.       LATEX_flushrule();
  711.   
  712.       if (linetype >= 0 && 
  713. !        LATEX_lines[linetype].size != LATEX_lines[LATEX_type].size) 
  714. !      /* redefine \plotpoint */
  715. !      fprintf(outfile, "\\sbox{\\plotpoint}{\\rule[%.3fpt]{%.3fpt}{%.3fpt}}\n",
  716. !             -LATEX_lines[linetype].size/2,
  717. !             LATEX_lines[linetype].size,
  718. !             LATEX_lines[linetype].size);
  719.       LATEX_type = linetype;
  720.       LATEX_dotsize = LATEX_lines[linetype].size / LATEX_UNIT;
  721.       LATEX_moved = TRUE;            /* reset */
  722.  
  723. --- 167,187 -----
  724.       LATEX_flushrule();
  725.   
  726.       if (linetype >= 0 && 
  727. !        (LATEX_type < 0 ||
  728. !         LATEX_lines[linetype].size != LATEX_lines[LATEX_type].size)) {
  729. !         /* redefine \plotpoint */
  730. !         fprintf(outfile, 
  731. !             "\\sbox{\\plotpoint}{\\rule[%.3fpt]{%.3fpt}{%.3fpt}}%%\n",
  732. !             -LATEX_lines[linetype].size/2,
  733. !             LATEX_lines[linetype].size,
  734. !             LATEX_lines[linetype].size);
  735. ! #ifdef EMTEX
  736. !         if (emtex)         /* change line width */
  737. !             fprintf(outfile, "\\special{em:linewidth %.1fpt}%%\n",
  738. !                 LATEX_lines[linetype].size);
  739. ! #endif
  740. !     }
  741. !     
  742.       LATEX_type = linetype;
  743.       LATEX_dotsize 
  744.        = ((linetype >= 0) ? LATEX_lines[linetype].size / LATEX_UNIT : 0);
  745. ***************
  746. *** 163,169
  747.               LATEX_lines[linetype].size);
  748.   
  749.       LATEX_type = linetype;
  750. !     LATEX_dotsize = LATEX_lines[linetype].size / LATEX_UNIT;
  751.       LATEX_moved = TRUE;            /* reset */
  752.   }
  753.   
  754.  
  755. --- 183,190 -----
  756.       }
  757.       
  758.       LATEX_type = linetype;
  759. !     LATEX_dotsize 
  760. !      = ((linetype >= 0) ? LATEX_lines[linetype].size / LATEX_UNIT : 0);
  761.       LATEX_moved = TRUE;            /* reset */
  762.   }
  763.   
  764. ***************
  765. *** 209,215
  766.          }
  767.       } else {                /* drawing real curves */
  768.          if (LATEX_lines[LATEX_type].dotspace == 0.0)
  769. !         LATEX_solid_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
  770.          else
  771.           LATEX_dot_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
  772.       }
  773.  
  774. --- 230,241 -----
  775.          }
  776.       } else {                /* drawing real curves */
  777.          if (LATEX_lines[LATEX_type].dotspace == 0.0)
  778. ! #ifdef EMTEX
  779. !         if (emtex)
  780. !            EMTEX_solid_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
  781. !         else
  782. ! #endif
  783. !            LATEX_solid_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
  784.          else
  785.           LATEX_dot_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
  786.       }
  787. ***************
  788. *** 301,315
  789.        if (width == 0 || height == 0)
  790.          return;            /* ignore this rule */
  791.   
  792. -     if (width < 0) {
  793. -        x += width;
  794. -        width = -width;
  795. -     }
  796. -     if (height < 0) {
  797. -        y += height;
  798. -        height = -height;
  799. -     }
  800.       if (valid && combine) {
  801.          /* try to combine new rule with old rule */
  802.          if ((int)lastx == (int)x && lastw == width) { /* vertical rule */
  803.  
  804. --- 327,332 -----
  805.        if (width == 0 || height == 0)
  806.          return;            /* ignore this rule */
  807.   
  808.       if (valid && combine) {
  809.          /* try to combine new rule with old rule */
  810.          if ((int)lastx == (int)x && lastw == width) { /* vertical rule */
  811. ***************
  812. *** 313,320
  813.       if (valid && combine) {
  814.          /* try to combine new rule with old rule */
  815.          if ((int)lastx == (int)x && lastw == width) { /* vertical rule */
  816. !           lasth += height;
  817. !           return;
  818.          } else if ((int)lasty == (int)y && lasth == height){ /* horiz rule */
  819.             lastw += width;
  820.             return;
  821.  
  822. --- 330,339 -----
  823.       if (valid && combine) {
  824.          /* try to combine new rule with old rule */
  825.          if ((int)lastx == (int)x && lastw == width) { /* vertical rule */
  826. !           if (lasth * height >= 0) { /* same sign */
  827. !              lasth += height;
  828. !              return;
  829. !           }
  830.          } else if ((int)lasty == (int)y && lasth == height){ /* horiz rule */
  831.             if (lastw * width >= 0) { /* same sign */
  832.                lastw += width;
  833. ***************
  834. *** 316,323
  835.             lasth += height;
  836.             return;
  837.          } else if ((int)lasty == (int)y && lasth == height){ /* horiz rule */
  838. !           lastw += width;
  839. !           return;
  840.          }
  841.          /* oh well, output last and remember the new one */
  842.       }
  843.  
  844. --- 335,344 -----
  845.                return;
  846.             }
  847.          } else if ((int)lasty == (int)y && lasth == height){ /* horiz rule */
  848. !           if (lastw * width >= 0) { /* same sign */
  849. !              lastw += width;
  850. !              return;
  851. !           }
  852.          }
  853.          /* oh well, output last and remember the new one */
  854.       }
  855. ***************
  856. *** 322,336
  857.          /* oh well, output last and remember the new one */
  858.       }
  859.   
  860. !     if (valid)
  861. !      /* if very small use canned dot */
  862. !      if (lastw < LATEX_dotsize || lasth < LATEX_dotsize)
  863. !        fprintf(outfile, "\\put(%d,%d){%s}\n",       
  864. !              (int)lastx, (int)lasty, LATEX_DOT);
  865. !      else
  866. !        fprintf(outfile, "\\put(%d,%d){\\rule[%.3fpt]{%.3fpt}{%.3fpt}}\n",
  867. !              (int)lastx, (int)lasty, -LATEX_dotsize*LATEX_UNIT/2,
  868. !              lastw*LATEX_UNIT, lasth*LATEX_UNIT);
  869.       
  870.       if (flush) {
  871.          valid = FALSE;
  872.  
  873. --- 343,368 -----
  874.          /* oh well, output last and remember the new one */
  875.       }
  876.   
  877. !     if (valid) {
  878. !        /* output the rule */
  879. !        if (lastw < 0) {
  880. !           lastx += lastw;
  881. !           lastw = -lastw;
  882. !        }
  883. !        if (lasth < 0) {
  884. !           lasty += lasth;
  885. !           lasth = -lasth;
  886. !        }
  887. !        /* if very small use canned dot */
  888. !        if (lastw < LATEX_dotsize || lasth < LATEX_dotsize)
  889. !         fprintf(outfile, "\\put(%d,%d){%s}\n",       
  890. !                (int)lastx, (int)lasty, LATEX_DOT);
  891. !        else
  892. !         fprintf(outfile, "\\put(%d,%d){\\rule[%.3fpt]{%.3fpt}{%.3fpt}}\n",
  893. !                (int)lastx, (int)lasty, -LATEX_dotsize*LATEX_UNIT/2,
  894. !                lastw*LATEX_UNIT, lasth*LATEX_UNIT);
  895. !     }
  896.       
  897.       if (flush) {
  898.          valid = FALSE;
  899. ***************
  900. *** 418,424
  901.       int x, y;                /* points near sx,sy */
  902.       float m;                /* slope of line */
  903.       float arrowslope;        /* slope of arrow */
  904. !     float minerror;            /* best-case error */
  905.       struct vslope *slope;    /* one of the slopes */
  906.       struct vslope *bestslope;    /* the slope with min error */
  907.       BOOLEAN horiz;            /* was it the horiz line that was best? */
  908.  
  909. --- 450,456 -----
  910.       int x, y;                /* points near sx,sy */
  911.       float m;                /* slope of line */
  912.       float arrowslope;        /* slope of arrow */
  913. !     float minerror = 0;        /* best-case error */
  914.       struct vslope *slope;    /* one of the slopes */
  915.       struct vslope *bestslope;    /* the slope with min error */
  916.       BOOLEAN horiz;            /* was it the horiz line that was best? */
  917. ***************
  918. *** 440,445
  919.           * we try to find the closest-slope arrowhead.
  920.           */
  921.          bestslope = NULL;
  922.          m = abs((float)dy/dx); /* the slope we want */
  923.          for (slope = LATEX_slopes; slope->dx != 0.0; slope++) {
  924.             /* find the slope of the arrow */
  925.  
  926. --- 472,478 -----
  927.           * we try to find the closest-slope arrowhead.
  928.           */
  929.          bestslope = NULL;
  930. +        minerror = 0; /* to shut up turbo C */
  931.          m = abs((float)dy/dx); /* the slope we want */
  932.          for (slope = LATEX_slopes; slope->dx != 0.0; slope++) {
  933.             /* find the slope of the arrow */
  934. ***************
  935. *** 459,465
  936.                  abs(ex-sx));
  937.          else {
  938.             /* we draw the line the usual way, with thin lines */
  939. !           if (who == 1) {
  940.                LATEX_linetype(LATEX_THIN_LINE);
  941.                LATEX_solid_line(sx,ex,sy,ey);
  942.             }
  943.  
  944. --- 492,499 -----
  945.                  abs(ex-sx));
  946.          else {
  947.             /* we draw the line the usual way, with thin lines */
  948. ! #ifdef EMTEX
  949. !           if (emtex) {
  950.                LATEX_linetype(LATEX_THIN_LINE);
  951.                EMTEX_solid_line(sx,ex,sy,ey);
  952.             } else 
  953. ***************
  954. *** 461,468
  955.             /* we draw the line the usual way, with thin lines */
  956.             if (who == 1) {
  957.                LATEX_linetype(LATEX_THIN_LINE);
  958. !              LATEX_solid_line(sx,ex,sy,ey);
  959. !           }
  960.   #ifdef EEPIC
  961.             else {
  962.                EEPIC_move(sx,sy);
  963.  
  964. --- 495,507 -----
  965.   #ifdef EMTEX
  966.             if (emtex) {
  967.                LATEX_linetype(LATEX_THIN_LINE);
  968. !              EMTEX_solid_line(sx,ex,sy,ey);
  969. !           } else 
  970. ! #endif
  971. !             if (who == 1) {
  972. !                LATEX_linetype(LATEX_THIN_LINE);
  973. !                LATEX_solid_line(sx,ex,sy,ey);
  974. !             }
  975.   #ifdef EEPIC
  976.               else {
  977.                  EEPIC_move(sx,sy);
  978. ***************
  979. *** 464,473
  980.                LATEX_solid_line(sx,ex,sy,ey);
  981.             }
  982.   #ifdef EEPIC
  983. !           else {
  984. !              EEPIC_move(sx,sy);
  985. !              EEPIC_vector(ex,ey);
  986. !           }
  987.   #endif /* EEPIC */
  988.             /* and then draw an arrowhead (a short vector) there */
  989.             fprintf(outfile, "\\put(%d,%d){\\vector(%d,%d){0}}\n",
  990.  
  991. --- 503,512 -----
  992.                  LATEX_solid_line(sx,ex,sy,ey);
  993.               }
  994.   #ifdef EEPIC
  995. !             else {
  996. !                EEPIC_move(sx,sy);
  997. !                EEPIC_vector(ex,ey);
  998. !             }
  999.   #endif /* EEPIC */
  1000.             /* and then draw an arrowhead (a short vector) there */
  1001.             fprintf(outfile, "\\put(%d,%d){\\vector(%d,%d){0}}\n",
  1002. ***************
  1003. *** 555,557
  1004.       LATEX_posx = LATEX_posy = 0;
  1005.   }
  1006.   
  1007.  
  1008. --- 594,638 -----
  1009.       LATEX_posx = LATEX_posy = 0;
  1010.   }
  1011.   
  1012. + #ifdef EMTEX
  1013. + EMTEX_init()
  1014. + {
  1015. +     emtex=TRUE;
  1016. +     LATEX_posx = LATEX_posy = 0;
  1017. +     fprintf(outfile, "%% GNUPLOT: LaTeX picture with emtex specials\n");
  1018. +     fprintf(outfile, "\\setlength{\\unitlength}{%fpt}\n", LATEX_UNIT);
  1019. +     LATEX_linetype(-1);
  1020. + }
  1021. + EMTEX_reset()
  1022. + {
  1023. +     emtex=FALSE;
  1024. +     LATEX_posx = LATEX_posy = 0;
  1025. + }
  1026. + EMTEX_text()
  1027. + {
  1028. +     fprintf(outfile, "\\end{picture}\n");
  1029. + }
  1030. + static void
  1031. + EMTEX_solid_line(x1,x2, y1,y2)
  1032. +     int x1,x2, y1,y2;
  1033. + {
  1034. +     /* emtex special solid line */
  1035. +     if (LATEX_moved)
  1036. +         fprintf(outfile, "\\put(%d,%d){\\special{em:moveto}}\n", x1, y1);
  1037. +     if ( (x1!=x2) || (y1!=y2) )
  1038. +         fprintf(outfile, "\\put(%d,%d){\\special{em:lineto}}\n", x2, y2);
  1039. +     LATEX_posx = x2;
  1040. +     LATEX_posy = y2;
  1041. +     LATEX_moved = FALSE;
  1042. + }
  1043. + #endif /* EMTEX */
  1044. diff -c ./term/pc.trm ../patch/term/pc.trm
  1045. *** ./term/pc.trm    Tue Mar 27 09:03:04 1990
  1046. --- ../patch/term/pc.trm    Tue Aug 28 20:52:11 1990
  1047. ***************
  1048. *** 20,26
  1049.    *  Under Microsoft C
  1050.    *      cga, egabios, egalib, vgabios, hercules, corona325, att
  1051.    *  Under Turboc C
  1052. !  *      egalib, vgalib, vgamono, mcga, cga, hercules
  1053.    *
  1054.    * AUTHORS
  1055.    *  Colin Kelley, Thomas Williams, William Wilson, Russell Lang
  1056.  
  1057. --- 20,26 -----
  1058.    *  Under Microsoft C
  1059.    *      cga, egabios, egalib, vgabios, hercules, corona325, att
  1060.    *  Under Turboc C
  1061. !  *      egalib, vgalib, vgamono, mcga, cga, hercules, att
  1062.    *
  1063.    * AUTHORS
  1064.    *  Colin Kelley, Thomas Williams, William Wilson, Russell Lang
  1065. ***************
  1066. *** 110,116
  1067.               pixelon = (((unsigned int)(font5x7[i][j])) >> k & 1);
  1068.               if (pixelon) {
  1069.                   switch(angle) {
  1070. !                     case 0 : line_func(x+k+1,y-j,x+k+1,y-j);
  1071.                               break;
  1072.                       case 1 : line_func(x-j,y-k-1,x-j,y-k-1);
  1073.                               break;
  1074.  
  1075. --- 110,116 -----
  1076.               pixelon = (((unsigned int)(font5x7[i][j])) >> k & 1);
  1077.               if (pixelon) {
  1078.                   switch(angle) {
  1079. !                     case 0 : (*line_func)(x+k+1,y-j,x+k+1,y-j);
  1080.                               break;
  1081.                       case 1 : (*line_func)(x-j,y-k-1,x-j,y-k-1);
  1082.                               break;
  1083. ***************
  1084. *** 112,118
  1085.                   switch(angle) {
  1086.                       case 0 : line_func(x+k+1,y-j,x+k+1,y-j);
  1087.                               break;
  1088. !                     case 1 : line_func(x-j,y-k-1,x-j,y-k-1);
  1089.                               break;
  1090.                   }
  1091.               }
  1092.  
  1093. --- 112,118 -----
  1094.                   switch(angle) {
  1095.                       case 0 : (*line_func)(x+k+1,y-j,x+k+1,y-j);
  1096.                               break;
  1097. !                     case 1 : (*line_func)(x-j,y-k-1,x-j,y-k-1);
  1098.                               break;
  1099.                   }
  1100.               }
  1101. ***************
  1102. *** 1197,1202
  1103.       outtextxy(x,HERC_YLAST-y,buf);
  1104.   }
  1105.   
  1106.   
  1107.   #endif /* ifndef __TURBOC__ */
  1108.   
  1109.  
  1110. --- 1197,1301 -----
  1111.       outtextxy(x,HERC_YLAST-y,buf);
  1112.   }
  1113.   
  1114. + #ifdef ATT6300
  1115. + /* this driver added by rjl@monu1.cc.monash.edu.au */
  1116. + #define ATT_XMAX 640
  1117. + #define ATT_YMAX 400
  1118. + #define ATT_XLAST (ATT_XMAX - 1)
  1119. + #define ATT_YLAST (ATT_YMAX - 1)
  1120. + #define ATT_VCHAR PC_VCHAR
  1121. + #define ATT_HCHAR PC_HCHAR
  1122. + #define ATT_VTIC 4
  1123. + #define ATT_HTIC 5
  1124. + #define ATT_text_angle PC_text_angle
  1125. + #define ATT_justify_text PC_justify_text
  1126. + #define ATT_reset PC_reset
  1127. + ATT_init()
  1128. + {
  1129. +     g_driver=ATT400;
  1130. +     g_mode=5;
  1131. +       initgraph(&g_driver,&g_mode,path);
  1132. +           switch (g_driver){
  1133. +             case -2: fprintf(stderr,"Graphics card not detected.\n");
  1134. +                      break;
  1135. +             case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
  1136. +                      break;
  1137. +             case -4: fprintf(stderr,"Invalid BGI driver file.\n");
  1138. +                      break;
  1139. +             case -5: fprintf(stderr,"Insufficient memory to load ",
  1140. +                              "graphics driver.");
  1141. +                      break;
  1142. +             }
  1143. + }
  1144. + ATT_graphics()
  1145. + {
  1146. +     g_driver=ATT400;
  1147. +     g_mode=5;
  1148. +     initgraph(&g_driver,&g_mode,path);
  1149. +     ATT_justify_text(LEFT);
  1150. +     graphics_on = TRUE;
  1151. + }
  1152. + ATT_text()
  1153. + {
  1154. +     if (graphics_on) {
  1155. +         graphics_on = FALSE;
  1156. +         pause();
  1157. +     }
  1158. +     closegraph();
  1159. + }
  1160. + ATT_linetype(linetype)
  1161. + {
  1162. +     if (linetype >= 5)
  1163. +         linetype %= 5;
  1164. +     setlinestyle(4,pattern[linetype+2],1);
  1165. + }
  1166. + ATT_move(x,y)
  1167. + {
  1168. +     if (x < 0)
  1169. +         x = 0;
  1170. +     else if (x > ATT_XLAST)
  1171. +         x = ATT_XLAST;
  1172. +     if (y < 0)
  1173. +         y = 0;
  1174. +     else if (y > ATT_YLAST)
  1175. +         y = ATT_YLAST;
  1176. +     moveto(x,getmaxy()-y);
  1177. + }
  1178. + ATT_vector(x,y)
  1179. + {
  1180. +     if (x < 0)
  1181. +         x = 0;
  1182. +     else if (x > ATT_XLAST)
  1183. +         x = ATT_XLAST;
  1184. +     if (y < 0)
  1185. +         y = 0;
  1186. +     else if (y > ATT_YLAST)
  1187. +         y = ATT_YLAST;
  1188. +     lineto(x,getmaxy()-y);
  1189. + }
  1190. + ATT_put_text(x,y,str)
  1191. + unsigned int x, y;
  1192. + char *str;
  1193. + {
  1194. +     strcpy((char far *)buf,str);
  1195. +     outtextxy(x,ATT_YLAST-y,buf);
  1196. + }
  1197. + #endif /* ifdef ATT6300 */
  1198.   
  1199.   #endif /* ifndef __TURBOC__ */
  1200.   
  1201. diff -c ./term/post.trm ../patch/term/post.trm
  1202. *** ./term/post.trm    Tue Mar 27 09:02:51 1990
  1203. --- ../patch/term/post.trm    Tue Sep 18 14:40:31 1990
  1204. ***************
  1205. *** 40,46
  1206.   "/vpt2 vpt 2 mul def\n",
  1207.   "/hpt2 hpt 2 mul def\n",
  1208.   /* flush left show */
  1209. ! "/Lshow { 0 vshift rmoveto show } def\n", 
  1210.   /* flush right show */
  1211.   "/Rshow { dup stringwidth pop neg vshift rmoveto show } def\n", 
  1212.   /* centred show */
  1213.  
  1214. --- 40,47 -----
  1215.   "/vpt2 vpt 2 mul def\n",
  1216.   "/hpt2 hpt 2 mul def\n",
  1217.   /* flush left show */
  1218. ! "/Lshow { currentpoint stroke moveto\n",
  1219. ! "  0 vshift rmoveto show } def\n", 
  1220.   /* flush right show */
  1221.   "/Rshow { currentpoint stroke moveto\n",
  1222.   "  dup stringwidth pop neg vshift rmoveto show } def\n", 
  1223. ***************
  1224. *** 42,48
  1225.   /* flush left show */
  1226.   "/Lshow { 0 vshift rmoveto show } def\n", 
  1227.   /* flush right show */
  1228. ! "/Rshow { dup stringwidth pop neg vshift rmoveto show } def\n", 
  1229.   /* centred show */
  1230.   "/Cshow { dup stringwidth pop -2 div vshift rmoveto show } def\n", 
  1231.   /* Border Lines */
  1232.  
  1233. --- 43,50 -----
  1234.   "/Lshow { currentpoint stroke moveto\n",
  1235.   "  0 vshift rmoveto show } def\n", 
  1236.   /* flush right show */
  1237. ! "/Rshow { currentpoint stroke moveto\n",
  1238. ! "  dup stringwidth pop neg vshift rmoveto show } def\n", 
  1239.   /* centred show */
  1240.   "/Cshow { currentpoint stroke moveto\n",
  1241.   "  dup stringwidth pop -2 div vshift rmoveto show } def\n", 
  1242. ***************
  1243. *** 44,50
  1244.   /* flush right show */
  1245.   "/Rshow { dup stringwidth pop neg vshift rmoveto show } def\n", 
  1246.   /* centred show */
  1247. ! "/Cshow { dup stringwidth pop -2 div vshift rmoveto show } def\n", 
  1248.   /* Border Lines */
  1249.   "/BL { stroke gnulinewidth 2 mul setlinewidth} def\n",
  1250.   /* Axes Lines */
  1251.  
  1252. --- 46,53 -----
  1253.   "/Rshow { currentpoint stroke moveto\n",
  1254.   "  dup stringwidth pop neg vshift rmoveto show } def\n", 
  1255.   /* centred show */
  1256. ! "/Cshow { currentpoint stroke moveto\n",
  1257. ! "  dup stringwidth pop -2 div vshift rmoveto show } def\n", 
  1258.   /* Border Lines */
  1259.   "/BL { stroke gnulinewidth 2 mul setlinewidth } def\n",
  1260.   /* Axes Lines */
  1261. ***************
  1262. *** 46,52
  1263.   /* centred show */
  1264.   "/Cshow { dup stringwidth pop -2 div vshift rmoveto show } def\n", 
  1265.   /* Border Lines */
  1266. ! "/BL { stroke gnulinewidth 2 mul setlinewidth} def\n",
  1267.   /* Axes Lines */
  1268.   "/AL { stroke gnulinewidth 2 div setlinewidth } def\n",
  1269.   /* Plot Lines */
  1270.  
  1271. --- 49,55 -----
  1272.   "/Cshow { currentpoint stroke moveto\n",
  1273.   "  dup stringwidth pop -2 div vshift rmoveto show } def\n", 
  1274.   /* Border Lines */
  1275. ! "/BL { stroke gnulinewidth 2 mul setlinewidth } def\n",
  1276.   /* Axes Lines */
  1277.   "/AL { stroke gnulinewidth 2 div setlinewidth } def\n",
  1278.   /* Plot Lines */
  1279. ***************
  1280. *** 102,109
  1281.   #define PS_HTIC (PS_YMAX/80)
  1282.   
  1283.   
  1284. ! #define PS_SC (360.0/PS_XMAX)        /* scale is 1pt = 10 units */
  1285. ! #define    PS_LW (0.25/PS_SC)            /* linewidth = 0.25 pts */
  1286.   
  1287.   #define PS_VCHAR1 (int)(7.0/PS_SC)    /* 7 point characters */
  1288.   #define PS_HCHAR1 (int)(0.6*7.0/PS_SC)
  1289.  
  1290. --- 105,112 -----
  1291.   #define PS_HTIC (PS_YMAX/80)
  1292.   
  1293.   
  1294. ! #define PS_SC (PS_XMAX/360)        /* scale is 1pt = 10 units */
  1295. ! #define    PS_LW (0.25*PS_SC)        /* linewidth = 0.25 pts */
  1296.   
  1297.   #define PS_VCHAR1 (7*PS_SC)        /* 7 point characters */
  1298.   #define PS_HCHAR1 (7*PS_SC*6/10)
  1299. ***************
  1300. *** 105,112
  1301.   #define PS_SC (360.0/PS_XMAX)        /* scale is 1pt = 10 units */
  1302.   #define    PS_LW (0.25/PS_SC)            /* linewidth = 0.25 pts */
  1303.   
  1304. ! #define PS_VCHAR1 (int)(7.0/PS_SC)    /* 7 point characters */
  1305. ! #define PS_HCHAR1 (int)(0.6*7.0/PS_SC)
  1306.   
  1307.   #define PS_VCHAR2 (int)(11.0/PS_SC)    /* 11 point characters */
  1308.   #define PS_HCHAR2 (int)(0.6*11.0/PS_SC)
  1309.  
  1310. --- 108,115 -----
  1311.   #define PS_SC (PS_XMAX/360)        /* scale is 1pt = 10 units */
  1312.   #define    PS_LW (0.25*PS_SC)        /* linewidth = 0.25 pts */
  1313.   
  1314. ! #define PS_VCHAR1 (7*PS_SC)        /* 7 point characters */
  1315. ! #define PS_HCHAR1 (7*PS_SC*6/10)
  1316.   
  1317.   #define PS_VCHAR2 (11*PS_SC)        /* 11 point characters */
  1318.   #define PS_HCHAR2 (11*PS_SC*6/10)
  1319. ***************
  1320. *** 108,115
  1321.   #define PS_VCHAR1 (int)(7.0/PS_SC)    /* 7 point characters */
  1322.   #define PS_HCHAR1 (int)(0.6*7.0/PS_SC)
  1323.   
  1324. ! #define PS_VCHAR2 (int)(11.0/PS_SC)    /* 11 point characters */
  1325. ! #define PS_HCHAR2 (int)(0.6*11.0/PS_SC)
  1326.   
  1327.   
  1328.   EPSF1_init()
  1329.  
  1330. --- 111,118 -----
  1331.   #define PS_VCHAR1 (7*PS_SC)        /* 7 point characters */
  1332.   #define PS_HCHAR1 (7*PS_SC*6/10)
  1333.   
  1334. ! #define PS_VCHAR2 (11*PS_SC)        /* 11 point characters */
  1335. ! #define PS_HCHAR2 (11*PS_SC*6/10)
  1336.   
  1337.   
  1338.   EPSF1_init()
  1339. ***************
  1340. *** 135,142
  1341.       fprintf(outfile,"%%%%DocumentFonts: %s\n", ps_font);
  1342.       fprintf(outfile,"%%%%DocumentNeededFonts: %s\n", ps_font);
  1343.       fprintf(outfile,"%%%%BoundingBox: 0 0 %d %d\n",
  1344. !         (int)(xsize*(PS_XMAX)*PS_SC+0.5), 
  1345. !         (int)(ysize*(PS_YMAX)*PS_SC+0.5) );
  1346.       fprintf(outfile,"%%%%EndComments\n");
  1347.       fprintf(outfile,"40 dict begin\n");
  1348.       fprintf(outfile,"/gnulinewidth %.3f def\n",PS_LW);
  1349.  
  1350. --- 138,145 -----
  1351.       fprintf(outfile,"%%%%DocumentFonts: %s\n", ps_font);
  1352.       fprintf(outfile,"%%%%DocumentNeededFonts: %s\n", ps_font);
  1353.       fprintf(outfile,"%%%%BoundingBox: 0 0 %d %d\n",
  1354. !         (int)(xsize*(PS_XMAX)/PS_SC+0.5), 
  1355. !         (int)(ysize*(PS_YMAX)/PS_SC+0.5) );
  1356.       fprintf(outfile,"%%%%EndComments\n");
  1357.       fprintf(outfile,"40 dict begin\n");
  1358.       fprintf(outfile,"/gnulinewidth %.3f def\n",PS_LW);
  1359. ***************
  1360. *** 142,148
  1361.       fprintf(outfile,"/gnulinewidth %.3f def\n",PS_LW);
  1362.       fprintf(outfile,"/vshift %d def\n", 
  1363.           ps_big ? -PS_VCHAR2/3 : -PS_VCHAR1/3);
  1364. !     fprintf(outfile,"/dl {%.3f mul} def\n",1/PS_SC); /* dash length */
  1365.       fprintf(outfile,"/hpt %.1f def\n",PS_HTIC/2.0);
  1366.       fprintf(outfile,"/vpt %.1f def\n",PS_VTIC/2.0);
  1367.       for ( i=0; PS_header[i] != NULL; i++)
  1368.  
  1369. --- 145,151 -----
  1370.       fprintf(outfile,"/gnulinewidth %.3f def\n",PS_LW);
  1371.       fprintf(outfile,"/vshift %d def\n", 
  1372.           ps_big ? -PS_VCHAR2/3 : -PS_VCHAR1/3);
  1373. !     fprintf(outfile,"/dl {%d mul} def\n",PS_SC); /* dash length */
  1374.       fprintf(outfile,"/hpt %.1f def\n",PS_HTIC/2.0);
  1375.       fprintf(outfile,"/vpt %.1f def\n",PS_VTIC/2.0);
  1376.       for ( i=0; PS_header[i] != NULL; i++)
  1377. ***************
  1378. *** 150,156
  1379.       fprintf(outfile,"%%%%EndProlog\n");
  1380.       fprintf(outfile,"%%%%BeginSetup\n");
  1381.       fprintf(outfile,"/Gnu_save save def\n");
  1382. !     fprintf(outfile,"%.3f %.3f scale\n",PS_SC,PS_SC);
  1383.       fprintf(outfile,"%%%%IncludeFont: %s\n", ps_font);
  1384.       fprintf(outfile,"/%s findfont %d ", ps_font, 
  1385.           ps_big ? PS_VCHAR2 : PS_VCHAR1 );
  1386.  
  1387. --- 153,160 -----
  1388.       fprintf(outfile,"%%%%EndProlog\n");
  1389.       fprintf(outfile,"%%%%BeginSetup\n");
  1390.       fprintf(outfile,"/Gnu_save save def\n");
  1391. !     fprintf(outfile,"%.3f %.3f scale\n",1.0/PS_SC,1.0/PS_SC);
  1392. !     fprintf(outfile,"0 setgray\n");
  1393.       fprintf(outfile,"%%%%IncludeFont: %s\n", ps_font);
  1394.       fprintf(outfile,"/%s findfont %d ", ps_font, 
  1395.           ps_big ? PS_VCHAR2 : PS_VCHAR1 );
  1396. ***************
  1397. *** 198,205
  1398.       fprintf(outfile,"%%%%DocumentNeededFonts: %s\n", ps_font);
  1399.       fprintf(outfile,"%%%%Pages: (atend)\n");
  1400.       fprintf(outfile,"%%%%BoundingBox: %d 50 550 %d\n",
  1401. !         (int)(550.5-ysize*(PS_YMAX)*PS_SC*2), 
  1402. !         (int)(50.5+xsize*(PS_XMAX)*PS_SC*2) );
  1403.       fprintf(outfile,"%%%%EndComments\n");
  1404.       fprintf(outfile,"/GnuTransform {\n");
  1405.       fprintf(outfile,"  90 rotate\n  50 -550 translate\n  2 2 scale\n");
  1406.  
  1407. --- 202,209 -----
  1408.       fprintf(outfile,"%%%%DocumentNeededFonts: %s\n", ps_font);
  1409.       fprintf(outfile,"%%%%Pages: (atend)\n");
  1410.       fprintf(outfile,"%%%%BoundingBox: %d 50 550 %d\n",
  1411. !         (int)(550.5-ysize*(PS_YMAX)/PS_SC*2), 
  1412. !         (int)(50.5+xsize*(PS_XMAX)/PS_SC*2) );
  1413.       fprintf(outfile,"%%%%EndComments\n");
  1414.       fprintf(outfile,"/GnuTransform {\n");
  1415.       fprintf(outfile,"  90 rotate\n  50 -550 translate\n  2 2 scale\n");
  1416. ***************
  1417. *** 292,297
  1418.       }
  1419.       if (ps_ang != 0)
  1420.           fprintf(outfile,"grestore\n");
  1421.   }
  1422.   
  1423.   int PS_text_angle(ang)
  1424.  
  1425. --- 296,302 -----
  1426.       }
  1427.       if (ps_ang != 0)
  1428.           fprintf(outfile,"grestore\n");
  1429. +     ps_path_count = 0;
  1430.   }
  1431.   
  1432.   int PS_text_angle(ang)
  1433. diff -c ./term/t410x.trm ../patch/term/t410x.trm
  1434. *** ./term/t410x.trm    Wed Aug 29 12:16:17 1990
  1435. --- ../patch/term/t410x.trm    Tue Aug 28 20:28:50 1990
  1436. ***************
  1437. *** 0
  1438.  
  1439. --- 1,239 -----
  1440. + /* GNUPLOT - t410x.trm */
  1441. + /*
  1442. +  * Copyright (C) 1990   
  1443. +  *
  1444. +  * Permission to use, copy, and distribute this software and its
  1445. +  * documentation for any purpose with or without fee is hereby granted, 
  1446. +  * provided that the above copyright notice appear in all copies and 
  1447. +  * that both that copyright notice and this permission notice appear 
  1448. +  * in supporting documentation.
  1449. +  *
  1450. +  * Permission to modify the software is granted, but not the right to
  1451. +  * distribute the modified code.  Modifications are to be distributed 
  1452. +  * as patches to released version.
  1453. +  *  
  1454. +  * This software  is provided "as is" without express or implied warranty.
  1455. +  * 
  1456. +  * This file is included by ../term.c.
  1457. +  *
  1458. +  * This terminal driver supports: Tektronix 410x and 420x series terminals
  1459. +  *
  1460. +  * AUTHORS
  1461. +  *   Colin Kelley, Thomas Williams
  1462. +  * 
  1463. +  * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  1464. +  * 
  1465. +  */
  1466. + /* Tektronix 410X and 420X driver written by Cary D. Renzema.
  1467. +  * email address: caryr@vice.ico.tek.com
  1468. +  *
  1469. +  * I've tested this driver on the following terminals: 4106, 4107A, 4109
  1470. +  * and 4207.  It should work, without editing, on other terminals in the
  1471. +  * 410x and 420x families.  It will probably need to be changed to work
  1472. +  * on a 4105 (screen size and character rotation are two guesses).  This
  1473. +  * file can also be used as a start for a 411x driver.
  1474. +  *
  1475. +  * Cary R.
  1476. +  * April 5, 1990
  1477. +  */
  1478. + #ifdef T410X
  1479. + #define T410XXMAX 4095
  1480. + #define T410XYMAX 3131
  1481. + #define T410XVCHAR    71
  1482. + #define T410XHCHAR    51
  1483. + #define T410XVTIC    36
  1484. + #define T410XHTIC    36    
  1485. + static int T410X_angle=0;
  1486. + T410X_init()
  1487. + {
  1488. +     (void) fprintf(outfile, "\033%%!0\033MN0\033MCB7C;\033MQ1\033MT1");
  1489. +     (void) fprintf(outfile, "\033MG1\033RK!\033SK!\033LZ\033%%!1");
  1490. + /*
  1491. +      1. set tek mode
  1492. +      2. set character path to 0 (characters placed equal to rotation)
  1493. +      3. set character size to 59 height
  1494. +      4. set character precision to string
  1495. +      5. set character text index to 1
  1496. +      6. set character write mode to overstrike
  1497. +      7. clear the view
  1498. +      8. clear the segments
  1499. +      9. clear the dialog buffer
  1500. +     10. set ansi mode
  1501. + */
  1502. +     (void) fflush(outfile);
  1503. + }
  1504. + T410X_reset()
  1505. + {
  1506. +     (void) fprintf(outfile, "\033%%!0\033LZ\033%%!1");
  1507. + /*
  1508. +     1. set tek mode
  1509. +     2. clear the dialog buffer
  1510. +     3. set ansi mode
  1511. + */
  1512. +     (void) fflush(outfile);
  1513. + }
  1514. + T410X_graphics()
  1515. + {
  1516. +     (void) fprintf(outfile, "\033%%!0\033\014\033LV0");
  1517. + /*
  1518. +     1. set tek mode
  1519. +     2. clear the screen
  1520. +     3. set dialog area invisible
  1521. + */
  1522. +     (void) fflush(outfile);
  1523. + }
  1524. + T410X_text()
  1525. + {
  1526. +     (void) fprintf(outfile, "\033LV1\033%%!1");
  1527. + /*
  1528. +     1. set dialog area visible
  1529. +     2. set ansi mode
  1530. + */
  1531. +     (void) fflush(outfile);
  1532. + }
  1533. + T410X_move(x, y)
  1534. + unsigned int x, y;
  1535. + {
  1536. +     (void) fprintf(outfile, "\033LF");
  1537. +     (void) T410X_encode_x_y(x, y);
  1538. +     (void) fflush(outfile);
  1539. + }
  1540. + T410X_vector(x, y)
  1541. + unsigned int x, y;
  1542. + {
  1543. +     (void) fprintf(outfile, "\033LG");
  1544. +     (void) T410X_encode_x_y(x, y);
  1545. +     (void) fflush(outfile);
  1546. + }
  1547. + T410X_point(x, y, number)
  1548. + unsigned int x, y;
  1549. + int number;
  1550. + {
  1551. +     (void) fprintf(outfile, "\033MM");
  1552. +     (void) T410X_encode_int(max(number, 0)%11);
  1553. +     (void) fprintf(outfile, "\033LH");
  1554. +     (void) T410X_encode_x_y(x, y);
  1555. +     (void) fflush(outfile);
  1556. + }
  1557. + T410X_linetype(linetype)
  1558. + int linetype;
  1559. + {
  1560. +     switch (linetype) {
  1561. +         case -1:
  1562. +             (void) fprintf(outfile, "\033ML5");
  1563. +             break;
  1564. +         case -2:
  1565. +             (void) fprintf(outfile, "\033ML?");
  1566. +             break;
  1567. +         default:
  1568. +             (void) fprintf(outfile, "\033ML");
  1569. +             (void) T410X_encode_int(linetype%14+2);
  1570. +             break;
  1571. +     }
  1572. +     (void) fprintf(outfile, "\033MV");
  1573. +     (void) T410X_encode_int(max(linetype, 0)%8);
  1574. +     (void) fflush(outfile);
  1575. + }
  1576. + T410X_put_text(x, y, str)
  1577. + unsigned int x, y;
  1578. + char str[];
  1579. + {
  1580. +     extern int T410X_angle;
  1581. +     if (T410X_angle == 0) {
  1582. +         (void) T410X_move(x, y-T410XVCHAR/2+6);
  1583. +         (void) fprintf(outfile, "\033MR00");
  1584. +     } else {
  1585. +         (void) T410X_move(x+T410XHCHAR/2-6, y);
  1586. +         (void) fprintf(outfile, "\033MRE:0");
  1587. +     }
  1588. +     (void) fprintf(outfile, "\033LT");
  1589. +     (void) T410X_encode_int(strlen(str));
  1590. +     (void) fputs(str, outfile);
  1591. +     (void) fflush(outfile);
  1592. + }
  1593. + T410X_text_angle(ang)
  1594. + int ang;
  1595. + {
  1596. +     extern int T410X_angle;
  1597. +     T410X_angle = ang;
  1598. +     return(TRUE);
  1599. + }
  1600. + /* These last two routines are based on fortran code found in the
  1601. +  * 4106/4107/4109/CX PROGRAMMERS manual.
  1602. +  */
  1603. + T410X_encode_x_y(x, y)
  1604. + unsigned int x, y;
  1605. + {
  1606. +     static char chix=0, chiy=0, cloy=0, ceb=0;
  1607. +     register unsigned int hix, lox, hiy, loy, eb, lx, ly;
  1608. +     lx = (x <= T410XXMAX) ? x : T410XXMAX;
  1609. +     ly = (y <= T410XYMAX) ? y : T410XYMAX;
  1610. +     hix = lx/128 + 32;
  1611. +     lox = (lx/4)%32 + 64;
  1612. +     hiy = ly/128 + 32;
  1613. +     loy = (ly/4)%32 + 96;
  1614. +     eb = (ly%4)*4 + lx%4 + 96;
  1615. +     if (chiy != hiy) (void) putc(hiy, outfile);
  1616. +     if (ceb != eb) (void) putc(eb, outfile);
  1617. +     if ((cloy!=loy) || (ceb!=eb) || (chix!=hix)) (void) putc(loy, outfile);
  1618. +     if (chix != hix) (void) putc(hix, outfile);
  1619. +     (void) putc(lox, outfile);
  1620. +     chix = hix;
  1621. +     chiy = hiy;
  1622. +     cloy = loy;
  1623. +     ceb = eb;
  1624. + }
  1625. + T410X_encode_int(number)
  1626. + int number;
  1627. + {
  1628. +     register unsigned int mag, hi1, hi2, lo;
  1629. +     mag = abs(number);
  1630. +     hi1 = mag/1024 + 64;
  1631. +     hi2 = (mag/16)%64 + 64;
  1632. +     lo = mag%16 + 32;
  1633. +     if (number >= 0) lo += 16;
  1634. +     if (hi1 != 64) (void) putc(hi1, outfile);
  1635. +     if ((hi2 != 64) || (hi1 != 64)) (void) putc(hi2, outfile);
  1636. +     (void) putc(lo, outfile);
  1637. + }
  1638. + #endif /* T410X */
  1639. diff -c ./term/unixpc.trm ../patch/term/unixpc.trm
  1640. *** ./term/unixpc.trm    Tue Mar 27 09:03:15 1990
  1641. --- ../patch/term/unixpc.trm    Tue Aug 28 16:03:19 1990
  1642. ***************
  1643. *** 122,128
  1644.      uw.uw_height = uPC_YMAX;     /* 288 normal--we clobber 12 (top row)*/
  1645.      uw.uw_uflags = 1;         /* Creates with no border */
  1646.   
  1647. !    IfErrOut (ioctl(0, WIOCSETD, &uw), <0, "ioctl failed on", "WIOCSETD");
  1648.   }
  1649.   
  1650.   
  1651.  
  1652. --- 122,128 -----
  1653.      uw.uw_height = uPC_YMAX;     /* 288 normal--we clobber 12 (top row)*/
  1654.      uw.uw_uflags = 1;         /* Creates with no border */
  1655.   
  1656. !    IfErrOut (ioctl(1, WIOCSETD, &uw), <0, "ioctl failed on", "WIOCSETD");
  1657.   }
  1658.   
  1659.   
  1660. ***************
  1661. *** 144,150
  1662.      printf ("\033[25;1H");
  1663.   
  1664.      uPC_ur.ur_dstop = DSTSRC;   /* replace (clear screen). */
  1665. !    IfErrOut (ioctl(0, WIOCRASTOP, &uPC_ur), <0,
  1666.         "ioctl failed", "WIOCRASTOP");
  1667.      uPC_ur.ur_dstop = DSTOR;   /* Or in (show text) */
  1668.   }
  1669.  
  1670. --- 144,150 -----
  1671.      printf ("\033[25;1H");
  1672.   
  1673.      uPC_ur.ur_dstop = DSTSRC;   /* replace (clear screen). */
  1674. !    IfErrOut (ioctl(1, WIOCRASTOP, &uPC_ur), <0,
  1675.         "ioctl failed", "WIOCRASTOP");
  1676.      uPC_ur.ur_dstop = DSTOR;   /* Or in (show text) */
  1677.   }
  1678. ***************
  1679. *** 154,160
  1680.   {
  1681.   /* This routine will flush the display. */
  1682.   
  1683. !    IfErrOut (ioctl(0, WIOCRASTOP, &uPC_ur), <0,
  1684.         "ioctl failed", "WIOCRASTOP");
  1685.   }
  1686.   
  1687.  
  1688. --- 154,160 -----
  1689.   {
  1690.   /* This routine will flush the display. */
  1691.   
  1692. !    IfErrOut (ioctl(1, WIOCRASTOP, &uPC_ur), <0,
  1693.         "ioctl failed", "WIOCRASTOP");
  1694.   }
  1695.   
  1696. ***************
  1697. *** 522,528
  1698.      struct utdata ut;
  1699.   
  1700.   /* Reset the window to the right size. */
  1701. !    ioctl(0, WIOCSETD, &wreset);   /* 0, not wncur here! */
  1702.   
  1703.   /* Scroll the screen once. (avoids typing over the same line) */
  1704.      fprintf (stderr, "\n");
  1705.  
  1706. --- 522,528 -----
  1707.      struct utdata ut;
  1708.   
  1709.   /* Reset the window to the right size. */
  1710. !    ioctl(1, WIOCSETD, &wreset);   /* 0, not wncur here! */
  1711.   
  1712.   /* Scroll the screen once. (avoids typing over the same line) */
  1713.      fprintf (stderr, "\n");
  1714. diff -c ./term/x11.trm ../patch/term/x11.trm
  1715. *** ./term/x11.trm    Thu Sep  6 09:24:44 1990
  1716. --- ../patch/term/x11.trm    Tue Sep  4 00:50:32 1990
  1717. ***************
  1718. *** 0
  1719.  
  1720. --- 1,77 -----
  1721. + /*
  1722. +  *    x11.trm  --- inboard terminal driver for X11
  1723. +  */
  1724. + #define X11_XMAX 4096
  1725. + #define X11_YMAX 4096
  1726. + /* approximations for typical font/screen sizes */
  1727. + #define X11_VCHAR (X11_YMAX/25) 
  1728. + #define X11_HCHAR (X11_XMAX/100) 
  1729. + #define X11_VTIC (X11_YMAX/100)
  1730. + #define X11_HTIC (X11_XMAX/150)
  1731. + #define X11_nopts 22
  1732. + char X11_opts[X11_nopts][20] = {
  1733. +    "-iconic", "-rv", "-reverse", "+rv", "-synchronous", 
  1734. +    "-display", "-geometry", "-bg", "-background", "-bd", "-bordercolor", "-bw",
  1735. +    "-borderwidth", "-fg", "-foreground", "-fn", "-font", "-name", 
  1736. +    "-selectionTimeout", "-title", "-xnllanguage", "-xrm" 
  1737. +    };
  1738. + int X11_optarg[X11_nopts] = { 
  1739. +    0, 0, 0, 0, 0,
  1740. +    1, 1, 1, 1, 1, 1, 1,
  1741. +    1, 1, 1, 1, 1, 1, 
  1742. +    1, 1, 1, 1
  1743. +    };
  1744. + FILE *X11_pipe, *popen();
  1745. + char X11_command[1024]= "gnuplot_x11 -name gnuplot";
  1746. + /*   X11_args - scan gnuplot command line for standard X Toolkit options */
  1747. + X11_args(argc, argv) int argc; char *argv[]; {
  1748. +    int nx11 = 0, n;
  1749. +    while(++argv, --argc > 0) {
  1750. +       for (n=0; n<X11_nopts; n++) {
  1751. +      if (!strcmp(*argv, X11_opts[n])) {
  1752. +         strcat(X11_command, " ");
  1753. +         strcat(X11_command, *argv); 
  1754. +         if (X11_optarg[n]) {
  1755. +            if (--argc <= 0) return(nx11);
  1756. +            strcat(X11_command, " \"");
  1757. +            strcat(X11_command, *++argv); 
  1758. +            strcat(X11_command, "\"");
  1759. +            nx11++;
  1760. +            }
  1761. +         nx11++; break;
  1762. +         }
  1763. +      }
  1764. +       if (n == X11_nopts) break; 
  1765. +       }
  1766. +    return(nx11);
  1767. +    }
  1768. + X11_init() { X11_pipe = popen(X11_command, "w"); }
  1769. + X11_reset() { fprintf(X11_pipe, "R\n"); fflush(X11_pipe); }
  1770. + X11_text() { fprintf(X11_pipe, "E\n"); fflush(X11_pipe); }
  1771. + X11_graphics() { fprintf(X11_pipe, "G\n"); }
  1772. + X11_move(x,y) unsigned int x,y; { fprintf(X11_pipe, "M%04d%04d\n", x, y); }
  1773. + X11_vector(x,y) unsigned int x,y; { fprintf(X11_pipe, "V%04d%04d\n", x, y); }
  1774. + X11_linetype(lt) int lt; { fprintf(X11_pipe, "L%04d\n", lt); }
  1775. + X11_put_text(x,y,str) unsigned int x,y; char str[]; {
  1776. +    fprintf(X11_pipe, "T%04d%04d%s\n", x, y, str);
  1777. +    }
  1778. + X11_justify_text(mode) enum JUSTIFY mode; {
  1779. +    fprintf(X11_pipe, "J%04d\n", mode);
  1780. +    return(TRUE);
  1781. +    }
  1782. *** ./term.h    Wed Aug 29 12:15:55 1990
  1783. --- ../patch1/term.h    Tue Sep 18 14:40:02 1990
  1784. ***************
  1785. *** 0
  1786.  
  1787. --- 1,86 -----
  1788. + /* GNUPLOT - term.h */
  1789. + /*
  1790. +  * Copyright (C) 1986, 1987, 1990   Thomas Williams, Colin Kelley
  1791. +  *
  1792. +  * Permission to use, copy, and distribute this software and its
  1793. +  * documentation for any purpose with or without fee is hereby granted, 
  1794. +  * provided that the above copyright notice appear in all copies and 
  1795. +  * that both that copyright notice and this permission notice appear 
  1796. +  * in supporting documentation.
  1797. +  *
  1798. +  * Permission to modify the software is granted, but not the right to
  1799. +  * distribute the modified code.  Modifications are to be distributed 
  1800. +  * as patches to released version.
  1801. +  *  
  1802. +  * This software  is provided "as is" without express or implied warranty.
  1803. +  * 
  1804. +  *
  1805. +  * AUTHORS
  1806. +  * 
  1807. +  *   Original Software:
  1808. +  *     Thomas Williams,  Colin Kelley.
  1809. +  * 
  1810. +  *   Gnuplot 2.0 additions:
  1811. +  *       Russell Lang, Dave Kotz, John Campbell.
  1812. +  * 
  1813. +  * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  1814. +  * 
  1815. +  **************************************
  1816. +  * term.h: terminal support definitions
  1817. +  *   Edit this file depending on the set of terminals you wish to support.
  1818. +  * Comment out the terminal types that you don't want or don't have, and
  1819. +  * uncomment those that you want included. Be aware that some terminal 
  1820. +  * types (eg, SUN, UNIXPLOT) will require changes in the makefile 
  1821. +  * LIBS definition. 
  1822. +  */
  1823. + /* These terminals are not relevant for MSDOS */
  1824. + #ifndef MSDOS
  1825. + #define AED         /* AED 512 and AED 767 */
  1826. + #define BITGRAPH    /* BBN BitGraph */
  1827. + #define HPLJET        /* HP Laserjet */
  1828. + /* #define IRIS4D      /* IRIS4D series computer */
  1829. + #define KERMIT      /* MS-Kermit Tektronix 4010 emulator */
  1830. + /* #define FIG           /* Fig graphics language (requires object.h from TransFig) */
  1831. + #define REGIS       /* ReGis graphics (vt125, vt220, vt240, Gigis...) */
  1832. + #define SELANAR     /* Selanar */
  1833. + /* #define SUN         /* Sun Microsystems Workstation */
  1834. + #define T410X       /* Tektronix 4106, 4107, 4109 and 420x terminals */
  1835. + #define TEK         /* Tektronix 4010, and probably others */
  1836. + /* #define UNIXPC      /* unixpc (ATT 3b1 or ATT 7300) */
  1837. + /* #define UNIXPLOT    /* unixplot */
  1838. + /* #define X11         /* X11R4 window system */
  1839. + #endif 
  1840. + /* These terminals can be used on any system */
  1841. + #define DXY800A        /* Roland DXY800A plotter */
  1842. + #define EEPIC        /* EEPIC-extended LaTeX driver, for EEPIC users */
  1843. + #define EMTEX        /* LATEX picture environment with EMTEX specials */
  1844. + #define EPS60        /* Epson-style 60-dot per inch printers */
  1845. + #define EPSON        /* Epson LX-800, Star NL-10, NX-1000 and lots of others */
  1846. + #define HP2648        /* HP2648, HP2647 */
  1847. + #define HP26        /* HP2623A and maybe others */
  1848. + #define HP75        /* HP7580, and probably other HPs */
  1849. + #define HPGL        /* HP7475, HP7220 plotters, and (hopefully) lots of others */
  1850. + #define IMAGEN      /* Imagen laser printers (300dpi) (requires -Iterm also) */
  1851. + #define LATEX       /* LATEX picture environment */
  1852. + #define NEC         /* NEC CP6 pinwriter printer */
  1853. + #define POSTSCRIPT  /* Postscript */
  1854. + #define PROPRINTER  /* IBM Proprinter */
  1855. + #define QMS         /* QMS/QUIC laserprinter (Talaris 1200 and others) */
  1856. + #define STARC       /* Star Color Printer */
  1857. + #define TANDY60        /* Tandy DMP-130 series 60-dot per inch graphics */
  1858. + #define V384        /* Vectrix 384 and tandy color printer */
  1859. + /* These are for MSDOS only */
  1860. + #ifdef MSDOS
  1861. + #ifdef __TURBOC__
  1862. + #define ATT6300        /* AT&T 6300 graphics */
  1863. + #else
  1864. + #define ATT6300        /* AT&T 6300 graphics */
  1865. + #define CORONA      /* Corona graphics 325 */
  1866. + #define HERCULES    /* IBM PC/Clone with Hercules graphics board */
  1867. + #endif
  1868. + #endif
  1869. *** ./term.c    Tue Mar 27 09:02:05 1990
  1870. --- ../patch1/term.c    Thu Sep  6 09:20:17 1990
  1871. ***************
  1872. *** 29,34
  1873.   
  1874.   #include <stdio.h>
  1875.   #include "plot.h"
  1876.   
  1877.   /* for use by all drivers */
  1878.   #define sign(x) ((x) >= 0 ? 1 : -1)
  1879.  
  1880. --- 29,35 -----
  1881.   
  1882.   #include <stdio.h>
  1883.   #include "plot.h"
  1884. + #include "term.h"
  1885.   
  1886.   /* for use by all drivers */
  1887.   #define sign(x) ((x) >= 0 ? 1 : -1)
  1888. ***************
  1889. *** 242,247
  1890.   #endif
  1891.   #endif
  1892.   
  1893.   #ifdef EPSON
  1894.   #define FONT57
  1895.   #endif
  1896.  
  1897. --- 243,266 -----
  1898.   #endif
  1899.   #endif
  1900.   
  1901. + #ifdef STARC 
  1902. + #ifndef EPSON
  1903. + #define EPSON 
  1904. + #endif
  1905. + #endif
  1906. + #ifdef TANDY60
  1907. + #ifndef EPS60
  1908. + #define EPS60
  1909. + #endif
  1910. + #endif
  1911. + #ifdef EPS60
  1912. + #ifndef EPSON
  1913. + #define EPSON
  1914. + #endif
  1915. + #endif
  1916.   #ifdef EPSON
  1917.   #define FONT57
  1918.   #endif
  1919. ***************
  1920. *** 282,287
  1921.   # endif
  1922.   #endif
  1923.   
  1924.   #ifdef TEK            /* all TEK types, TEK, BBN, SELANAR, KERMIT */
  1925.   #include "term/tek.trm"
  1926.   #endif
  1927.  
  1928. --- 301,310 -----
  1929.   # endif
  1930.   #endif
  1931.   
  1932. + #ifdef T410X        /* Tektronix 4106, 4107, 4109 and 420x terminals */
  1933. + #include "term/t410x.trm"
  1934. + #endif
  1935.   #ifdef TEK            /* all TEK types, TEK, BBN, SELANAR, KERMIT */
  1936.   #include "term/tek.trm"
  1937.   #endif
  1938. ***************
  1939. *** 286,292
  1940.   #include "term/tek.trm"
  1941.   #endif
  1942.   
  1943. ! #ifdef EPSON        /* all bit map types, EPSON, NEC, PROPRINTER */
  1944.   #include "term/epson.trm"
  1945.   #endif
  1946.   
  1947.  
  1948. --- 309,315 -----
  1949.   #include "term/tek.trm"
  1950.   #endif
  1951.   
  1952. ! #ifdef EPSON    /* bit map types, EPSON, NEC, PROPRINTER, STAR Color */
  1953.   #include "term/epson.trm"
  1954.   #endif
  1955.   
  1956. ***************
  1957. *** 290,295
  1958.   #include "term/epson.trm"
  1959.   #endif
  1960.   
  1961.   #ifdef FIG                /* Fig 1.4FS Interactive graphics program */
  1962.   #include "term/fig.trm"
  1963.   #endif
  1964.  
  1965. --- 313,322 -----
  1966.   #include "term/epson.trm"
  1967.   #endif
  1968.   
  1969. + #ifdef EPS60        /* old-style EPSON 60-dpi */
  1970. + #include "term/eps60.trm"
  1971. + #endif
  1972.   #ifdef FIG                /* Fig 1.4FS Interactive graphics program */
  1973.   #include "term/fig.trm"
  1974.   #endif
  1975. ***************
  1976. *** 305,310
  1977.   # endif
  1978.   #endif
  1979.   
  1980.   #ifdef LATEX        /* LATEX type */
  1981.   #include "term/latex.trm"
  1982.   #endif
  1983.  
  1984. --- 332,343 -----
  1985.   # endif
  1986.   #endif
  1987.   
  1988. + #ifdef EMTEX        /* EMTEX (LATEX for PC) type */
  1989. + # ifndef LATEX
  1990. + #  define LATEX
  1991. + # endif
  1992. + #endif
  1993.   #ifdef LATEX        /* LATEX type */
  1994.   #include "term/latex.trm"
  1995.   #endif
  1996. ***************
  1997. *** 375,380
  1998.   #include "term/unixplot.trm"
  1999.   #endif /* UNIXPLOT */
  2000.   
  2001.   /* Dummy functions for unavailable features */
  2002.   
  2003.   /* change angle of text.  0 is horizontal left to right.
  2004.  
  2005. --- 408,417 -----
  2006.   #include "term/unixplot.trm"
  2007.   #endif /* UNIXPLOT */
  2008.   
  2009. + #ifdef X11
  2010. + #include "term/x11.trm"
  2011. + #endif /* X11 */
  2012.   /* Dummy functions for unavailable features */
  2013.   
  2014.   /* change angle of text.  0 is horizontal left to right.
  2015. ***************
  2016. *** 464,469
  2017.          HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  2018.          HERC_linetype, HERC_put_text, MCGA_text_angle, 
  2019.          HERC_justify_text, line_and_point, do_arrow}
  2020.   #else                    /* TURBO */
  2021.   
  2022.       ,{"cga", "IBM PC/Clone with CGA graphics board",
  2023.  
  2024. --- 501,514 -----
  2025.          HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  2026.          HERC_linetype, HERC_put_text, MCGA_text_angle, 
  2027.          HERC_justify_text, line_and_point, do_arrow}
  2028. + #ifdef ATT6300
  2029. +     ,{"att", "IBM PC/Clone with AT&T 6300 graphics board",
  2030. +        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  2031. +        ATT_VTIC, ATT_HTIC, ATT_init, ATT_reset,
  2032. +        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  2033. +        ATT_linetype, ATT_put_text, ATT_text_angle, 
  2034. +        ATT_justify_text, line_and_point, do_arrow}
  2035. + #endif
  2036.   #else                    /* TURBO */
  2037.   
  2038.       ,{"cga", "IBM PC/Clone with CGA graphics board",
  2039. ***************
  2040. *** 506,512
  2041.   #endif                    /* HERCULES */
  2042.   
  2043.   #ifdef ATT6300
  2044. !     ,{"att", "AT&T 6300 terminal ???",
  2045.          ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  2046.          ATT_VTIC, ATT_HTIC, ATT_init, ATT_reset,
  2047.          ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  2048.  
  2049. --- 551,557 -----
  2050.   #endif                    /* HERCULES */
  2051.   
  2052.   #ifdef ATT6300
  2053. !     ,{"att", "AT&T PC/6300 graphics",
  2054.          ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  2055.          ATT_VTIC, ATT_HTIC, ATT_init, ATT_reset,
  2056.          ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  2057. ***************
  2058. *** 558,563
  2059.          null_justify_text, do_point, do_arrow}
  2060.   #endif
  2061.   
  2062.   #ifdef EPSON
  2063.       ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000 and lots of others",
  2064.          EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  2065.  
  2066. --- 603,636 -----
  2067.          null_justify_text, do_point, do_arrow}
  2068.   #endif
  2069.   
  2070. + #ifdef EEPIC
  2071. +     ,{"eepic", "EEPIC -- extended LaTeX picture environment",
  2072. +        EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR, 
  2073. +        EEPIC_VTIC, EEPIC_HTIC, EEPIC_init, EEPIC_reset, 
  2074. +        EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector, 
  2075. +        EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle, 
  2076. +        EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
  2077. + #endif
  2078. + #ifdef EMTEX
  2079. +    
  2080. +     ,{"emtex", "LATEX picture environment with emTeX specials",
  2081. +        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  2082. +        LATEX_VTIC, LATEX_HTIC, EMTEX_init, EMTEX_reset, 
  2083. +        EMTEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  2084. +        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  2085. +        LATEX_justify_text, LATEX_point, LATEX_arrow}
  2086. + #endif
  2087. + #ifdef EPS60
  2088. +     ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
  2089. +        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  2090. +        EPSONVTIC, EPSONHTIC, EPS60init, EPSONreset,
  2091. +        EPS60text, null_scale, EPSONgraphics, EPSONmove, EPSONvector,
  2092. +        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  2093. +        null_justify_text, do_point, do_arrow}
  2094. + #endif
  2095.   #ifdef EPSON
  2096.       ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000 and lots of others",
  2097.          EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  2098. ***************
  2099. *** 675,689
  2100.          LATEX_justify_text, LATEX_point, LATEX_arrow}
  2101.   #endif
  2102.   
  2103. - #ifdef EEPIC
  2104. -     ,{"eepic", "EEPIC -- extended LaTeX picture environment",
  2105. -        EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR, 
  2106. -        EEPIC_VTIC, EEPIC_HTIC, EEPIC_init, EEPIC_reset, 
  2107. -        EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector, 
  2108. -        EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle, 
  2109. -        EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
  2110. - #endif
  2111.   #ifdef NEC
  2112.       ,{"nec_cp6m", "NEC printer CP6 Monochrome",
  2113.          NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  2114.  
  2115. --- 748,753 -----
  2116.          LATEX_justify_text, LATEX_point, LATEX_arrow}
  2117.   #endif
  2118.   
  2119.   #ifdef NEC
  2120.       ,{"nec_cp6m", "NEC printer CP6 Monochrome",
  2121.          NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  2122. ***************
  2123. *** 769,774
  2124.          null_justify_text, line_and_point, do_arrow}
  2125.   #endif
  2126.   
  2127.   #ifdef SUN
  2128.       ,{"sun", "SunView window system",
  2129.          SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR, 
  2130.  
  2131. --- 833,847 -----
  2132.          null_justify_text, line_and_point, do_arrow}
  2133.   #endif
  2134.   
  2135. + #ifdef STARC
  2136. +     ,{"starc", "Star Color Printer",
  2137. +        STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR, 
  2138. +        STARCVTIC, STARCHTIC, STARCinit, STARCreset, 
  2139. +        STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector, 
  2140. +        STARClinetype, STARCput_text, STARC_text_angle, 
  2141. +        null_justify_text, line_and_point, do_arrow}
  2142. + #endif
  2143.   #ifdef SUN
  2144.       ,{"sun", "SunView window system",
  2145.          SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR, 
  2146. ***************
  2147. *** 778,783
  2148.          SUN_justify_text, line_and_point, do_arrow}
  2149.   #endif
  2150.   
  2151.   #ifdef TEK
  2152.       ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
  2153.          TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  2154.  
  2155. --- 851,874 -----
  2156.          SUN_justify_text, line_and_point, do_arrow}
  2157.   #endif
  2158.   
  2159. + #ifdef TANDY60
  2160. +     ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
  2161. +        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  2162. +        EPSONVTIC, EPSONHTIC, EPS60init, EPSONreset,
  2163. +        TANDY60text, null_scale, EPSONgraphics, EPSONmove, EPSONvector,
  2164. +        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  2165. +        null_justify_text, do_point, do_arrow}
  2166. + #endif
  2167. + #ifdef T410X
  2168. +     ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
  2169. +        T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR, 
  2170. +        T410XVTIC, T410XHTIC, T410X_init, T410X_reset, 
  2171. +        T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector, 
  2172. +        T410X_linetype, T410X_put_text, T410X_text_angle, 
  2173. +        null_justify_text, T410X_point, do_arrow}
  2174. + #endif
  2175.   #ifdef TEK
  2176.       ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
  2177.          TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  2178. ***************
  2179. *** 813,818
  2180.          V384_linetype, V384_put_text, null_text_angle, 
  2181.          null_justify_text, do_point, do_arrow}
  2182.   #endif
  2183.   };
  2184.   
  2185.   #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
  2186.  
  2187. --- 904,924 -----
  2188.          V384_linetype, V384_put_text, null_text_angle, 
  2189.          null_justify_text, do_point, do_arrow}
  2190.   #endif
  2191. + #ifdef X11
  2192. +     ,{"x11", "X11 Window System",
  2193. +        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  2194. +        X11_VTIC, X11_HTIC, X11_init, X11_reset, 
  2195. +        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  2196. +        X11_linetype, X11_put_text, null_text_angle, 
  2197. +        X11_justify_text, line_and_point, do_arrow}
  2198. +     ,{"X11", "X11 Window System - multi-color points",
  2199. +        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  2200. +        X11_VTIC, X11_HTIC, X11_init, X11_reset, 
  2201. +        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  2202. +        X11_linetype, X11_put_text, null_text_angle, 
  2203. +        X11_justify_text, do_point, do_arrow}
  2204. + #endif
  2205.   };
  2206.   
  2207.   #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
  2208. ***************
  2209. *** 985,990
  2210.               case 4 : term_name = "egalib";
  2211.                        break;
  2212.               case 7 : term_name = "hercules";
  2213.                        break;
  2214.               case 9 : term_name = "vgalib";
  2215.                        break;
  2216.  
  2217. --- 1091,1098 -----
  2218.               case 4 : term_name = "egalib";
  2219.                        break;
  2220.               case 7 : term_name = "hercules";
  2221. +                      break;
  2222. +             case 8 : term_name = "att";
  2223.                        break;
  2224.               case 9 : term_name = "vgalib";
  2225.                        break;
  2226. *** ./gnuplot_x11.c    Thu Sep  6 09:22:16 1990
  2227. --- ../patch1/gnuplot_x11.c    Wed Sep  5 21:25:26 1990
  2228. ***************
  2229. *** 0
  2230.  
  2231. --- 1,241 -----
  2232. + /*-----------------------------------------------------------------------------
  2233. +  *
  2234. +  *   gnuplot_x11 - X11 outboard terminal driver for gnuplot 2
  2235. +  *
  2236. +  *   Requires installation of companion inboard x11 driver in gnuplot/term.c
  2237. +  *
  2238. +  *   Acknowledgements: 
  2239. +  *      Chris Peterson (MIT) - original Xlib gnuplot support (and Xaw examples)
  2240. +  *      Dana Chee (Bellcore)  - mods to original support for gnuplot 2.0
  2241. +  *      Arthur Smith (Cornell) - graphical-label-widget idea (xplot)
  2242. +  *
  2243. +  *   This code is provided as is and with no warranties of any kind.
  2244. +  *       
  2245. +  *   Ed Kubaitis
  2246. +  *   Computing Services Office -  University of Illinois, Urbana
  2247. +  *---------------------------------------------------------------------------*/
  2248. +  
  2249. + #include <stdio.h>
  2250. + #include <X11/Intrinsic.h>
  2251. + #include <X11/StringDefs.h>
  2252. + #include <Cardinals.h>      /* use -Idir for location on your system */
  2253. + #include <Label.h>          /* use -Idir for location on your system */
  2254. + #define Color (D>1)
  2255. + #define Ncolors 11
  2256. + unsigned long colors[Ncolors];
  2257. + char color_keys[Ncolors][30] =   { "text", "border", "axis", 
  2258. +    "line1", "line2", "line3", "line4", "line5", "line6", "line7", "line8" };
  2259. + char color_values[Ncolors][30] = { "black", "black", "black", 
  2260. +    "red",  "green", "blue",  "magenta", "cyan", "sienna", "orange", "coral" };
  2261. + char dashes[10][5] = { {0}, {1,6,0}, 
  2262. +    {0}, {4,2,0}, {1,3,0}, {4,4,0}, {1,5,0}, {4,4,4,1,0}, {4,2,0}, {1,3,0}
  2263. +    };
  2264. + Widget w_top, w_label;
  2265. + Window win;  Display *dpy;
  2266. + Pixmap pixmap;  GC gc = (GC)NULL;
  2267. + XFontStruct *font;
  2268. + unsigned long fg, bg;
  2269. + Dimension W = 640 , H = 450;  int D;
  2270. + Arg args[5];
  2271. + static void gnuplot(), resize();
  2272. + int cx=0, cy=0, vchar, nc = 0;
  2273. + double xscale, yscale;
  2274. + #define X(x) (Dimension) (x * xscale)
  2275. + #define Y(y) (Dimension) ((4095-y) * yscale)
  2276. + enum JUSTIFY { LEFT, CENTRE, RIGHT } jmode;
  2277. + #define Nbuf 1024
  2278. + char buf[Nbuf];
  2279. + String *commands = NULL;
  2280. + /*-----------------------------------------------------------------------------
  2281. +  *   main program - fire up application and callbacks
  2282. +  *---------------------------------------------------------------------------*/
  2283. + main(argc, argv) int argc; char *argv[]; {
  2284. +    /* initialize application */
  2285. +    w_top = XtInitialize("gnuplot", "Gnuplot", NULL, 0, &argc, argv);
  2286. +    XtSetArg(args[0], XtNwidth, W);
  2287. +    XtSetArg(args[1], XtNheight, H);
  2288. +    w_label = XtCreateManagedWidget("", labelWidgetClass, w_top, args, TWO);
  2289. +    XtRealizeWidget(w_top);
  2290. +    /* extract needed information */
  2291. +    dpy = XtDisplay(w_top); win = XtWindow(w_top); D = DisplayPlanes(dpy,0);
  2292. +    if (Color) {
  2293. +       char option[20], *value; 
  2294. +       XColor used, exact;
  2295. +       int n;
  2296. +       for(n=0; n<Ncolors; n++) {
  2297. +      strcpy(option, color_keys[n]);
  2298. +      strcat(option, "Color");
  2299. +      value = XGetDefault(dpy, "gnuplot", option);
  2300. +      if (!value) { value = color_values[n]; }
  2301. +      if (XAllocNamedColor(dpy, DefaultColormap(dpy,0), value, &used,&exact))
  2302. +         colors[n] = used.pixel; 
  2303. +      else {
  2304. +         fprintf(stderr, "gnuplot: cannot allocate %s:%s\n", option, value);
  2305. +         fprintf(stderr, "gnuplot: assuming %s:black\n", option);
  2306. +         colors[n] = BlackPixel(dpy,0);
  2307. +         }
  2308. +      }
  2309. +       }
  2310. +    XtSetArg(args[0], XtNfont, &font);
  2311. +    XtSetArg(args[1], XtNforeground, &fg);
  2312. +    XtSetArg(args[2], XtNbackground, &bg);
  2313. +    XtSetArg(args[3], XtNwidth, &W);
  2314. +    XtSetArg(args[4], XtNheight,&H);
  2315. +    XtGetValues(w_label, args, FIVE);
  2316. +    vchar = (font->ascent + font->descent);
  2317. +    /* add callbacks on input-from-gnuplot-on-stdin & window-resized */
  2318. +    XtAddInput(0, XtInputReadMask, gnuplot, NULL);
  2319. +    XtAddEventHandler(w_label, StructureNotifyMask, FALSE, resize, NULL);
  2320. +    XtMainLoop();
  2321. +    }
  2322. + /*-----------------------------------------------------------------------------
  2323. +  *   display - display accumulated commands from inboard driver
  2324. +  *---------------------------------------------------------------------------*/
  2325. + display() {
  2326. +    int n, x, y, sw, sl, lt, width, type;
  2327. +    char *buf, *str;
  2328. +    /* set scaling factor between internal driver & window geometry */
  2329. +    xscale = (double)W / 4096.;  yscale = (double)H / 4096.;  
  2330. +    /* return old pixmap  & GC, if any */
  2331. +    if (gc) { XFreeGC(dpy, gc); XFreePixmap(dpy, pixmap); }
  2332. +    /* create new pixmap & GC */
  2333. +    pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), W, H, D);
  2334. +    gc = XCreateGC(dpy, pixmap, 0, NULL);
  2335. +    XSetFont(dpy, gc, font->fid);
  2336. +    /* connect new pixmap to label widget */
  2337. +    XtSetArg(args[0], XtNbitmap, pixmap);
  2338. +    XtSetValues(w_label, args, ONE);
  2339. +    /* erase pixmap */
  2340. +    if (Color) {
  2341. +       XSetForeground(dpy, gc, bg);
  2342. +       XFillRectangle(dpy, pixmap, gc, 0, 0, W, H);
  2343. +       XSetForeground(dpy, gc, fg);
  2344. +       XSetBackground(dpy, gc, bg);
  2345. +       }
  2346. +    else {
  2347. +       XSetFunction(dpy, gc, GXxor);
  2348. +       XCopyArea(dpy, pixmap, pixmap, gc, 0, 0, W, H, 0, 0);
  2349. +       XSetFunction(dpy, gc, GXcopyInverted);
  2350. +       }
  2351. +    /* loop over accumulated commands from inboard driver */
  2352. +    for (n=0; n<nc; n++) {
  2353. +       buf = commands[n];
  2354. +       /*   X11_vector(x,y) - draw vector  */
  2355. +       if (*buf == 'V') { 
  2356. +      sscanf(buf, "V%4d%4d", &x, &y);  
  2357. +      XDrawLine(dpy, pixmap, gc, X(cx), Y(cy), X(x), Y(y));
  2358. +      cx = x; cy = y;
  2359. +      }
  2360. +       /*   X11_move(x,y) - move  */
  2361. +       else if (*buf == 'M') 
  2362. +      sscanf(buf, "M%4d%4d", &cx, &cy);  
  2363. +       /*   X11_put_text(x,y,str) - draw text   */
  2364. +       else if (*buf == 'T') { 
  2365. +      sscanf(buf, "T%4d%4d", &x, &y);  
  2366. +      str = buf + 9; sl = strlen(str) - 1;
  2367. +      sw = XTextWidth(font, str, sl);
  2368. +      switch(jmode) {
  2369. +         case LEFT:   sw = 0;     break;
  2370. +         case CENTRE: sw = -sw/2; break;
  2371. +         case RIGHT:  sw = -sw;   break;
  2372. +         }
  2373. +      if (!Color) 
  2374. +         XDrawString(dpy, pixmap, gc, X(x)+sw, Y(y)+vchar/3, str, sl);
  2375. +      else { 
  2376. +         XSetForeground(dpy, gc, colors[0]);
  2377. +         XDrawString(dpy, pixmap, gc, X(x)+sw, Y(y)+vchar/3, str, sl);
  2378. +         XSetForeground(dpy, gc, colors[lt+1]);
  2379. +         }
  2380. +      }
  2381. +       /*   X11_justify_text(mode) - set text justification mode  */
  2382. +       else if (*buf == 'J') 
  2383. +      sscanf(buf, "J%4d", &jmode);
  2384. +       /*   X11_linetype(type) - set line type  */
  2385. +       else if (*buf == 'L') { 
  2386. +      sscanf(buf, "L%4d", <);
  2387. +      lt = (lt+2)%10;
  2388. +      width = (lt == 0) ? 2 : 0;
  2389. +      if (Color) {
  2390. +         if (lt != 1) 
  2391. +            type = LineSolid;
  2392. +         else {
  2393. +            type = LineOnOffDash;
  2394. +            XSetDashes(dpy, gc, 0, dashes[lt], strlen(dashes[lt]));
  2395. +            }
  2396. +         XSetForeground(dpy, gc, colors[lt+1]);
  2397. +         }
  2398. +      else {
  2399. +         type  = (lt == 0 || lt == 2) ? LineSolid : LineOnOffDash;
  2400. +         if (dashes[lt][0])
  2401. +            XSetDashes(dpy, gc, 0, dashes[lt], strlen(dashes[lt]));
  2402. +         }
  2403. +      XSetLineAttributes( dpy,gc, width, type, CapButt, JoinBevel);
  2404. +      }
  2405. +       }
  2406. +    /* trigger expose events to display pixmap */
  2407. +    XClearArea(dpy, win, 0, 0, 0, 0, True);
  2408. +    }
  2409. + /*-----------------------------------------------------------------------------
  2410. +  *   gnuplot - Xt callback on input from gnuplot inboard X11 driver
  2411. +  *---------------------------------------------------------------------------*/
  2412. + static void
  2413. + gnuplot(cd, s, id) char *cd; int *s; XtInputId *id; {
  2414. +    while (fgets(buf, Nbuf, stdin)) {
  2415. +      if (*buf == 'G') {                           /* enter graphics mode */
  2416. +      if (commands) {
  2417. +         int n;
  2418. +         for (n=0; n<nc; n++) XtFree(commands[n]);
  2419. +         XtFree(commands);
  2420. +         }
  2421. +      commands = NULL; nc = 0;
  2422. +          }
  2423. +       else if (*buf == 'E') { display(); break; } /* leave graphics mode */
  2424. +       else if (*buf == 'R') { exit(0); }          /* leave X11/x11 mode  */
  2425. +       else {
  2426. +      commands = (String *)XtRealloc(commands, (nc+1) * sizeof(String));
  2427. +      commands[nc++] = XtNewString(buf);
  2428. +      }
  2429. +       }
  2430. +    if (feof(stdin) || ferror(stdin)) exit(0);
  2431. +    }
  2432. + /*-----------------------------------------------------------------------------
  2433. +  *   resize - Xt callback when window resized
  2434. +  *---------------------------------------------------------------------------*/
  2435. + static void
  2436. + resize(w, cd, e) Widget w; char *cd; XConfigureEvent *e; {
  2437. +    if (e->type != ConfigureNotify) return;
  2438. +    W = e->width; H = e->height;
  2439. +    display(); 
  2440. +    }
  2441.