home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume24 / gnuplot3 / part25 < prev    next >
Text File  |  1991-10-28  |  49KB  |  1,530 lines

  1. Newsgroups: comp.sources.misc
  2. From: gershon%gr@cs.utah.edu (Elber Gershon)
  3. Subject:  v24i047:  gnuplot3 - interactive function plotting utility, Part25/26
  4. Message-ID: <1991Oct29.031129.4319@sparky.imd.sterling.com>
  5. X-Md4-Signature: a176e9ce920c0f9ef2e16bca4b21fab1
  6. Date: Tue, 29 Oct 1991 03:11:29 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: gershon%gr@cs.utah.edu (Elber Gershon)
  10. Posting-number: Volume 24, Issue 47
  11. Archive-name: gnuplot3/part25
  12. Environment: UNIX, MS-DOS, VMS
  13. Supersedes: gnuplot2: Volume 11, Issue 65-79
  14.  
  15. #!/bin/sh
  16. # this is Part.25 (part 25 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file gnuplot/term.c continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 25; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test ! -f _shar_wnt_.tmp; then
  33.     echo 'x - still skipping gnuplot/term.c'
  34. else
  35. echo 'x - continuing file gnuplot/term.c'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term.c' &&
  37. X    }
  38. X    (void) (*t->justify_text)(LEFT);
  39. X    (void) (*t->text_angle)(0);
  40. X    /* test tic size */
  41. X    (*t->move)(xmax/2+t->h_tic*2,0);
  42. X    (*t->vector)(xmax/2+t->h_tic*2,t->v_tic);
  43. X    (*t->move)(xmax/2,t->v_tic*2);
  44. X    (*t->vector)(xmax/2+t->h_tic,t->v_tic*2);
  45. X    (*t->put_text)(xmax/2+t->h_tic*2,t->v_tic*2+t->v_char/2,"test tics");
  46. X    /* test line and point types */
  47. X    x = xmax - t->h_char*4 - t->h_tic*4;
  48. X    y = ymax - t->v_char;
  49. X    for ( i = -2; y > t->v_char; i++ ) {
  50. X        (*t->linetype)(i);
  51. X        (void) sprintf(label,"%d",i);
  52. X        if ((*t->justify_text)(RIGHT))
  53. X            (*t->put_text)(x,y,label);
  54. X        else
  55. X            (*t->put_text)(x-strlen(label)*t->h_char,y,label);
  56. X        (*t->move)(x+t->h_char,y);
  57. X        (*t->vector)(x+t->h_char*4,y);
  58. X        if ( i >= -1 )
  59. X            (*t->point)(x+t->h_char*4+t->h_tic*2,y,i);
  60. X        y -= t->v_char;
  61. X    }
  62. X    /* test some arrows */
  63. X    (*t->linetype)(0);
  64. X    x = xmax/4;
  65. X    y = ymax/4;
  66. X    xl = t->h_tic*5;
  67. X    yl = t->v_tic*5;
  68. X    (*t->arrow)(x,y,x+xl,y,TRUE);
  69. X    (*t->arrow)(x,y,x+xl/2,y+yl,TRUE);
  70. X    (*t->arrow)(x,y,x,y+yl,TRUE);
  71. X    (*t->arrow)(x,y,x-xl/2,y+yl,FALSE);
  72. X    (*t->arrow)(x,y,x-xl,y,TRUE);
  73. X    (*t->arrow)(x,y,x-xl,y-yl,TRUE);
  74. X    (*t->arrow)(x,y,x,y-yl,TRUE);
  75. X    (*t->arrow)(x,y,x+xl,y-yl,TRUE);
  76. X    /* and back into text mode */
  77. X    (*t->text)();
  78. }
  79. X
  80. X
  81. #ifdef PC
  82. /* output for some terminal types must be binary to stop non Unix computers
  83. X   changing \n to \r\n. 
  84. X   If the output is not STDOUT, the following code reopens outfile 
  85. X   with binary mode. */
  86. void
  87. reopen_binary()
  88. {
  89. char filename[MAX_ID_LEN+1];
  90. X
  91. X    if (strcmp(outstr,"STDOUT")) {
  92. X        (void) fclose(outfile);
  93. X        (void) strcpy(filename,outstr+1);    /* remove quotes */
  94. X        filename[strlen(filename)-1] = '\0';
  95. X        if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
  96. X            if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  97. X                os_error("cannot reopen file with binary type; output unknown",
  98. X                    NO_CARET);
  99. X            } 
  100. X            else {
  101. X    os_error("cannot reopen file with binary type; output reset to ascii", 
  102. X                    NO_CARET);
  103. X            }
  104. X        }
  105. X    }
  106. }
  107. #endif
  108. X
  109. #ifdef vms
  110. /* these are needed to modify terminal characteristics */
  111. #include <descrip.h>
  112. #include <iodef.h>
  113. #include <ttdef.h>
  114. #include <tt2def.h>
  115. #include <dcdef.h>
  116. #include <ssdef.h>
  117. #include <stat.h>
  118. #include <fab.h>
  119. static unsigned short   chan;
  120. static int  old_char_buf[3], cur_char_buf[3];
  121. $DESCRIPTOR(sysoutput_desc,"SYS$OUTPUT");
  122. X
  123. char *vms_init()
  124. /*
  125. X * Determine if we have a regis terminal
  126. X * and save terminal characteristics
  127. */
  128. {
  129. X   /* Save terminal characteristics in old_char_buf and
  130. X   initialise cur_char_buf to current settings. */
  131. X   int i;
  132. X   sys$assign(&sysoutput_desc,&chan,0,0);
  133. X   sys$qiow(0,chan,IO$_SENSEMODE,0,0,0,old_char_buf,12,0,0,0,0);
  134. X   for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  135. X   sys$dassgn(chan);
  136. X
  137. X   /* Test if terminal is regis */
  138. X   if ((cur_char_buf[2] & TT2$M_REGIS) == TT2$M_REGIS) return("regis");
  139. X   return(NULL);
  140. }
  141. X
  142. void
  143. vms_reset()
  144. /* set terminal to original state */
  145. {
  146. X   int i;
  147. X   sys$assign(&sysoutput_desc,&chan,0,0);
  148. X   sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  149. X   for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  150. X   sys$dassgn(chan);
  151. }
  152. X
  153. void
  154. term_mode_tek()
  155. /* set terminal mode to tektronix */
  156. {
  157. X   long status;
  158. X   if (outfile != stdout) return; /* don't modify if not stdout */
  159. X   sys$assign(&sysoutput_desc,&chan,0,0);
  160. X   cur_char_buf[0] = 0x004A0000 | DC$_TERM | (TT$_TEK401X<<8);
  161. X   cur_char_buf[1] = (cur_char_buf[1] & 0x00FFFFFF) | 0x18000000;
  162. X
  163. X   cur_char_buf[1] &= ~TT$M_CRFILL;
  164. X   cur_char_buf[1] &= ~TT$M_ESCAPE;
  165. X   cur_char_buf[1] &= ~TT$M_HALFDUP;
  166. X   cur_char_buf[1] &= ~TT$M_LFFILL;
  167. X   cur_char_buf[1] &= ~TT$M_MECHFORM;
  168. X   cur_char_buf[1] &= ~TT$M_NOBRDCST;
  169. X   cur_char_buf[1] &= ~TT$M_NOECHO;
  170. X   cur_char_buf[1] &= ~TT$M_READSYNC;
  171. X   cur_char_buf[1] &= ~TT$M_REMOTE;
  172. X   cur_char_buf[1] |= TT$M_LOWER;
  173. X   cur_char_buf[1] |= TT$M_TTSYNC;
  174. X   cur_char_buf[1] |= TT$M_WRAP;
  175. X   cur_char_buf[1] &= ~TT$M_EIGHTBIT;
  176. X   cur_char_buf[1] &= ~TT$M_MECHTAB;
  177. X   cur_char_buf[1] &= ~TT$M_SCOPE;
  178. X   cur_char_buf[1] |= TT$M_HOSTSYNC;
  179. X
  180. X   cur_char_buf[2] &= ~TT2$M_APP_KEYPAD;
  181. X   cur_char_buf[2] &= ~TT2$M_BLOCK;
  182. X   cur_char_buf[2] &= ~TT2$M_DECCRT3;
  183. X   cur_char_buf[2] &= ~TT2$M_LOCALECHO;
  184. X   cur_char_buf[2] &= ~TT2$M_PASTHRU;
  185. X   cur_char_buf[2] &= ~TT2$M_REGIS;
  186. X   cur_char_buf[2] &= ~TT2$M_SIXEL;
  187. X   cur_char_buf[2] |= TT2$M_BRDCSTMBX;
  188. X   cur_char_buf[2] |= TT2$M_EDITING;
  189. X   cur_char_buf[2] |= TT2$M_INSERT;
  190. X   cur_char_buf[2] |= TT2$M_PRINTER;
  191. X   cur_char_buf[2] &= ~TT2$M_ANSICRT;
  192. X   cur_char_buf[2] &= ~TT2$M_AVO;
  193. X   cur_char_buf[2] &= ~TT2$M_DECCRT;
  194. X   cur_char_buf[2] &= ~TT2$M_DECCRT2;
  195. X   cur_char_buf[2] &= ~TT2$M_DRCS;
  196. X   cur_char_buf[2] &= ~TT2$M_EDIT;
  197. X   cur_char_buf[2] |= TT2$M_FALLBACK;
  198. X
  199. X   status = sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  200. X   if (status == SS$_BADPARAM) {
  201. X      /* terminal fallback utility not installed on system */
  202. X      cur_char_buf[2] &= ~TT2$M_FALLBACK;
  203. X      sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  204. X   }
  205. X   else {
  206. X      if (status != SS$_NORMAL)
  207. X         lib$signal(status,0,0);
  208. X   }
  209. X   sys$dassgn(chan);
  210. }
  211. X
  212. void
  213. term_mode_native()
  214. /* set terminal mode back to native */
  215. {
  216. X   int i;
  217. X   if (outfile != stdout) return; /* don't modify if not stdout */
  218. X   sys$assign(&sysoutput_desc,&chan,0,0);
  219. X   sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  220. X   for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  221. X   sys$dassgn(chan);
  222. }
  223. X
  224. void
  225. term_pasthru()
  226. /* set terminal mode pasthru */
  227. {
  228. X   if (outfile != stdout) return; /* don't modify if not stdout */
  229. X   sys$assign(&sysoutput_desc,&chan,0,0);
  230. X   cur_char_buf[2] |= TT2$M_PASTHRU;
  231. X   sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  232. X   sys$dassgn(chan);
  233. }
  234. X
  235. void
  236. term_nopasthru()
  237. /* set terminal mode nopasthru */
  238. {
  239. X   if (outfile != stdout) return; /* don't modify if not stdout */
  240. X   sys$assign(&sysoutput_desc,&chan,0,0);
  241. X   cur_char_buf[2] &= ~TT2$M_PASTHRU;
  242. X   sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  243. X   sys$dassgn(chan);
  244. }
  245. X
  246. void
  247. reopen_binary()
  248. /* close the file outfile outfile and reopen it with binary type
  249. X   if not already done or outfile == stdout */
  250. {
  251. X   stat_t stat_buf;
  252. X   char filename[MAX_ID_LEN+1];
  253. X   if (outfile != stdout) { /* don't modify if not stdout */
  254. X      if (!fstat(fileno(outfile),&stat_buf)) {
  255. X         if (stat_buf.st_fab_rfm != FAB$C_FIX) {
  256. X            /* modify only if not already done */
  257. X            (void) fclose(outfile);
  258. X            (void) strcpy(filename,outstr+1);   /* remove quotes */
  259. X            filename[strlen(filename)-1] = '\0';
  260. X            (void) delete(filename);
  261. X            if ((outfile = fopen(filename,"wb","rfm=fix","bls=512","mrs=512"))
  262. X                == (FILE *)NULL ) {
  263. X               if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  264. X                 os_error("cannot reopen file with binary type; output unknown",
  265. X                           NO_CARET);
  266. X               }
  267. X               else {
  268. X          os_error("cannot reopen file with binary type; output reset to ascii",
  269. X                           NO_CARET);
  270. X               }
  271. X            }
  272. X         }
  273. X      }
  274. X      else{
  275. X         os_error("cannot reopen file with binary type; output remains ascii",
  276. X                  NO_CARET);
  277. X      }
  278. X   }
  279. }
  280. X
  281. void
  282. fflush_binary()
  283. {
  284. X   typedef short int INT16;     /* signed 16-bit integers */
  285. X   register INT16 k;            /* loop index */
  286. X   if (outfile != stdout) {
  287. X       /* Stupid VMS fflush() raises error and loses last data block
  288. X          unless it is full for a fixed-length record binary file.
  289. X          Pad it here with NULL characters. */
  290. X       for (k = (INT16)((*outfile)->_cnt); k > 0; --k)
  291. X          putc('\0',outfile);
  292. X       fflush(outfile);
  293. X   }
  294. }
  295. #endif
  296. SHAR_EOF
  297. echo 'File gnuplot/term.c is complete' &&
  298. chmod 0644 gnuplot/term.c ||
  299. echo 'restore of gnuplot/term.c failed'
  300. Wc_c="`wc -c < 'gnuplot/term.c'`"
  301. test 50685 -eq "$Wc_c" ||
  302.     echo 'gnuplot/term.c: original size 50685, current size' "$Wc_c"
  303. rm -f _shar_wnt_.tmp
  304. fi
  305. # ============= gnuplot/Intergraph.x11 ==============
  306. if test -f 'gnuplot/Intergraph.x11' -a X"$1" != X"-c"; then
  307.     echo 'x - skipping gnuplot/Intergraph.x11 (File already exists)'
  308.     rm -f _shar_wnt_.tmp
  309. else
  310. > _shar_wnt_.tmp
  311. echo 'x - extracting gnuplot/Intergraph.x11 (Text)'
  312. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/Intergraph.x11' &&
  313. #!/bin/sh
  314. mv gnuplot_x11.c gnuplot_x11.c_x
  315. mv corplot.c corplot.c_pc
  316. acc -knr -DSYSV -DUSG -DVFORK -DNOCOPY -DGAMMA=gamma -DGETCWD -DX11 \
  317. -DUNIXPLOT -I/usr/include/X11 -I/usr/include/X11/Xaw *.c \
  318. -lbsd -lplot -lm -o gnuplot.intergraph
  319. mv gnuplot_x11.c_x gnuplot_x11.c
  320. acc -knr -DSYSV -DUSG -DVFORK -DNOCOPY -DGAMMA=gamma -DGETCWD -DX11 \
  321. -DUNIXPLOT -I/usr/include/X11 -I/usr/include/X11/Xaw gnuplot_x11.c \
  322. -lXaw -lXmu -lXt -lXext -lX11 -lbsd -lm -o gnuplot_x11.intergraph
  323. SHAR_EOF
  324. chmod 0644 gnuplot/Intergraph.x11 ||
  325. echo 'restore of gnuplot/Intergraph.x11 failed'
  326. Wc_c="`wc -c < 'gnuplot/Intergraph.x11'`"
  327. test 475 -eq "$Wc_c" ||
  328.     echo 'gnuplot/Intergraph.x11: original size 475, current size' "$Wc_c"
  329. rm -f _shar_wnt_.tmp
  330. fi
  331. # ============= gnuplot/linkopt.amg ==============
  332. if test -f 'gnuplot/linkopt.amg' -a X"$1" != X"-c"; then
  333.     echo 'x - skipping gnuplot/linkopt.amg (File already exists)'
  334.     rm -f _shar_wnt_.tmp
  335. else
  336. > _shar_wnt_.tmp
  337. echo 'x - extracting gnuplot/linkopt.amg (Text)'
  338. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/linkopt.amg' &&
  339. FROM LIB:c.o
  340. X     bitmap.o command.o eval.o graphics.o help.o internal.o misc.o parse.o
  341. X     plot.o scanner.o setshow.o standard.o term.o util.o version.o contour.o
  342. X     graph3d.o
  343. TO gnuplot
  344. LIB LIB:lcmieee.lib LIB:lcnb.lib
  345. VERBOSE
  346. SHAR_EOF
  347. chmod 0666 gnuplot/linkopt.amg ||
  348. echo 'restore of gnuplot/linkopt.amg failed'
  349. Wc_c="`wc -c < 'gnuplot/linkopt.amg'`"
  350. test 232 -eq "$Wc_c" ||
  351.     echo 'gnuplot/linkopt.amg: original size 232, current size' "$Wc_c"
  352. rm -f _shar_wnt_.tmp
  353. fi
  354. # ============= gnuplot/README.Install ==============
  355. if test -f 'gnuplot/README.Install' -a X"$1" != X"-c"; then
  356.     echo 'x - skipping gnuplot/README.Install (File already exists)'
  357.     rm -f _shar_wnt_.tmp
  358. else
  359. > _shar_wnt_.tmp
  360. echo 'x - extracting gnuplot/README.Install (Text)'
  361. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/README.Install' &&
  362. The GNUPLOT source code and executables may be copied and/or modified
  363. freely as long as the copyright messages are left intact.
  364. X
  365. See the History file for changes to GNUPLOT.
  366. X
  367. Compilation instructions are near the end of this file.
  368. X
  369. GNUPLOT has been tested on Sun3's and Sun4's (SunOS 4.0.3 and 4.1.1),
  370. a VAX 6410 (VMS 5.2), Commodore Amiga's (KS/WB 1.3 and 2.0, Lattice C
  371. and Aztec C beta 5.2a), IBM PC XT's and AT's (MS-DOS 3.3/5.0 BC++ 2.0/TC++
  372. 1.0), IRIS 4D/70G and 4D/25G with MIPS C, NeXT with gnu C 1.34,
  373. DECStation 5000/200PXG (ULTRIX V4.1),
  374. AT&T 3B1 (version 3.51m with cc and gcc 1.39),
  375. and Apollo's (DomainOS SR10.3 BSD4.3 with C compiler 68K Rev 6.7(316)).
  376. The code is written with portability in mind.
  377. GNUPLOT has not been tested on Pyramid 90x and IBM PC Microsoft C.
  378. X
  379. Send your comments, suggestions, or modifications to 
  380. X  pixar!info-gnuplot@sun.com
  381. This is a mailing list; to join it send a note to 
  382. X  pixar!info-gnuplot-request@sun.com
  383. Send bug reports to
  384. X  pixar!bug-gnuplot@sun.com
  385. X
  386. X                       PREPROCESSOR #DEFINES
  387. X
  388. These #defines should be checked before compilation (see the makefiles):
  389. define      file            note
  390. ------      ----            --------
  391. NOVFORK     Makefile        define if you don't have the vfork() system call
  392. GAMMA       Makefile        define if you've got gamma(3)
  393. MEMCPY      Makefile        define if your bcopy() is called memcpy()
  394. MEMSET      Makefile        define if you have memset() but not bzero()
  395. NOCOPY      Makefile        define if you've don't have a memcpy() by any name
  396. bcopy()     plot.h          define if you've got a memcpy() by some OTHER name
  397. X                              (see example in plot.h)
  398. PC          Makefile        define if compiling on a PClone
  399. MSDOS       Makefile        define if compiling under MSDOS;
  400. X                              automatically defined by Microsoft C 5.10
  401. HELPFILE    Makefile        name including path of gnuplot.gih file.
  402. VERYLARGE   plot.h          define to be largest coordinate number.
  403. SHELL       plot.h          default shell to spawn if SHELL environment
  404. X                              variable not found at run-time
  405. NOCWDRC     Makefile        define to inhibit check of ./.gnuplot
  406. READLINE    Makefile        define if you want command-line editing
  407. X
  408. Valid TERMFLAGS defines.  These defines are used to include the
  409. various plotting terminals, printers, and protocols that a given version
  410. of gnuplot can access:
  411. X
  412. define         file            note
  413. ------      ----            --------
  414. TERMFLAGS   Makefile        the set of terminals you want, from below
  415. X            or term.h
  416. X
  417. X   AED         AED 512 and AED 767
  418. X   AMIGASCREEN Amiga custom screen
  419. X   APOLLO      Apollo Graphics Primitive Resource (resizable window)
  420. X   ATT6300     PC with AT&T 6300 graphics
  421. X   BITGRAPH    BBN BitGraph
  422. X   CGI         SCO CGI
  423. X   CORONA      PC with Corona graphics 325
  424. X   DXY800A     Roland DXY800A plotter
  425. X   DUMB           Printer or glass dumb terminal
  426. X   DXF           AutoCad (Release 10.x) dxf file format
  427. X   EEPIC       EEPIC-extended LaTeX driver, for EEPIC users
  428. X   EGALIB      PC with EGA/VGA graphics.
  429. X   EMTEX       LATEX picture environment with emTeX specials
  430. X   EPS60       Epson-style 60-dot per inch printers
  431. X   EPSONP      Epson LX-800, Star NL-10, NX-1000 and lots of others
  432. X   FIG         Fig graphics language (requires object.h from TransFig)
  433. X   GPR         Apollo Graphics Primitive Resource (fixed-size window)
  434. X   HERCULES    IBM PC/Clone with Hercules graphics board
  435. X   HP2648      HP2648, HP2647
  436. X   HP26        HP2623A and maybe others
  437. X   HP75        HP7580, and probably other HPs
  438. X   HPGL        HP7475 and (hopefully) lots of others
  439. X   HPLJII      HP Laserjet II
  440. X   IMAGEN      Imagen laser printers (300dpi) (requires -Iterm also)
  441. X   IRIS4D      IRIS4D series computer
  442. X   KERMIT      MS-Kermit Tektronix 4010 emulator
  443. X   LATEX       LATEX picture environment
  444. X   NEC         NEC CP6 pinwriter printer
  445. X   POSTSCRIPT  Postscript
  446. X   PRESCRIBE   Kyocera Laser printer
  447. X   QMS         QMS/QUIC laserprinter (Talaris 1200 and others)
  448. X   REGIS       ReGis graphics (vt125, vt220, vt240, Gigis...)
  449. X   SELANAR     Selanar
  450. X   STARC       Star Color Printer
  451. X   SUN         Sun Microsystems Workstation
  452. X   T410X       Tektronix 4106, 4107, 4109 and 420x terminals
  453. X   TANDY60     Tandy DMP-130 series 60-dot per inch graphics
  454. X   TEK         Tektronix 4010, and probably others
  455. X   UNIXPC      unixpc (ATT 3b1 or ATT 7300)
  456. X   UNIXPLOT    unixplot
  457. X   V384        Vectrix 384 and tandy color printer
  458. X   VTTEK       VT like Tektronix 4010 emulator
  459. X   X11         X11R4 window system
  460. X
  461. X
  462. These #defines are defined automatically by various compilers, some
  463. gnuplot routines check these defines to implement features found in the
  464. various environments:
  465. X
  466. define           note
  467. ------        --------
  468. AMIGA_AC_5    defined for Manx Aztec C 5.2a on the Amiga
  469. AMIGA_LC_5_1  defined for Lattice C 5.01 on the Amiga
  470. apollo        defined by Apollo's C compilers.
  471. _CRAY         defined by CRAY's C compiler.
  472. __TURBOC__    defined automatically by Turbo C 2.0, C++ 1.0, Borland C++ 2.0
  473. unix          defined by most unix C compilers.  
  474. vms           (and VMS) defined by VAX-11 C under VMS.
  475. __ZTC__       Zortech C compiler under MSDOS.
  476. X
  477. X
  478. X                             TO COMPILE
  479. X
  480. under UNIX:  
  481. To compile do:
  482. X  Copy makefile.unx to Makefile
  483. X      cp makefile.unx Makefile
  484. X  Look through the Makefile to see if you need to make any changes.
  485. X  See especially the HELPDEST and TERMFLAGS variables.  Edit if needed.
  486. X  Alternatively, all these variables may be set as command line arguments to
  487. X  'make'. For example:
  488. X
  489. X    make <MACHINE> HELPDEST='/usr/um/misc/lib/gnuplot.gih' \
  490. X        DEST='/usr/um/misc/bin' READLINE=
  491. X
  492. X  Edit term.h, to include/exclude terminals
  493. X  Type
  494. X      make
  495. X  For further instructions.
  496. X  If that works, try
  497. X      make install
  498. X  For further instructions.
  499. X
  500. under VMS:  
  501. X  To compile:
  502. X     copy makefile.vms makefile.
  503. X     make
  504. X  Or if you don't have a suitable make:
  505. X     @buildvms
  506. X  To tell gnuplot where to find the help library:
  507. X      $ define gnuplot$help disk:[directory]gnuplot.hlb
  508. X  Alternatively (and preferably) put the help in the main system help library.
  509. X
  510. under AmigaDOS:
  511. Using Aztec C 5.2a
  512. X      make -f makefile.ami
  513. Using Lattice C 5.1
  514. X      lmk -f makefile.amg
  515. X
  516. under MSDOS:
  517. Using Microsoft C 5.10.
  518. X      copy makefile.msc makefile
  519. X      make makefile
  520. X
  521. Using Borland C++ 2.0, Turbo C++ 1.0
  522. X      copy makefile.tc makefile
  523. X  Edit makefile to change TC, BIN, BGI, BGIOBJ. You may also want to turn
  524. X      on overlays (See manual for more on overlays).
  525. X  Edit linkopt.tc (linkopt.tco if overlays on) to change location of
  526. X      libraries.
  527. X      make
  528. X
  529. Using Turbo C 2.0.
  530. X  As per Borland C++ 2.0. Edit linkopt.tc to change location of libraries.
  531. X
  532. X
  533. The file gnuplot.gih is needed for help on the PC.
  534. If the file gnuplot.gih is not in the default directory, then use:
  535. X    set GNUHELP={full path name of gnuplot.gih}
  536. X
  537. X
  538. X                         ENVIRONMENT VARIABLES
  539. X
  540. See 'help environment'.
  541. X
  542. If the environment variable GNUTERM is found, it is used as the terminal
  543. type. Otherwise, in some cases the variable TERM will be used, or the
  544. hardware may be automatically detected. 
  545. X
  546. The PC version looks for the environment variable GNUPLOT to contain
  547. the name of the directory from which to load the initialization file
  548. GNUPLOT.INI.  See the help on 'start_up' for more information.
  549. X
  550. HOME is examined as a directory where a .gnuplot startup file might be
  551. found. See help on "start-up".
  552. X
  553. If defined, the environment variable GNUHELP is used for the name
  554. of the .gih help file, otherwise HELPFILE (defined in makefile or 
  555. plot.c) is used.
  556. X
  557. The VMS version looks for the logical name GNUPLOT$HELP to locate 
  558. the help library.
  559. SHAR_EOF
  560. chmod 0644 gnuplot/README.Install ||
  561. echo 'restore of gnuplot/README.Install failed'
  562. Wc_c="`wc -c < 'gnuplot/README.Install'`"
  563. test 7729 -eq "$Wc_c" ||
  564.     echo 'gnuplot/README.Install: original size 7729, current size' "$Wc_c"
  565. rm -f _shar_wnt_.tmp
  566. fi
  567. # ============= gnuplot/History ==============
  568. if test -f 'gnuplot/History' -a X"$1" != X"-c"; then
  569.     echo 'x - skipping gnuplot/History (File already exists)'
  570.     rm -f _shar_wnt_.tmp
  571. else
  572. > _shar_wnt_.tmp
  573. echo 'x - extracting gnuplot/History (Text)'
  574. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/History' &&
  575. X
  576. X             GNUPLOT 3.0 RELEASE NOTES
  577. X
  578. This describes changes to gnuplot since version 2.02 (ie, 2.0
  579. patchlevel 2). 
  580. X
  581. Highlights: 
  582. -----------
  583. Gnuplot now handles surfaces as well. A new command names 'splot' (for
  584. surface plot) has been added for that purpose. A number of new 'set'
  585. options for surfaces have also been added and include: isosamples,
  586. view, contour, cntrparam, mapping and surface.  All tic/label/range
  587. setting for x and y axes were extended for z as well.
  588. X
  589. The size of data file for both curves and surfaces is now independent
  590. of the samples (and iso_samples) variables. Data structures will
  591. automatically be extended to hold the entire data file.
  592. X
  593. New features:
  594. -------------
  595. 3-d plotting with 'splot', and many auxiliary options.
  596. X
  597. New 'errorbars' plot style.
  598. X
  599. New 'using x:y{:z}' format (NOT COMPATIBLE WITH GNUPLOT 2.02).
  600. X
  601. Data file plotting (for both curves and surfaces) does not require
  602. setting samples (and isosamples for surfaces) any more. Size is
  603. increased on the fly, without affecting the sample rate of functions. 
  604. X
  605. New makefile scheme for unix, that supports lots of flavors.
  606. X
  607. Command-line editing and history.
  608. X
  609. Adjustable display of plot border ('set border').
  610. X
  611. Set-commands 'x/y/zlabel' can now position the label.
  612. X
  613. Set-command 'title' can now position the title.
  614. X
  615. New time display command ('set time').
  616. X
  617. All PostScript devices were rewritten and merged into one (Color
  618. Postscript is supported). Due to this many of the old postscript
  619. terminal driver names are not supported; only 'postscript' is
  620. recognized. Use 'help set terminal postscript' to find out how to get
  621. your old favorite back, and more.
  622. X
  623. A 'gnuplot' mode for emacs in the file gnuplot.el.
  624. X
  625. SGI device was improved.
  626. X
  627. New option to 'set arrow' called 'nohead'. 
  628. X
  629. List of all new commands:
  630. -------------------------
  631. splot
  632. X
  633. List of all new set-show commands:
  634. ---------------------------------
  635. border, cntrparam, contour, isosamples, mapping, rrange, surface,
  636. time, view, zlabel, ztics, zrange.
  637. X
  638. List of changed set-show commands:
  639. ----------------------------------
  640. arrow, terminal, title, xlabel, ylabel, zlabel
  641. X
  642. New terminal drivers:
  643. ---------------------
  644. vws, apollo, gpr apollo, dumb, BigFig, Super
  645. VGA, ln03/hplj/hpdj, dxf.
  646. X
  647. Deletions:
  648. ----------
  649. The gnut2p translator (translating gnutex to gnuplot) has been removed
  650. from the standard distribution.  It is available for ftp separately at
  651. cs.duke.edu as dist/sources/gnuplot/gnut2p.tar.Z
  652. X
  653. Bug fixes include:
  654. ------------------
  655. Fix a bug in parametric type hangup.
  656. X
  657. Add a .sty file to fix indexing problem in manual.
  658. X
  659. Fix a bug in hpljii.
  660. X
  661. Fix a bug in FIG arrows.
  662. X
  663. X
  664. X                            ACKNOWLEDGEMENTS
  665. X
  666. - New PostScript device by Russell Lang (rjl@monu1.cc.monash.edu.au).
  667. - Several bug fixes, manual proofing, World Map by John Campbell
  668. (campbell@nauvax.ucc.nau.edu).
  669. - Eliminating samples from data files, lasergnu, and errorbars by
  670. David Kotz (David.Kotz@Dartmouth.edu).
  671. - New history and line editing capability for Unix and MSDOS, bivariate
  672. X  functions and some bug fixes by Tom Tkacik (tkacik@hobbes.cs.gmr.com).
  673. - New using x:y{:z} format by Dennis Linse (djlinse@phoenix.princeton.edu).
  674. - Some polar enhancements, time display and some bug fixes by
  675. Alex Woo (woo@ra-next.arc.nasa.gov).
  676. - Dumb terminal by Francois Pinard (pinard@iro.umontreal.ca).
  677. - VWS device by Walter Speth (speth@dbnpib5.bitnet).
  678. - BigFig device by (ian@augean.ua.oz.au).
  679. - XDF device by Florian Hiss (fhis1231@w204zrz.zrz.tu-berlin.de).
  680. - HP Desk Jet device, overlay support for BCC and more efficient help
  681. and pc.trm for MSDOS by Maurice Castro and Russell Lang
  682. (rjl@monu1.cc.monash.edu.au). 
  683. - New makefile scheme by Roque Donizete De Oliveira and David Kotz
  684. (oliveria@caen.engin.umich.edu and David.Kotz@Dartmouth.edu).
  685. - The 3d extensions, contouring, Super VGA device, and bringing this new
  686. version up by Gershon Elber (gershon@cs.utah.edu).
  687. X
  688. Other bug fixes/improvments:
  689. = Tom Bopp (tbopp@uhunix.uhcc.hawaii.edu)
  690. = Kenneth H. Carpenter (khc@eece.ksu.edu)
  691. = Mark Christopher (christo@bnr.ca)
  692. = Henk de Haan (haan@irimcf.tudelft.nl)
  693. = David Gillespie (daveg@csvax.cs.caltech.edu)
  694. X
  695. Beta testers:
  696. + John Campbell (campbell@nauvax.ucc.nau.edu)
  697. + Kenneth H. Carpenter (khc@eece.ksu.edu)
  698. + Gershon Elber (gershon@cs.utah.edu)
  699. + Pat Empleo (empleop@afal-edwards.af.mil)
  700. + David Kotz (dfk@moose.dartmouth.edu)
  701. + Russell Lang (rjl@monu1.cc.monash.edu.au)
  702. + Tom Tkacik (tkacik@hobbes.cs.gmr.com)
  703. + Roque Donizete De Oliveira (oliveria@caen.engin.umich.edu)
  704. + Walter Speth (Speth@dbnpib5.bitnet)
  705. + Carsten Steger (stegerc@gshalle2.informatik.tu-muenchen.de)
  706. X
  707. ============================================================================
  708. X
  709. X                     GNUPLOT 2.0 RELEASE NOTES
  710. X
  711. New terminal drivers: ATT6300, Roland DXY800A, EEPIC, emTeX, EPSON LX-800, 
  712. EPSON 60dpi, Fig, HP2648, HPGL, HP LaserJet, Imagen, Kermit-MS Tektronix 
  713. emulator, LaTeX, MCGA, NEC CP6 pinwriter, POSTSCRIPT, Proprinter, Star color 
  714. printer, Tandy DMP-130, Tektronix 410x, SUN, VGA, X11.
  715. X
  716. Additions:
  717. X
  718. Command-line arguments are accepted. They are treated as names of
  719. files containing gnuplot commands. Gnuplot loads them, one by one, and
  720. then exits.
  721. X
  722. Command 'plot' now has a 'title' option to change the information in
  723. the key.  The 'with' option can now specify line type and point type.
  724. X
  725. Command 'pause'.
  726. X
  727. Command 'replot' allows the addition of extra plots. 
  728. X
  729. Command 'save' now saves all the 'set' options, including the last
  730. plot command.
  731. X
  732. Command 'set autoscale' now accepts autoscaling on the x axis for data
  733. files. The default is autoscaling on both axes. 
  734. X
  735. Command 'set noclip' disables clipping of points near the border. 'set
  736. clip' reenables clipping. The default used to be 'clip', and is now
  737. 'noclip'. Clipping has also been extended to clip lines that extend
  738. outside the borders: line plots are now clipped at the plot boundary.
  739. Formerly, the line stopped at the last in-range data point.
  740. X
  741. Numerical labelling at tic marks on x and y axes.  Command 'set
  742. format' allows the format of the tic mark labels to be altered.
  743. Commands 'set xtics' and 'set ytics' allow for alphanumeric labels and
  744. arbitrary tic positions. 
  745. X
  746. Command 'set grid' adds a grid between the tic marks.
  747. X
  748. Improved key gives sample point or line types.  Key can be disabled
  749. with the 'set nokey'. Key can be positioned anywhere. 
  750. X
  751. Command 'set label' allows the placement of arbitrary text labels and
  752. arrows. 
  753. X
  754. Command 'set polar' for polar plots.
  755. X
  756. Command 'set offsets' for reducing the plotted area.  Useful for polar
  757. plots.
  758. X
  759. Command 'set size' scales the displayed size of the plot.
  760. X
  761. Command 'set tics out' causes the tics to be drawn outwards from the
  762. border.  Useful for impulse plots.
  763. X
  764. Command 'set title' places a text label above the plot.
  765. X
  766. Commands 'set xlabel' and 'set ylabel' place text labels on the x and
  767. y axes respectively.  Some terminals will place the y label vertically
  768. upwards on the left of the plot, others place the label horizontally
  769. at the left of the plot.
  770. X
  771. Improved tics on log scales.
  772. X
  773. Extended comments: comments are allowed anywhere reasonable in the
  774. input line, and continue to the end of the input line.
  775. X
  776. Line continuation (with \) is added.
  777. X
  778. Non-interactive use, through redirection or "load" command, is
  779. improved. Error messages expanded to include file name and line
  780. number, and to reprint command line if not interactive.
  781. X
  782. New plotting styles 'linespoints' and 'dots'.
  783. X
  784. Blank lines in data files denote "breaks". In lines and linespoints
  785. plot styles, this breaks the curve being drawn and begins at the next
  786. point, without changing the line or point types.
  787. X
  788. Completely new interactive help system that is similar to VMS help
  789. system. A printed manual can be obtained in LaTeX, troff, or nroff and
  790. is based on the same information as the interactive help.
  791. X
  792. PC version now compiles with the large model so that gnuplot will
  793. compile with the above additions!
  794. X
  795. Bug fixes include:
  796. ------------------
  797. Bug involving functions plotted on a logarithmic x axis is fixed. 
  798. X
  799. Errors inside of loaded files now clean up and close files properly.
  800. X
  801. Numbers of the form xxxxe+nn are now acceptable (+ sign caused error).
  802. X
  803. Tics are now place inside the borders (some were outside).
  804. X
  805. Reverse axes now work properly.
  806. X
  807. Command 'set output ""' used to crash.  
  808. X
  809. VMS was closing stdout, so 'set output' code changed to avoid closing
  810. it.  VMS version of gnuplot now performs a SET TERM/NOWRAP itself.
  811. X
  812. Terminal is now reset before closing output file, changing terminal
  813. type or exiting gnuplot.
  814. X
  815. Several old bugs have been superseded by new ones.
  816. X
  817. X
  818. X                            ACKNOWLEDGEMENTS
  819. X
  820. The Unix PC, polar, pause, and offset additions were by John Campbell.
  821. (CAMPBELL@NAUVAX.bitnet)
  822. The Turbo C additions were by Bill Wilson.
  823. (WILSON@NAUVAX.bitnet)
  824. Some of the labelling improvements and combining of these additions 
  825. were by Russell Lang.
  826. (rjl@monu1.cc.monash.oz.au)
  827. The LaTeX driver, the help system, and some of the labelling
  828. improvements were by David Kotz. 
  829. (David.Kotz@Dartmouth.edu)
  830. And of course, the vast majority of the program is by Colin Kelley
  831. and Thomas Williams.
  832. (pixar!info-gnuplot@sun.com)
  833. X
  834. =======================================================================
  835. X
  836. X                      GNUPLOT 1.1 RELEASE NOTES
  837. X
  838. New terminal drivers: AED 512, BBN BitGraph, HP2623, POSTSCRIPT,
  839. Selanar, Vectrix 384.  The PC version now supports Hercules and ATT
  840. 6300 monochrome graphics.  Thanks to those who sent these drivers in.
  841. X
  842. New commands: 'set dummy' and 'show dummy' to select the dummy
  843. variable name; 'replot' to repeat the last 'plot' command.
  844. X
  845. The exclamation point (!) is now accepted as postfix factorial
  846. operator.  The gamma() function is also included, if your C library
  847. has gamma().  See GAMMA below.
  848. X
  849. Logical AND (&&) and OR (||) now short-circuit the way they do in C.
  850. That is, the second && operand is not evaluated if the first is false;
  851. the second || operand is not evaluated if the first is true.  The
  852. ternary operator (?:) also does not evaluate the unused operand.  This
  853. change allows for the definition of recursive functions, e.g. a
  854. synonym for the ! factorial operator:
  855. X
  856. X    fact(x) = (x<=1) ? 1 : x*fact(x-1)
  857. X
  858. GNUPLOT now has a much better memory allocation scheme, replacing most
  859. fixed-size arrays with malloc()'d linked lists.  There is no longer
  860. any artificial maximum on the number of simultaneous plots, number of
  861. points in those plots, or the number of user-defined functions or
  862. variables.  All these are limited only by the memory available to
  863. malloc().  This is a big improvement for memory-starved machines like
  864. PDP-11s or PCs.
  865. X
  866. Lines beginning with # (also ! in VMS) are treated as comments.  Only
  867. the $ may now be used for a shell escape in VMS, since ! is a comment.
  868. X
  869. Several old bugs have been superseded by new ones.
  870. SHAR_EOF
  871. chmod 0644 gnuplot/History ||
  872. echo 'restore of gnuplot/History failed'
  873. Wc_c="`wc -c < 'gnuplot/History'`"
  874. test 10762 -eq "$Wc_c" ||
  875.     echo 'gnuplot/History: original size 10762, current size' "$Wc_c"
  876. rm -f _shar_wnt_.tmp
  877. fi
  878. # ============= gnuplot/README.gnutex ==============
  879. if test -f 'gnuplot/README.gnutex' -a X"$1" != X"-c"; then
  880.     echo 'x - skipping gnuplot/README.gnutex (File already exists)'
  881.     rm -f _shar_wnt_.tmp
  882. else
  883. > _shar_wnt_.tmp
  884. echo 'x - extracting gnuplot/README.gnutex (Text)'
  885. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/README.gnutex' &&
  886. A note to former Gnutex users, from David Kotz (David.Kotz@Dartmouth.edu).
  887. --------------------------------------------------------------------------
  888. X
  889. May 30, 1991
  890. X
  891. GNUTeX was merged with GNUPLOT beginning with GNUPLOT 2.0.  Many
  892. aspects of gnutex 1.6 made it into GNUPLOT 2.0. Unfortunately for
  893. those of us who have a lot of gnutex input files around, not
  894. everything from gnutex is supported by GNUPLOT. To help gnutex users
  895. with the process of adapting to GNUPLOT (and I recommend it), I have
  896. included a section in the LaTeX/GNUPLOT tutorial (in ./docs/latextut/)
  897. about the differences, and written a translator program.  Please read
  898. the LaTeX/GNUPLOT tutorial. 
  899. X
  900. The translator was available as part of the GNUPLOT 2.0 release, but
  901. has been removed from the standard distribution of GNUPLOT.  The
  902. translator is now available for anonymous ftp from cs.duke.edu as
  903. dist/sources/gnuplot/gnut2p.tar.Z. It has not changed since GNUPLOT
  904. 2.01 (ie, GNUPLOT 2.0 patchlevel 1).
  905. X
  906. Users of gnutex that did not use the LaTeX driver will probably have
  907. little difficulty adapting. 
  908. X
  909. Please send all comments, complaints, and suggestions on this subject
  910. to David.Kotz@Dartmouth.edu.
  911. SHAR_EOF
  912. chmod 0644 gnuplot/README.gnutex ||
  913. echo 'restore of gnuplot/README.gnutex failed'
  914. Wc_c="`wc -c < 'gnuplot/README.gnutex'`"
  915. test 1170 -eq "$Wc_c" ||
  916.     echo 'gnuplot/README.gnutex: original size 1170, current size' "$Wc_c"
  917. rm -f _shar_wnt_.tmp
  918. fi
  919. # ============= gnuplot/makefile.amg ==============
  920. if test -f 'gnuplot/makefile.amg' -a X"$1" != X"-c"; then
  921.     echo 'x - skipping gnuplot/makefile.amg (File already exists)'
  922.     rm -f _shar_wnt_.tmp
  923. else
  924. > _shar_wnt_.tmp
  925. echo 'x - extracting gnuplot/makefile.amg (Text)'
  926. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.amg' &&
  927. # Makefile for SAS/C 5.10 on the Amiga
  928. X
  929. CC = lc
  930. X
  931. # Remove '-fi' if you don't want to use the better Commodore math-routines.
  932. # If you do so, you'll have to change 'lcmieee.lib' to 'lcm.lib' in
  933. # "linkopt.amg"
  934. CFLAGS = -b0 -dAMIGA_LC_5_1 -dNOGAMMA -dMEMSET -dMEMCPY -j85i -j88i -fi
  935. X
  936. .c.o:
  937. X    $(CC) $(CFLAGS) $<
  938. X
  939. OBJS = bitmap.o command.o contour.o eval.o graphics.o graph3d.o help.o \
  940. X    internal.o misc.o parse.o plot.o scanner.o setshow.o \
  941. X    standard.o term.o util.o version.o
  942. X
  943. CSOURCE1 = command.c setshow.c 
  944. CSOURCE2 = help.c graphics.c graph3d.o internal.c 
  945. CSOURCE3 = misc.c eval.c parse.c plot.c scanner.c standard.c 
  946. CSOURCE4 = bitmap.c term.c util.c version.c
  947. CSOURCE5 = term/aed.trm term/cgi.trm term/dumb.trm term/dxy.trm \
  948. X    term/eepic.trm term/epson.trm term/fig.trm term/hp26.trm \
  949. X    term/hp2648.trm term/hpgl.trm term/hpljii.trm term/vws.trm
  950. CSOURCE6 = term/impcodes.h term/imagen.trm term/object.h \
  951. X    term/iris4d.trm term/kyo.trm term/latex.trm term/pc.trm \
  952. X    term/amiga.trm
  953. CSOURCE7 = term/post.trm term/qms.trm term/regis.trm term/sun.trm \
  954. X    term/t410x.trm term/tek.trm term/unixpc.trm term/unixplot.trm \
  955. X    term/v384.trm term/x11.trm gnuplot_x11.c
  956. CSOURCE8 = contour.c
  957. X
  958. gnuplot: $(OBJS)
  959. X    blink with linkopt.amg
  960. X
  961. bitmap.o: bitmap.c bitmap.h plot.h
  962. command.o: command.c plot.h setshow.h help.h
  963. contour.o: contour.c plot.h
  964. eval.o: eval.c plot.h
  965. graph3d.o: graph3d.c plot.h setshow.h
  966. graphics.o: graphics.c plot.h setshow.h
  967. help.o: help.c plot.h help.h
  968. internal.o: internal.c plot.h
  969. misc.o: misc.c plot.h setshow.h help.h
  970. parse.o: parse.c plot.h
  971. plot.o: plot.c plot.h setshow.h
  972. scanner.o: scanner.c plot.h
  973. setshow.o: setshow.c plot.h setshow.h
  974. standard.o: standard.c plot.h
  975. term.o: term.c term.h plot.h setshow.c bitmap.h $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
  976. util.o: util.c plot.h
  977. version.o: version.c
  978. SHAR_EOF
  979. chmod 0644 gnuplot/makefile.amg ||
  980. echo 'restore of gnuplot/makefile.amg failed'
  981. Wc_c="`wc -c < 'gnuplot/makefile.amg'`"
  982. test 1808 -eq "$Wc_c" ||
  983.     echo 'gnuplot/makefile.amg: original size 1808, current size' "$Wc_c"
  984. rm -f _shar_wnt_.tmp
  985. fi
  986. # ============= gnuplot/graphics.c ==============
  987. if test -f 'gnuplot/graphics.c' -a X"$1" != X"-c"; then
  988.     echo 'x - skipping gnuplot/graphics.c (File already exists)'
  989.     rm -f _shar_wnt_.tmp
  990. else
  991. > _shar_wnt_.tmp
  992. echo 'x - extracting gnuplot/graphics.c (Text)'
  993. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/graphics.c' &&
  994. /* GNUPLOT - graphics.c */
  995. /*
  996. X * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  997. X *
  998. X * Permission to use, copy, and distribute this software and its
  999. X * documentation for any purpose with or without fee is hereby granted, 
  1000. X * provided that the above copyright notice appear in all copies and 
  1001. X * that both that copyright notice and this permission notice appear 
  1002. X * in supporting documentation.
  1003. X *
  1004. X * Permission to modify the software is granted, but not the right to
  1005. X * distribute the modified code.  Modifications are to be distributed 
  1006. X * as patches to released version.
  1007. X *  
  1008. X * This software is provided "as is" without express or implied warranty.
  1009. X * 
  1010. X *
  1011. X * AUTHORS
  1012. X * 
  1013. X *   Original Software:
  1014. X *     Thomas Williams,  Colin Kelley.
  1015. X * 
  1016. X *   Gnuplot 2.0 additions:
  1017. X *       Russell Lang, Dave Kotz, John Campbell.
  1018. X *
  1019. X *   Gnuplot 3.0 additions:
  1020. X *       Gershon Elber and many others.
  1021. X * 
  1022. X * Send your comments or suggestions to 
  1023. X *  pixar!info-gnuplot@sun.com.
  1024. X * This is a mailing list; to join it send a note to 
  1025. X *  pixar!info-gnuplot-request@sun.com.  
  1026. X * Send bug reports to
  1027. X *  pixar!bug-gnuplot@sun.com.
  1028. X */
  1029. X
  1030. #include <stdio.h>
  1031. #include <math.h>
  1032. #include <assert.h>
  1033. #include <time.h>
  1034. #include "plot.h"
  1035. #include "setshow.h"
  1036. X
  1037. extern char *strcpy(),*strncpy(),*strcat(),*ctime();
  1038. char *tdate;
  1039. #ifdef AMIGA_AC_5
  1040. time_t dated;
  1041. #else
  1042. #ifdef VMS
  1043. time_t dated,time();
  1044. #else
  1045. long dated,time();
  1046. #endif
  1047. #endif
  1048. X
  1049. void plot_impulses();
  1050. void plot_lines();
  1051. void plot_points();
  1052. void plot_dots();
  1053. void plot_bars();
  1054. void edge_intersect();
  1055. BOOLEAN two_edge_intersect();
  1056. X
  1057. /* for plotting error bars */
  1058. #define ERRORBARTIC (t->h_tic/2) /* half the width of error bar tic mark */
  1059. X
  1060. #ifndef max        /* Lattice C has max() in math.h, but shouldn't! */
  1061. #define max(a,b) ((a > b) ? a : b)
  1062. #endif
  1063. X
  1064. #ifndef min
  1065. #define min(a,b) ((a < b) ? a : b)
  1066. #endif
  1067. X
  1068. #define inrange(z,min,max) ((min<max) ? ((z>=min)&&(z<=max)) : ((z>=max)&&(z<=min)) )
  1069. X
  1070. /* True if a and b have the same sign or zero (positive or negative) */
  1071. #define samesign(a,b) ((a) * (b) >= 0)
  1072. X
  1073. /* Define the boundary of the plot
  1074. X * These are computed at each call to do_plot, and are constant over
  1075. X * the period of one do_plot. They actually only change when the term
  1076. X * type changes and when the 'set size' factors change. 
  1077. X */
  1078. static int xleft, xright, ybot, ytop;
  1079. X
  1080. /* Boundary and scale factors, in user coordinates */
  1081. /* x_min, x_max, y_min, y_max are local to this file and
  1082. X * are not the same as variables of the same names in other files
  1083. X */
  1084. static double x_min, x_max, y_min, y_max;
  1085. static double xscale, yscale;
  1086. X
  1087. /* And the functions to map from user to terminal coordinates */
  1088. #define map_x(x) (int)(xleft+(x-x_min)*xscale+0.5) /* maps floating point x to screen */ 
  1089. #define map_y(y) (int)(ybot+(y-y_min)*yscale+0.5)    /* same for y */
  1090. X
  1091. /* (DFK) Watch for cancellation error near zero on axes labels */
  1092. #define SIGNIF (0.01)        /* less than one hundredth of a tic mark */
  1093. #define CheckZero(x,tic) (fabs(x) < ((tic) * SIGNIF) ? 0.0 : (x))
  1094. #define NearlyEqual(x,y,tic) (fabs((x)-(y)) < ((tic) * SIGNIF))
  1095. X
  1096. /* (DFK) For some reason, the Sun386i compiler screws up with the CheckLog 
  1097. X * macro, so I write it as a function on that machine.
  1098. X */
  1099. #ifndef sun386
  1100. /* (DFK) Use 10^x if logscale is in effect, else x */
  1101. #define CheckLog(log, x) ((log) ? pow(10., (x)) : (x))
  1102. #else
  1103. static double
  1104. CheckLog(log, x)
  1105. X     BOOLEAN log;
  1106. X     double x;
  1107. {
  1108. X  if (log)
  1109. X    return(pow(10., x));
  1110. X  else
  1111. X    return(x);
  1112. }
  1113. #endif /* sun386 */
  1114. X
  1115. double
  1116. LogScale(coord, islog, what, axis)
  1117. X    double coord;            /* the value */
  1118. X    BOOLEAN islog;            /* is this axis in logscale? */
  1119. X    char *what;            /* what is the coord for? */
  1120. X    char *axis;            /* which axis is this for ("x" or "y")? */
  1121. {
  1122. X    if (islog) {
  1123. X       if (coord <= 0.0) {
  1124. X          char errbuf[100];        /* place to write error message */
  1125. X        (void) sprintf(errbuf,"%s has %s coord of %g; must be above 0 for log scale!",
  1126. X                what, axis, coord);
  1127. X          (*term_tbl[term].text)();
  1128. X          (void) fflush(outfile);
  1129. X          int_error(errbuf, NO_CARET);
  1130. X       } else
  1131. X        return(log10(coord));
  1132. X    }
  1133. X    return(coord);
  1134. }
  1135. X
  1136. /* borders of plotting area */
  1137. /* computed once on every call to do_plot */
  1138. boundary(scaling)
  1139. X    BOOLEAN scaling;        /* TRUE if terminal is doing the scaling */
  1140. {
  1141. X    register struct termentry *t = &term_tbl[term];
  1142. X    xleft = (t->h_char)*12;
  1143. X    xright = (scaling ? 1 : xsize) * (t->xmax) - (t->h_char)*2 - (t->h_tic);
  1144. X    ybot = (t->v_char)*7/2 + 1;
  1145. X    ytop = (scaling ? 1 : ysize) * (t->ymax) - (t->v_char)*5/2 - 1;
  1146. }
  1147. X
  1148. X
  1149. double dbl_raise(x,y)
  1150. double x;
  1151. int y;
  1152. {
  1153. register int i;
  1154. double val;
  1155. X
  1156. X    val = 1.0;
  1157. X    for (i=0; i < abs(y); i++)
  1158. X        val *= x;
  1159. X    if (y < 0 ) return (1.0/val);
  1160. X    return(val);
  1161. }
  1162. X
  1163. X
  1164. double make_tics(tmin,tmax,logscale)
  1165. double tmin,tmax;
  1166. BOOLEAN logscale;
  1167. {
  1168. register double xr,xnorm,tics,tic,l10;
  1169. X
  1170. X    xr = fabs(tmin-tmax);
  1171. X    
  1172. X    l10 = log10(xr);
  1173. X    if (logscale) {
  1174. X        tic = dbl_raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1));
  1175. X        if (tic < 1.0)
  1176. X            tic = 1.0;
  1177. X    } else {
  1178. X        xnorm = pow(10.0,l10-(double)((l10 >= 0.0 ) ? (int)l10 : ((int)l10-1)));
  1179. X        if (xnorm <= 2)
  1180. X            tics = 0.2;
  1181. X        else if (xnorm <= 5)
  1182. X            tics = 0.5;
  1183. X        else tics = 1.0;    
  1184. X        tic = tics * dbl_raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1));
  1185. X    }
  1186. X    return(tic);
  1187. }
  1188. X
  1189. X
  1190. do_plot(plots, pcount, min_x, max_x, min_y, max_y)
  1191. struct curve_points *plots;
  1192. int pcount;            /* count of plots in linked list */
  1193. double min_x, max_x;
  1194. double min_y, max_y;
  1195. {
  1196. register struct termentry *t = &term_tbl[term];
  1197. register int curve, xaxis_y, yaxis_x;
  1198. register struct curve_points *this_plot;
  1199. register double ytic, xtic;
  1200. register int xl, yl;
  1201. X            /* only a Pyramid would have this many registers! */
  1202. double xtemp, ytemp;
  1203. struct text_label *this_label;
  1204. struct arrow_def *this_arrow;
  1205. BOOLEAN scaling;
  1206. X
  1207. /* store these in variables global to this file */
  1208. /* otherwise, we have to pass them around a lot */
  1209. X     x_min = min_x;
  1210. X     x_max = max_x; 
  1211. X     y_min = min_y;
  1212. X     y_max = max_y;
  1213. X
  1214. X    if (polar) {
  1215. X        /* will possibly change x_min, x_max, y_min, y_max */
  1216. X        polar_xform(plots,pcount);
  1217. X    }
  1218. X
  1219. X    if (y_min == VERYLARGE || y_max == -VERYLARGE ||
  1220. X        x_min == VERYLARGE || x_max == -VERYLARGE)
  1221. X        int_error("all points undefined!", NO_CARET);
  1222. X
  1223. /*    Apply the desired viewport offsets. */
  1224. X     if (y_min < y_max) {
  1225. X        y_min -= boff;
  1226. X        y_max += toff;
  1227. X    } else {
  1228. X        y_max -= boff;
  1229. X        y_min += toff;
  1230. X    }
  1231. X     if (x_min < x_max) {
  1232. X        x_min -= loff;
  1233. X        x_max += roff;
  1234. X    } else {
  1235. X        x_max -= loff;
  1236. X        x_min += roff;
  1237. X    }
  1238. X
  1239. /* SETUP RANGES, SCALES AND TIC PLACES */
  1240. X    if (ytics && yticdef.type == TIC_COMPUTED) {
  1241. X       ytic = make_tics(y_min,y_max,log_y);
  1242. X    
  1243. X       if (autoscale_ly) {
  1244. X          if (y_min < y_max) {
  1245. X             y_min = ytic * floor(y_min/ytic);       
  1246. X             y_max = ytic * ceil(y_max/ytic);
  1247. X          }
  1248. X          else {            /* reverse axis */
  1249. X             y_min = ytic * ceil(y_min/ytic);       
  1250. X             y_max = ytic * floor(y_max/ytic);
  1251. X          }
  1252. X       }
  1253. X    }
  1254. X
  1255. X    if (xtics && xticdef.type == TIC_COMPUTED) {
  1256. X       xtic = make_tics(x_min,x_max,log_x);
  1257. X       
  1258. X       if (autoscale_lx) {
  1259. X          if (x_min < x_max) {
  1260. X             x_min = xtic * floor(x_min/xtic);    
  1261. X             x_max = xtic * ceil(x_max/xtic);
  1262. X          } else {
  1263. X             x_min = xtic * ceil(x_min/xtic);
  1264. X             x_max = xtic * floor(x_max/xtic);    
  1265. X          }
  1266. X       }
  1267. X    }
  1268. X
  1269. /*    This used be x_max == x_min, but that caused an infinite loop once. */
  1270. X    if (fabs(x_max - x_min) < zero)
  1271. X        int_error("x_min should not equal x_max!",NO_CARET);
  1272. X    if (fabs(y_max - y_min) < zero)
  1273. X        int_error("y_min should not equal y_max!",NO_CARET);
  1274. X
  1275. /* INITIALIZE TERMINAL */
  1276. X    if (!term_init) {
  1277. X        (*t->init)();
  1278. X        term_init = TRUE;
  1279. X    }
  1280. X    screen_ok = FALSE;
  1281. #ifdef AMIGA_LC_5_1
  1282. X     scaling = (*t->scale)((double)xsize, (double)ysize);
  1283. #else
  1284. X     scaling = (*t->scale)(xsize, ysize);
  1285. #endif
  1286. X    (*t->graphics)();
  1287. X
  1288. X     /* now compute boundary for plot (xleft, xright, ytop, ybot) */
  1289. X     boundary(scaling);
  1290. X
  1291. /* SCALE FACTORS */
  1292. X    yscale = (ytop - ybot)/(y_max - y_min);
  1293. X    xscale = (xright - xleft)/(x_max - x_min);
  1294. X    
  1295. /* DRAW AXES */
  1296. X    (*t->linetype)(-1);    /* axis line type */
  1297. X    xaxis_y = map_y(0.0);
  1298. X    yaxis_x = map_x(0.0); 
  1299. X
  1300. X    if (xaxis_y < ybot)
  1301. X        xaxis_y = ybot;                /* save for impulse plotting */
  1302. X    else if (xaxis_y >= ytop)
  1303. X        xaxis_y = ytop ;
  1304. X    else if (xzeroaxis && !log_y) {
  1305. X        (*t->move)(xleft,xaxis_y);
  1306. X        (*t->vector)(xright,xaxis_y);
  1307. X    }
  1308. X
  1309. X    if (yzeroaxis && !log_x && yaxis_x >= xleft && yaxis_x < xright ) {
  1310. X        (*t->move)(yaxis_x,ybot);
  1311. X        (*t->vector)(yaxis_x,ytop);
  1312. X    }
  1313. X
  1314. /* DRAW TICS */
  1315. X    (*t->linetype)(-2); /* border linetype */
  1316. X
  1317. X    /* label y axis tics */
  1318. X     if (ytics) {
  1319. X        switch (yticdef.type) {
  1320. X           case TIC_COMPUTED: {
  1321. X               if (y_min < y_max)
  1322. X                draw_ytics(ytic * floor(y_min/ytic),
  1323. X                        ytic,
  1324. X                        ytic * ceil(y_max/ytic));
  1325. X              else
  1326. X                draw_ytics(ytic * floor(y_max/ytic),
  1327. X                        ytic,
  1328. X                        ytic * ceil(y_min/ytic));
  1329. X
  1330. X              break;
  1331. X           }
  1332. X           case TIC_SERIES: {
  1333. X              draw_series_ytics(yticdef.def.series.start, 
  1334. X                            yticdef.def.series.incr, 
  1335. X                            yticdef.def.series.end);
  1336. X              break;
  1337. X           }
  1338. X           case TIC_USER: {
  1339. X              draw_set_ytics(yticdef.def.user);
  1340. X              break;
  1341. X           }
  1342. X           default: {
  1343. X              (*t->text)();
  1344. X                (void) fflush(outfile);
  1345. X              int_error("unknown tic type in yticdef in do_plot", NO_CARET);
  1346. X              break;        /* NOTREACHED */
  1347. X           }
  1348. X        }
  1349. X    }
  1350. X
  1351. X    /* label x axis tics */
  1352. X     if (xtics) {
  1353. X        switch (xticdef.type) {
  1354. X           case TIC_COMPUTED: {
  1355. X               if (x_min < x_max)
  1356. X                draw_xtics(xtic * floor(x_min/xtic),
  1357. X                        xtic,
  1358. X                        xtic * ceil(x_max/xtic));
  1359. X              else
  1360. X                draw_xtics(xtic * floor(x_max/xtic),
  1361. X                        xtic,
  1362. X                        xtic * ceil(x_min/xtic));
  1363. X
  1364. X              break;
  1365. X           }
  1366. X           case TIC_SERIES: {
  1367. X              draw_series_xtics(xticdef.def.series.start, 
  1368. X                            xticdef.def.series.incr, 
  1369. X                            xticdef.def.series.end);
  1370. X              break;
  1371. X           }
  1372. X           case TIC_USER: {
  1373. X              draw_set_xtics(xticdef.def.user);
  1374. X              break;
  1375. X           }
  1376. X           default: {
  1377. X              (*t->text)();
  1378. X              (void) fflush(outfile);
  1379. X              int_error("unknown tic type in xticdef in do_plot", NO_CARET);
  1380. X              break;        /* NOTREACHED */
  1381. X           }
  1382. X        }
  1383. X    }
  1384. X
  1385. /* DRAW PLOT BORDER */
  1386. X    (*t->linetype)(-2); /* border linetype */
  1387. X    if (draw_border) {
  1388. X        (*t->move)(xleft,ybot);
  1389. X        (*t->vector)(xright,ybot);
  1390. X        (*t->vector)(xright,ytop);
  1391. X        (*t->vector)(xleft,ytop);
  1392. X        (*t->vector)(xleft,ybot);
  1393. X    }
  1394. X
  1395. /* PLACE YLABEL */
  1396. X    if (strlen(ylabel) > 0) {
  1397. X        int x, y;
  1398. X
  1399. X        x = ylabel_xoffset * t->h_char;
  1400. X        y = ylabel_yoffset * t->v_char;
  1401. X        if ((*t->text_angle)(1)) {
  1402. X            if ((*t->justify_text)(CENTRE)) {
  1403. X                (*t->put_text)(x+(t->v_char),
  1404. X                         y+(ytop+ybot)/2, ylabel);
  1405. X            }
  1406. X            else {
  1407. X                (*t->put_text)(x+(t->v_char),
  1408. X                           y+(ytop+ybot)/2-(t->h_char)*strlen(ylabel)/2, 
  1409. X                         ylabel);
  1410. X            }
  1411. X        }
  1412. X        else {
  1413. X            (void)(*t->justify_text)(LEFT);
  1414. X            (*t->put_text)(x,y+ytop+(t->v_char), ylabel);
  1415. X        }
  1416. X        (void)(*t->text_angle)(0);
  1417. X    }
  1418. X
  1419. /* PLACE XLABEL */
  1420. X    if (strlen(xlabel) > 0) {
  1421. X        int x, y;
  1422. X
  1423. X        x = xlabel_xoffset * t->h_char;
  1424. X        y = xlabel_yoffset * t->v_char;
  1425. X
  1426. X            if ((*t->justify_text)(CENTRE)) 
  1427. X            (*t->put_text)(x+(xleft+xright)/2,
  1428. X                       y+ybot-2*(t->v_char), xlabel);
  1429. X            else
  1430. X            (*t->put_text)(x+(xleft+xright)/2 - strlen(xlabel)*(t->h_char)/2,
  1431. X                           y+ybot-2*(t->v_char), xlabel);
  1432. X    }
  1433. X
  1434. /* PLACE TITLE */
  1435. X    if (strlen(title) > 0) {
  1436. X        int x, y;
  1437. X
  1438. X        x = title_xoffset * t->h_char;
  1439. X        y = title_yoffset * t->v_char;
  1440. X
  1441. X            if ((*t->justify_text)(CENTRE))
  1442. X            (*t->put_text)(x+(xleft+xright)/2,
  1443. X                       y+ytop+(t->v_char), title);
  1444. X            else
  1445. X            (*t->put_text)(x+(xleft+xright)/2 - strlen(title)*(t->h_char)/2,
  1446. X                       y+ytop+(t->v_char), title);
  1447. X    }
  1448. X
  1449. X
  1450. /* PLACE TIMEDATE */
  1451. X    if (timedate) {
  1452. X        int x, y;
  1453. X
  1454. X        x = time_xoffset * t->h_char;
  1455. X        y = time_yoffset * t->v_char;
  1456. X        dated = time( (long *) 0);
  1457. X        tdate = ctime( &dated);
  1458. X        tdate[24]='\0';
  1459. X        if ((*t->text_angle)(1)) {
  1460. X            if ((*t->justify_text)(CENTRE)) {
  1461. X                (*t->put_text)(x+(t->v_char),
  1462. X                         y+ybot+4*(t->v_char), tdate);
  1463. X            }
  1464. X            else {
  1465. X                (*t->put_text)(x+(t->v_char),
  1466. X                         y+ybot+4*(t->v_char)-(t->h_char)*strlen(ylabel)/2, 
  1467. X                         tdate);
  1468. X            }
  1469. X        }
  1470. X        else {
  1471. X            (void)(*t->justify_text)(LEFT);
  1472. X            (*t->put_text)(x,
  1473. X                         y+ybot-3*(t->v_char), tdate);
  1474. X        }
  1475. X        (void)(*t->text_angle)(0);
  1476. X    }
  1477. X
  1478. /* PLACE LABELS */
  1479. X    for (this_label = first_label; this_label!=NULL;
  1480. X            this_label=this_label->next ) {
  1481. X         xtemp = LogScale(this_label->x, log_x, "label", "x");
  1482. X         ytemp = LogScale(this_label->y, log_y, "label", "y");
  1483. X        if ((*t->justify_text)(this_label->pos)) {
  1484. X            (*t->put_text)(map_x(xtemp),map_y(ytemp),this_label->text);
  1485. X        }
  1486. X        else {
  1487. X            switch(this_label->pos) {
  1488. X                case  LEFT:
  1489. X                    (*t->put_text)(map_x(xtemp),map_y(ytemp),
  1490. X                        this_label->text);
  1491. X                    break;
  1492. X                case CENTRE:
  1493. X                    (*t->put_text)(map_x(xtemp)-
  1494. X                        (t->h_char)*strlen(this_label->text)/2,
  1495. X                        map_y(ytemp), this_label->text);
  1496. X                    break;
  1497. X                case RIGHT:
  1498. X                    (*t->put_text)(map_x(xtemp)-
  1499. X                        (t->h_char)*strlen(this_label->text),
  1500. X                        map_y(ytemp), this_label->text);
  1501. X                    break;
  1502. X            }
  1503. X         }
  1504. X     }
  1505. X
  1506. /* PLACE ARROWS */
  1507. X    (*t->linetype)(0);    /* arrow line type */
  1508. X    for (this_arrow = first_arrow; this_arrow!=NULL;
  1509. X        this_arrow = this_arrow->next ) {
  1510. X       int sx = map_x(LogScale(this_arrow->sx, log_x, "arrow", "x"));
  1511. X       int sy = map_y(LogScale(this_arrow->sy, log_y, "arrow", "y"));
  1512. X       int ex = map_x(LogScale(this_arrow->ex, log_x, "arrow", "x"));
  1513. X       int ey = map_y(LogScale(this_arrow->ey, log_y, "arrow", "y"));
  1514. X       
  1515. X       (*t->arrow)(sx, sy, ex, ey, this_arrow->head);
  1516. SHAR_EOF
  1517. true || echo 'restore of gnuplot/graphics.c failed'
  1518. fi
  1519. echo 'End of  part 25'
  1520. echo 'File gnuplot/graphics.c is continued in part 26'
  1521. echo 26 > _shar_seq_.tmp
  1522. exit 0
  1523.  
  1524. exit 0 # Just in case...
  1525. -- 
  1526. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1527. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1528. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1529. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1530.