home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume11 / gnuplot2 / part02 < prev    next >
Encoding:
Text File  |  1990-03-25  |  27.5 KB  |  1,186 lines

  1. Newsgroups: comp.sources.misc
  2. organization: Pixar -- Marin County, California
  3. subject: v11i067: Gnuplot 2.0 - 2 of 14
  4. From: thaw@ucbvax.Berkeley.EDU@pixar.UUCP (Tom Williams)
  5. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  6.  
  7. Posting-number: Volume 11, Issue 67
  8. Submitted-by: thaw@ucbvax.Berkeley.EDU@pixar.UUCP (Tom Williams)
  9. Archive-name: gnuplot2/part02
  10.  
  11. This is gnuplot.sh02
  12.  
  13. --- CUT HERE ---
  14. #! /bin/sh
  15. echo x - docs/Makefile
  16. sed 's/^X//' >docs/Makefile <<'*-*-END-of-docs/Makefile-*-*'
  17. X# Makefile for GNUPLOT documentation
  18. X#
  19. X# Note that the top-level file for documentation is gnuplot.doc.
  20. X# See README.
  21. X#
  22. X# To print manual:
  23. X#    make gnuplot.dvi             (for latex)
  24. X#    (print or view gnuplot.dvi)
  25. X# OR
  26. X#    make gnuplot.nroff           (for nroff)
  27. X#    (print or view gnuplot.nroff)
  28. X#   or
  29. X#    make "TROFF=itroff" troff    (for troff; use your troff for itroff here)
  30. X#
  31. X# $Id: Makefile,v 1.1 90/01/11 15:43:03 dfk Exp Locker: dfk $
  32. X
  33. X# usually overridden by ../Makefile
  34. XHELPDEST = /usr/local/lib/
  35. X
  36. X# substitute your troff command (and any flags) for this one
  37. XTROFF=itroff
  38. X
  39. X# Compiler flags
  40. X# -DSYSV if att sys V
  41. X# -DMSDOS if MSDOS PS
  42. X# no extra flags for BSD
  43. XCFLAGS = -s
  44. X
  45. X# default is what is needed for interactive gnuplot
  46. Xdefault: gnuplot.hlp gnuplot.gih
  47. X
  48. X### [tn]roff documentation
  49. Xtroff: gnuplot.ms titlepage.ms
  50. X    tbl gnuplot.ms | eqn | $(TROFF) -ms
  51. X
  52. X# for screen viewing, or printers with backspace/overstrike, remove the -Tlpr
  53. Xnroff gnuplot.nroff: gnuplot.ms titlepage.ms
  54. X    tbl gnuplot.ms | neqn | nroff -ms -Tlpr > gnuplot.nroff
  55. X
  56. Xms gnuplot.ms: doc2ms gnuplot.doc
  57. X    ./doc2ms < gnuplot.doc > gnuplot.ms
  58. X
  59. Xdoc2ms: doc2ms.c
  60. X    cc $(CFLAGS) -o doc2ms doc2ms.c
  61. X
  62. X### LaTeX documentation
  63. Xtex gnuplot.tex: doc2tex gnuplot.doc
  64. X    ./doc2tex < gnuplot.doc > gnuplot.tex
  65. X
  66. Xdvi gnuplot.dvi: gnuplot.tex titlepage.tex
  67. X    (latex gnuplot.tex ; latex gnuplot.tex)
  68. X
  69. Xdoc2tex: doc2tex.c
  70. X    cc $(CFLAGS) -o doc2tex doc2tex.c
  71. X
  72. X# this is how to make gnuplot.hlp
  73. Xhlp gnuplot.hlp: doc2hlp gnuplot.doc
  74. X    ./doc2hlp < gnuplot.doc > gnuplot.hlp
  75. X
  76. Xdoc2hlp: doc2hlp.c
  77. X    cc $(CFLAGS) -o doc2hlp doc2hlp.c
  78. X
  79. X# this is how to make gnuplot.gih
  80. Xgih gnuplot.gih: doc2gih gnuplot.doc
  81. X    ./doc2gih < gnuplot.doc > gnuplot.gih
  82. X
  83. Xdoc2gih: doc2gih.c
  84. X    cc $(CFLAGS) -o doc2gih doc2gih.c
  85. X
  86. X# this is how to check the gnuplot.doc file
  87. Xcheck: checkdoc gnuplot.doc
  88. X    ./checkdoc < gnuplot.doc
  89. X
  90. Xcheckdoc: checkdoc.c
  91. X    cc $(CFLAGS) -o checkdoc checkdoc.c
  92. X
  93. X# For Unix and MSDOS only
  94. Xinstall-unix: gnuplot.gih
  95. X    cp gnuplot.gih $(HELPDEST)
  96. X
  97. X# for VMS only
  98. Xinstall-vms: gnuplot.hlp
  99. X    cp gnuplot.hlp $(HELPDEST)
  100. X
  101. X# remove all derived files
  102. Xclean:
  103. X    rm -f doc2ms gnuplot.nroff gnuplot.ms
  104. X    rm -f doc2tex gnuplot.tex gnuplot.dvi gnuplot.aux gnuplot.log gnuplot.toc
  105. X    rm -f doc2hlp gnuplot.hlp
  106. X    rm -f doc2gih gnuplot.gih
  107. X    rm -f checkdoc *~ *.o core a.out
  108. *-*-END-of-docs/Makefile-*-*
  109. echo x - docs/README
  110. sed 's/^X//' >docs/README <<'*-*-END-of-docs/README-*-*'
  111. XNotes on the gnuplot help files and documentation.
  112. X
  113. XGnuplot documentation is available in three ways:
  114. X
  115. X1 - interactively, within gnuplot
  116. X2 - as a printed document. 
  117. X3 - as a manual page, through the Unix man(1) facility
  118. X
  119. XThe first two forms describe the inner workings, and contain
  120. Xequivalent information, while the third form tells how to run gnuplot.
  121. X
  122. XThe two first forms above derive their information from the file
  123. Xgnuplot.doc, which is the MASTER copy of gnuplot help information. All
  124. Xother forms, except for gnuplot.1, the man page, are derived from it. 
  125. X
  126. Xgnuplot.doc -> gnuplot.hlp 
  127. X            -> gnuplot.gih
  128. X            -> gnuplot.tex
  129. X            -> gnuplot.ms
  130. X                                      
  131. XOn VMS the interactive help is supplied by the system help facility,
  132. Xusing the gnuplot.hlp file. This is made with ('make hlp').  On Unix
  133. Xand MSDOS the interactive help is built in to the program, and uses
  134. Xthe gnuplot.gih file ('make gih').
  135. X
  136. XThe printed document is available in either latex or troff/nroff (ms)
  137. Xformat, using gnuplot.tex or gnuplot.ms, derived from gnuplot.doc with
  138. Xeither doc2tex or doc2ms. Type 'make dvi' or 'make nroff'. For troff,
  139. Xtype 'make ms' and then troff -ms gnuplot.ms in whatever way you use
  140. Xtroff.
  141. X
  142. XIf VMS users prefer the gnuplot interactive help facility to the
  143. Xsystem facility, this can be easily changed in command.c.
  144. X
  145. X
  146. XDescription of the gnuplot.doc format:
  147. X--------------------------------------
  148. X
  149. XHere is an example of the DOC master help format:
  150. X
  151. X?
  152. X1 gnuplot
  153. X GNUPLOT is a command-driven interactive function plotting program.  It
  154. X ...
  155. X?exit
  156. X2 exit
  157. X 'exit', 'quit' and ...
  158. X?expressions
  159. X2 expressions
  160. X In general, any mathematical expression accepted by C, ...
  161. X
  162. X Topics:
  163. X functions operators
  164. X?expressions functions
  165. X?functions
  166. X3 functions
  167. X The functions in GNUPLOT are ...
  168. X
  169. X Topics:
  170. X abs acos arg ...
  171. X?expressions functions abs
  172. X?functions abs
  173. X?abs
  174. X4 abs
  175. X This function returns the absolute value of its argument.  The
  176. X returned value is of the same type as the argument. 
  177. X?expressions functions acos
  178. X?functions acos
  179. X?acos
  180. X4 acos
  181. X This function returns the arc cosine (inverse cosine) of its
  182. X argument.  'acos' returns its argument in radians. 
  183. X
  184. X
  185. XSome notes about the format:
  186. X----------------------------
  187. XRemember that all text must be able to be processed by gnuplot, VMS,
  188. X nroff, troff, and latex, and always do something reasonable. 
  189. XThe first column is reserved for control characters.
  190. XText does not start in the first column.
  191. XLines that start in column 2 may be typeset by LaTeX.
  192. XLines that have a space in column 2 are to be printed in a verbatim
  193. X environment by LaTeX.
  194. XDo NOT use tabs in the help file.
  195. XConversion from this format to vax .hlp file involves removal of
  196. X lines starting with [?@#$%] (see doc2hlp). VMS uses the numbers
  197. X to represent a tree. 
  198. XConversion from this format to gnuplot .gih file involves removal of
  199. X lines starting with [0-9@#$%] (see doc2gih). Gnuplot matches your
  200. X help query against the ? lines to find the help information.
  201. X Multiple ? lines for one text block constitute synonyms. The most
  202. X specific should be first, eg 'expressions functions' before 'functions'.
  203. X Spaces are allowed here, but should be single.
  204. XBackquote pairs are converted by the doc2tex program into boldface;
  205. X that is, `some text` is converted to {\bf some text}. Be sure to pair
  206. X the backquotes, or the whole document will be boldface!
  207. X
  208. XControl characters in first column:
  209. X?    used by .gih format, for builtin interactive help - keyword
  210. X0-9  used by VMS help and by doc2{tex,ms} formatters to define level,keyword
  211. X@    used by doc2{tex,ms} to define table start/end
  212. X#    used by doc2tex: table entry
  213. X%    used by doc2ms: table entry
  214. *-*-END-of-docs/README-*-*
  215. echo x - docs/checkdoc.c
  216. sed 's/^X//' >docs/checkdoc.c <<'*-*-END-of-docs/checkdoc.c-*-*'
  217. X/*
  218. X * checkdoc -- check a doc file for correctness of first column. 
  219. X *
  220. X * Prints out lines that have an illegal first character.
  221. X * First character must be space, digit, or ?, @, #, %, 
  222. X * or line must be empty.
  223. X *
  224. X * usage: checkdoc < docfile
  225. X * Modified by Russell Lang from hlp2ms.c by Thomas Williams 
  226. X *
  227. X * Original version by David Kotz used the following one line script!
  228. X * sed -e '/^$/d' -e '/^[ 0-9?@#%]/d' gnuplot.doc
  229. X *
  230. X */
  231. X
  232. X#include <stdio.h>
  233. X#include <ctype.h>
  234. X
  235. X#define MAX_LINE_LEN    256
  236. X#define TRUE 1
  237. X#define FALSE 0
  238. X
  239. Xmain()
  240. X{
  241. X    convert(stdin,stdout);
  242. X    exit(0);
  243. X}
  244. X
  245. Xconvert(a,b)
  246. X    FILE *a,*b;
  247. X{
  248. X    static char line[MAX_LINE_LEN];
  249. X
  250. X    while (fgets(line,MAX_LINE_LEN,a)) {
  251. X       process_line(line, b);
  252. X    }
  253. X}
  254. X
  255. Xprocess_line(line, b)
  256. X    char *line;
  257. X    FILE *b;
  258. X{
  259. X    switch(line[0]) {        /* control character */
  260. X       case '?': {            /* interactive help entry */
  261. X          break;            /* ignore */
  262. X       }
  263. X       case '@': {            /* start/end table */
  264. X          break;            /* ignore */
  265. X       }
  266. X       case '#': {            /* latex table entry */
  267. X          break;            /* ignore */
  268. X       }
  269. X       case '%': {            /* troff table entry */
  270. X          break;            /* ignore */
  271. X       }
  272. X       case '\n':            /* empty text line */
  273. X       case ' ': {            /* normal text line */
  274. X          break;
  275. X       }
  276. X       default: {
  277. X          if (isdigit(line[0])) { /* start of section */
  278. X                  /* ignore */
  279. X          } else
  280. X            fputs(line,b);    /* output bad line */
  281. X          break;
  282. X       }
  283. X    }
  284. X}
  285. X
  286. *-*-END-of-docs/checkdoc.c-*-*
  287. echo x - docs/doc2gih.c
  288. sed 's/^X//' >docs/doc2gih.c <<'*-*-END-of-docs/doc2gih.c-*-*'
  289. X/*
  290. X * doc2gih.c  -- program to convert Gnuplot .DOC format to gnuplot
  291. X * interactive help (.GIH) format.
  292. X *
  293. X * This involves stripping all lines with a leading digit or
  294. X * a leading @, #, or %.
  295. X * Modified by Russell Lang from hlp2ms.c by Thomas Williams 
  296. X *
  297. X * usage:  doc2gih < file.doc > file.gih
  298. X *
  299. X * Original version by David Kotz used the following one line script!
  300. X * sed '/^[0-9@#%]/d' file.doc > file.gih
  301. X */
  302. X
  303. X#include <stdio.h>
  304. X#include <ctype.h>
  305. X
  306. X#define MAX_LINE_LEN    256
  307. X#define TRUE 1
  308. X#define FALSE 0
  309. X
  310. Xmain(argc,argv)
  311. Xint argc;
  312. Xchar **argv;
  313. X{
  314. XFILE * infile;
  315. XFILE * outfile;
  316. X    infile = stdin;
  317. X    outfile = stdout;
  318. X    if (argc > 3) {
  319. X        fprintf(stderr,"Usage: %s infile outfile\n", argv[0]);
  320. X        exit(1);
  321. X    }
  322. X    if (argc >= 2) 
  323. X        if ( (infile = fopen(argv[1],"r")) == (FILE *)NULL) {
  324. X            fprintf(stderr,"%s: Can't open %s for reading\n",
  325. X                argv[0], argv[1]);
  326. X            exit(1);
  327. X        }
  328. X    if (argc == 3)
  329. X        if ( (outfile = fopen(argv[2],"w")) == (FILE *)NULL) {
  330. X            fprintf(stderr,"%s: Can't open %s for writing\n",
  331. X                argv[0], argv[2]);
  332. X        }
  333. X    
  334. X    convert(infile,outfile);
  335. X    exit(0);
  336. X}
  337. X
  338. X
  339. Xconvert(a,b)
  340. X    FILE *a,*b;
  341. X{
  342. X    static char line[MAX_LINE_LEN];
  343. X
  344. X    while (fgets(line,MAX_LINE_LEN,a)) {
  345. X       process_line(line, b);
  346. X    }
  347. X}
  348. X
  349. Xprocess_line(line, b)
  350. X    char *line;
  351. X    FILE *b;
  352. X{
  353. X    switch(line[0]) {        /* control character */
  354. X       case '?': {            /* interactive help entry */
  355. X          (void) fputs(line,b); 
  356. X          break;        
  357. X       }
  358. X       case '@': {            /* start/end table */
  359. X          break;            /* ignore */
  360. X       }
  361. X       case '#': {            /* latex table entry */
  362. X          break;            /* ignore */
  363. X       }
  364. X       case '%': {            /* troff table entry */
  365. X          break;            /* ignore */
  366. X       }
  367. X       case '\n':            /* empty text line */
  368. X       case ' ': {            /* normal text line */
  369. X          (void) fputs(line,b); 
  370. X          break;
  371. X       }
  372. X       default: {
  373. X          if (isdigit(line[0])) { /* start of section */
  374. X                  /* ignore */
  375. X          } else
  376. X            fprintf(stderr, "unknown control code '%c' in column 1\n", 
  377. X                  line[0]);
  378. X          break;
  379. X       }
  380. X    }
  381. X}
  382. X
  383. *-*-END-of-docs/doc2gih.c-*-*
  384. echo x - docs/doc2hlp.c
  385. sed 's/^X//' >docs/doc2hlp.c <<'*-*-END-of-docs/doc2hlp.c-*-*'
  386. X/*
  387. X * doc2hlp.c  -- program to convert Gnuplot .DOC format to 
  388. X * VMS help (.HLP) format.
  389. X *
  390. X * This involves stripping all lines with a leading ?,
  391. X * @, #, or %.
  392. X * Modified by Russell Lang from hlp2ms.c by Thomas Williams 
  393. X *
  394. X * usage:  doc2hlp < file.doc > file.hlp
  395. X *
  396. X * Original version by David Kotz used the following one line script!
  397. X * sed '/^[?@#%]/d' file.doc > file.hlp
  398. X */
  399. X
  400. X#include <stdio.h>
  401. X#include <ctype.h>
  402. X
  403. X#define MAX_LINE_LEN    256
  404. X#define TRUE 1
  405. X#define FALSE 0
  406. X
  407. Xmain()
  408. X{
  409. X    convert(stdin,stdout);
  410. X    exit(0);
  411. X}
  412. X
  413. X
  414. Xconvert(a,b)
  415. X    FILE *a,*b;
  416. X{
  417. X    static char line[MAX_LINE_LEN];
  418. X
  419. X    while (fgets(line,MAX_LINE_LEN,a)) {
  420. X       process_line(line, b);
  421. X    }
  422. X}
  423. X
  424. Xprocess_line(line, b)
  425. X    char *line;
  426. X    FILE *b;
  427. X{
  428. X    switch(line[0]) {        /* control character */
  429. X       case '?': {            /* interactive help entry */
  430. X          break;            /* ignore */
  431. X       }
  432. X       case '@': {            /* start/end table */
  433. X          break;            /* ignore */
  434. X       }
  435. X       case '#': {            /* latex table entry */
  436. X          break;            /* ignore */
  437. X       }
  438. X       case '%': {            /* troff table entry */
  439. X          break;            /* ignore */
  440. X       }
  441. X       case '\n':            /* empty text line */
  442. X       case ' ': {            /* normal text line */
  443. X          (void) fputs(line,b); 
  444. X          break;
  445. X       }
  446. X       default: {
  447. X          if (isdigit(line[0])) { /* start of section */
  448. X            (void) fputs(line,b); 
  449. X          } else
  450. X            fprintf(stderr, "unknown control code '%c' in column 1\n", 
  451. X                  line[0]);
  452. X          break;
  453. X       }
  454. X    }
  455. X}
  456. *-*-END-of-docs/doc2hlp.c-*-*
  457. echo x - docs/doc2hlp.com
  458. sed 's/^X//' >docs/doc2hlp.com <<'*-*-END-of-docs/doc2hlp.com-*-*'
  459. X$ def/user sys$input [.docs]gnuplot.doc
  460. X$ def/user sys$output []gnuplot.hlp
  461. X$ run doc2hlp
  462. *-*-END-of-docs/doc2hlp.com-*-*
  463. echo x - docs/doc2ms.c
  464. sed 's/^X//' >docs/doc2ms.c <<'*-*-END-of-docs/doc2ms.c-*-*'
  465. X/*
  466. X * doc2ms.c  -- program to convert Gnuplot .DOC format to *roff -ms document
  467. X * From hlp2ms by Thomas Williams 
  468. X *
  469. X * Modified by Russell Lang, 2nd October 1989
  470. X * to make vms help level 1 and 2 create the same ms section level.
  471. X *
  472. X * Modified to become doc2ms by David Kotz dfk@cs.duke.edu 12/89
  473. X * Added table and backquote support.
  474. X *
  475. X * usage:  doc2ms < file.doc > file.ms
  476. X *
  477. X *   where file.doc is a VMS .DOC file, and file.ms will be a [nt]roff
  478. X *     document suitable for printing with nroff -ms or troff -ms
  479. X *
  480. X * typical usage for GNUPLOT:
  481. X *
  482. X *   doc2ms < gnuplot.doc | troff -ms
  483. X */
  484. X
  485. Xstatic char rcsid[] = "$Id: doc2ms.c,v 1.1 90/01/11 15:43:54 dfk Exp Locker: dfk $";
  486. X
  487. X#include <stdio.h>
  488. X#include <ctype.h>
  489. X
  490. X#define MAX_NAME_LEN    256
  491. X#define MAX_LINE_LEN    256
  492. X#define LINE_SKIP        3
  493. X
  494. X#define TRUE 1
  495. X#define FALSE 0
  496. X
  497. Xtypedef int boolean;
  498. X
  499. Xstatic boolean intable = FALSE;
  500. X
  501. Xmain()
  502. X{
  503. X    init(stdout);
  504. X    convert(stdin,stdout);
  505. X    finish(stdout);
  506. X    exit(0);
  507. X}
  508. X
  509. X
  510. Xinit(b)
  511. XFILE *b;
  512. X{
  513. X    /* in nroff, increase line length by 8 and don't adjust lines */
  514. X    (void) fputs(".if n \\{.nr LL +8m\n.na \\}\n",b);
  515. X    (void) fputs(".nr PO +0.3i\n",b);
  516. X    (void) fputs(".so titlepage.ms\n",b);
  517. X    (void) fputs(".pn 1\n",b);
  518. X    (void) fputs(".ds CH GNUPLOT\n",b);
  519. X    (void) fputs(".ds RH Page %\n",b);
  520. X    (void) fputs(".bp\n",b);
  521. X    (void) fputs(".nr PS 12\n",b);
  522. X    (void) fputs(".nr VS 13\n",b);
  523. X    (void) fputs(".ta 1.5i 3.0i 4.5i 6.0i 7.5i\n",b);
  524. X    (void) fputs("\\&\n.sp 3\n.PP\n",b);
  525. X    /* following line commented out by rjl
  526. X      (void) fputs(".so intro\n",b);
  527. X      */
  528. X}
  529. X
  530. X
  531. Xconvert(a,b)
  532. X    FILE *a,*b;
  533. X{
  534. X    static char line[MAX_LINE_LEN];
  535. X
  536. X    while (fgets(line,MAX_LINE_LEN,a)) {
  537. X       process_line(line, b);
  538. X    }
  539. X}
  540. X
  541. Xprocess_line(line, b)
  542. X    char *line;
  543. X    FILE *b;
  544. X{
  545. X    switch(line[0]) {        /* control character */
  546. X       case '?': {            /* interactive help entry */
  547. X          break;            /* ignore */
  548. X       }
  549. X       case '@': {            /* start/end table */
  550. X          if (intable) {
  551. X             (void) fputs(".TE\n", b);
  552. X             (void) fputs(".EQ\ndelim off\n.EN\n\n",b);
  553. X             intable = FALSE;
  554. X          } else {
  555. X             (void) fputs("\n.EQ\ndelim $$\n.EN\n",b);
  556. X             (void) fputs(".TS\ncenter box tab (@) ;\n", b);
  557. X             (void) fputs("c c l .\n", b);
  558. X             intable = TRUE;
  559. X          }
  560. X          /* ignore rest of line */
  561. X          break;
  562. X       }
  563. X       case '#': {            /* latex table entry */
  564. X          break;            /* ignore */
  565. X       }
  566. X       case '%': {            /* troff table entry */
  567. X          if (intable)
  568. X            (void) fputs(line+1, b); /* copy directly */
  569. X          else
  570. X            fprintf(stderr, "error: % line found outside of table\n");
  571. X          break;
  572. X       }
  573. X       case '\n':            /* empty text line */
  574. X       case ' ': {            /* normal text line */
  575. X          if (intable)
  576. X            break;        /* ignore while in table */
  577. X          switch(line[1]) {
  578. X             case ' ': {
  579. X                /* verbatim mode */
  580. X                fputs(".br\n",b); 
  581. X                fputs(line+1,b); 
  582. X                fputs(".br\n",b);
  583. X                break;
  584. X             }
  585. X             case '\'': {
  586. X                fputs("\\&",b);
  587. X                putms(line+1,b); 
  588. X                break;
  589. X             }
  590. X             default: {
  591. X                putms(line+1,b); 
  592. X                break;
  593. X             }
  594. X             break;
  595. X          }
  596. X          break;
  597. X       }
  598. X       default: {
  599. X          if (isdigit(line[0])) { /* start of section */
  600. X             if (!intable)    /* ignore while in table */
  601. X               section(line, b);
  602. X          } else
  603. X            fprintf(stderr, "unknown control code '%c' in column 1\n", 
  604. X                  line[0]);
  605. X          break;
  606. X       }
  607. X    }
  608. X}
  609. X
  610. X
  611. X/* process a line with a digit control char */
  612. X/* starts a new [sub]section */
  613. X
  614. Xsection(line, b)
  615. X    char *line;
  616. X    FILE *b;
  617. X{
  618. X    static char string[MAX_LINE_LEN];
  619. X    int sh_i;
  620. X    static int old = 1;
  621. X
  622. X    (void) sscanf(line,"%d %[^\n]s",&sh_i,string);
  623. X    
  624. X    (void) fprintf(b,".sp %d\n",(sh_i == 1) ? LINE_SKIP : LINE_SKIP-1);
  625. X    
  626. X    if (sh_i > old) {
  627. X       do
  628. X        if (old!=1)    /* this line added by rjl */
  629. X          (void) fputs(".RS\n.IP\n",b);
  630. X       while (++old < sh_i);
  631. X    }
  632. X    else if (sh_i < old) {
  633. X       do
  634. X               if (sh_i!=1) /* this line added by rjl */
  635. X                (void) fputs(".RE\n.br\n",b);
  636. X       while (--old > sh_i);
  637. X    }
  638. X    
  639. X    /* added by dfk to capitalize section headers */
  640. X    if (islower(string[0]))
  641. X     string[0] = toupper(string[0]);
  642. X    
  643. X    /* next 3 lines added by rjl */
  644. X    if (sh_i!=1) 
  645. X     (void) fprintf(b,".NH %d\n%s\n.sp 1\n.LP\n",sh_i-1,string);
  646. X    else 
  647. X     (void) fprintf(b,".NH %d\n%s\n.sp 1\n.LP\n",sh_i,string);
  648. X    old = sh_i;
  649. X    
  650. X    (void) fputs(".XS\n",b);
  651. X    (void) fputs(string,b);
  652. X    (void) fputs("\n.XE\n",b);
  653. X}
  654. X
  655. Xputms(s, file)
  656. X    char *s;
  657. X    FILE *file;
  658. X{
  659. X    static boolean inquote = FALSE;
  660. X
  661. X    while (*s != '\0') {
  662. X       switch (*s) {
  663. X          case '`': {        /* backquote -> boldface */
  664. X             if (inquote) {
  665. X                fputs("\\fR", file);
  666. X                inquote = FALSE;
  667. X             } else {
  668. X                fputs("\\fB", file);
  669. X                inquote = TRUE;
  670. X             }
  671. X             break;
  672. X          }
  673. X          case '\\': {        /* backslash */
  674. X             fputs("\\\\", file);
  675. X             break;
  676. X          }
  677. X          default: {
  678. X             fputc(*s, file);
  679. X             break;
  680. X          }
  681. X       }
  682. X       s++;
  683. X    }
  684. X}
  685. X
  686. Xfinish(b)        /* spit out table of contents */
  687. XFILE *b;
  688. X{
  689. X    (void) fputs(".pn 1\n",b);
  690. X    (void) fputs(".ds RH %\n",b);
  691. X    (void) fputs(".af % i\n",b);
  692. X    (void) fputs(".bp\n.PX\n",b);
  693. X}
  694. *-*-END-of-docs/doc2ms.c-*-*
  695. echo x - docs/doc2tex.c
  696. sed 's/^X//' >docs/doc2tex.c <<'*-*-END-of-docs/doc2tex.c-*-*'
  697. X/*
  698. X * doc2tex.c  -- program to convert Gnuplot .DOC format to LaTeX document
  699. X * Also will work for VMS .HLP files. 
  700. X * Modified by Russell Lang from hlp2ms.c by Thomas Williams 
  701. X * Extended by David Kotz to support quotes ("), backquotes, tables.
  702. X *
  703. X * usage:  doc2tex < file.doc > file.tex
  704. X *
  705. X *   where file.doc is a Gnuplot .DOC file, and file.tex will be an
  706. X *     article document suitable for printing with LaTeX.
  707. X *
  708. X * typical usage for GNUPLOT:
  709. X *
  710. X *   doc2tex < gnuplot.doc > gnuplot.tex 
  711. X *   latex gnuplot.tex ; latex gnuplot.tex
  712. X */
  713. X
  714. Xstatic char rcsid[] = "$Id: doc2tex.c,v 1.1 90/01/11 15:44:06 dfk Exp Locker: dfk $";
  715. X
  716. X#include <stdio.h>
  717. X#include <ctype.h>
  718. X#include <strings.h>
  719. X
  720. X#define MAX_NAME_LEN    256
  721. X#define MAX_LINE_LEN    256
  722. X#define TRUE 1
  723. X#define FALSE 0
  724. X
  725. Xtypedef int boolean;
  726. X
  727. Xboolean intable = FALSE;
  728. Xboolean verb = FALSE;
  729. X
  730. Xmain()
  731. X{
  732. X    init(stdout);
  733. X    convert(stdin,stdout);
  734. X    finish(stdout);
  735. X    exit(0);
  736. X}
  737. X
  738. X
  739. Xinit(b)
  740. XFILE *b;
  741. X{
  742. X    (void) fputs("\\input{titlepage.tex}\n",b);
  743. X}
  744. X
  745. X
  746. Xconvert(a,b)
  747. X    FILE *a,*b;
  748. X{
  749. X    static char line[MAX_LINE_LEN];
  750. X
  751. X    while (fgets(line,MAX_LINE_LEN,a)) {
  752. X       process_line(line, b);
  753. X    }
  754. X}
  755. X
  756. Xprocess_line(line, b)
  757. X    char *line;
  758. X    FILE *b;
  759. X{
  760. X    switch(line[0]) {        /* control character */
  761. X       case '?': {            /* interactive help entry */
  762. X          break;            /* ignore */
  763. X       }
  764. X       case '@': {            /* start/end table */
  765. X          if (intable) {
  766. X             (void) fputs("\\hline\n\\end{tabular}\n", b);
  767. X             (void) fputs("\\end{center}\n",b);
  768. X             intable = FALSE;
  769. X          } else {
  770. X             if (verb) {
  771. X                (void) fputs("\\end{verbatim}\n",b);
  772. X                verb=FALSE;
  773. X             } 
  774. X             (void) fputs("\n\\begin{center}\n", b);
  775. X             (void) fputs("\\begin{tabular}{|ccl|} \\hline\n", b);
  776. X             intable = TRUE;
  777. X          }
  778. X          /* ignore rest of line */
  779. X          break;
  780. X       }
  781. X       case '#': {            /* latex table entry */
  782. X          if (intable)
  783. X            (void) fputs(line+1, b); /* copy directly */
  784. X          else
  785. X            fprintf(stderr, "error: # line found outside of table\n");
  786. X          break;
  787. X       }
  788. X       case '%': {            /* troff table entry */
  789. X          break;            /* ignore */
  790. X       }
  791. X       case '\n':            /* empty text line */
  792. X       case ' ': {            /* normal text line */
  793. X          if (intable)
  794. X            break;        /* ignore while in table */
  795. X          if (line[1] == ' ') {
  796. X             /* verbatim mode */
  797. X             if (!verb) {
  798. X                (void) fputs("\\begin{verbatim}\n",b);
  799. X                verb=TRUE;
  800. X             }
  801. X             (void) fputs(line+1,b); 
  802. X          } else {
  803. X             if (verb) {
  804. X                (void) fputs("\\end{verbatim}\n",b);
  805. X                verb=FALSE;
  806. X             } 
  807. X             puttex(line+1,b);
  808. X          }
  809. X          break;
  810. X       }
  811. X       default: {
  812. X          if (isdigit(line[0])) { /* start of section */
  813. X             if (!intable)    /* ignore while in table */
  814. X               section(line, b);
  815. X          } else
  816. X            fprintf(stderr, "unknown control code '%c' in column 1\n", 
  817. X                  line[0]);
  818. X          break;
  819. X       }
  820. X    }
  821. X}
  822. X
  823. X/* process a line with a digit control char */
  824. X/* starts a new [sub]section */
  825. X
  826. Xsection(line, b)
  827. X    char *line;
  828. X    FILE *b;
  829. X{
  830. X    static char string[MAX_LINE_LEN];
  831. X    int sh_i;
  832. X
  833. X    if (verb) {
  834. X       (void) fputs("\\end{verbatim}\n",b);
  835. X       verb=FALSE;
  836. X    } 
  837. X    (void) sscanf(line,"%d %[^\n]s",&sh_i,string);
  838. X    switch(sh_i)
  839. X     {
  840. X        case 1: 
  841. X        (void) fprintf(b,"\\section{");
  842. X        break;
  843. X        case 2: 
  844. X        (void) fprintf(b,"\\section{");
  845. X        break;
  846. X        case 3:
  847. X        (void) fprintf(b,"\\subsection{");
  848. X        break;
  849. X        case 4: 
  850. X        (void) fprintf(b,"\\subsubsection{");
  851. X        break;
  852. X        default:
  853. X        case 5: 
  854. X        (void) fprintf(b,"\\paragraph{");
  855. X        break;
  856. X     }
  857. X    if (islower(string[0]))
  858. X     string[0] = toupper(string[0]);
  859. X    puttex(string,b);
  860. X    (void) fprintf(b,"}\n");
  861. X}
  862. X
  863. X/* put text in string str to file while buffering special TeX characters */
  864. Xputtex(str,file)
  865. XFILE *file;
  866. Xregister char *str;
  867. X{
  868. Xregister char ch;
  869. Xstatic boolean inquote = FALSE;
  870. X
  871. X     while( (ch = *str++) != '\0') {
  872. X         switch(ch) {
  873. X             case '#':
  874. X             case '$':
  875. X             case '%':
  876. X             case '&':
  877. X             case '_':
  878. X             case '{':
  879. X             case '}':
  880. X                 (void) fputc('\\',file);
  881. X                 (void) fputc(ch,file);
  882. X                 break;
  883. X             case '\\':
  884. X                 (void) fputs("$\\backslash$",file);
  885. X                 break;
  886. X             case '~':
  887. X                 (void) fputs("\\~{\\ }",file);
  888. X                 break;
  889. X             case '^':
  890. X                 (void) fputs("\\verb+^+",file);
  891. X                 break;
  892. X             case '>':
  893. X             case '<':
  894. X             case '|':
  895. X                 (void) fputc('$',file);
  896. X                 (void) fputc(ch,file);
  897. X                 (void) fputc('$',file);
  898. X                 break;
  899. X             case '"': 
  900. X                 /* peek at next character: if space, end of quote */
  901. X                 if (*str == NULL || isspace(*str) || ispunct(*str))
  902. X                   (void) fputs("''", file);
  903. X                 else
  904. X                   (void) fputs("``", file);
  905. X                 break;
  906. X             case '`':    /* backquotes mean boldface */
  907. X                 if (inquote) {
  908. X                    fputs("}", file);
  909. X                    inquote = FALSE;
  910. X                 } else {
  911. X                    fputs("{\\bf ", file);
  912. X                    inquote = TRUE;
  913. X                 }
  914. X                 break;
  915. X             default:
  916. X                 (void) fputc(ch,file);
  917. X                 break;
  918. X         }
  919. X     }
  920. X}
  921. X
  922. X
  923. Xfinish(b)
  924. XFILE *b;
  925. X{
  926. X    (void) fputs("\\end{document}\n",b);
  927. X}
  928. *-*-END-of-docs/doc2tex.c-*-*
  929. echo x - docs/gnuplot.1
  930. sed 's/^X//' >docs/gnuplot.1 <<'*-*-END-of-docs/gnuplot.1-*-*'
  931. X.\" dummy line
  932. X.TH GNUPLOT 1 "13 February 1990"
  933. X.UC 4
  934. X.SH NAME
  935. Xgnuplot \- an interactive plotting program
  936. X.SH SYNOPSIS
  937. X.B gnuplot  file ...
  938. X.br
  939. X.SH DESCRIPTION
  940. X.I Gnuplot 
  941. Xis a command-driven interactive function plotting program.
  942. X.PP
  943. XIf files are given, 
  944. X.I gnuplot 
  945. Xloads each file with the 
  946. X.I load
  947. Xcommand, in the order specified.
  948. X.I Gnuplot 
  949. Xexits after the last file is processed.
  950. X.PP
  951. XHere are some of its features:
  952. X.PP
  953. XPlots any number of functions, built up of C operators, C library
  954. Xfunctions, and some things C doesn't have like **, sgn(), etc.  Also
  955. Xsupport for plotting data files, to compare actual
  956. Xdata to theoretical curves.
  957. X.PP
  958. XUser-defined X and Y ranges (optional auto-ranging), smart axes scaling,
  959. Xsmart tic marks.
  960. X.PP
  961. XLabelling of X and Y axes.
  962. X.PP
  963. XUser-defined constants and functions.
  964. X.PP
  965. XSupport through a generalized graphics driver for
  966. XAED 512,
  967. XAED 767,
  968. XBBN BitGraph,
  969. XRoland DXY800A,
  970. XEEPIC,
  971. XEpson LX-800,
  972. XFig, 
  973. XHP2623,
  974. XHP2648,
  975. XHP75xx,
  976. XHPGL,
  977. XIBM Proprinter,
  978. XImagen,
  979. XIris 4D,
  980. XKermit-MS,
  981. XLaTeX,
  982. XNEC CP6 pinwriter,
  983. XPostScript,
  984. XQMS QUIC,
  985. XReGis (VT125 and VT2xx),
  986. XSelanar,
  987. XTek 401x,
  988. XVectrix 384,
  989. Xand unixplot.  
  990. XThe PC version compiled by Microsoft C
  991. Xsupports IBM CGA, EGA, VGA, Hercules, ATT 6300,
  992. Xand Corona 325 graphics.  
  993. XThe PC version compiled by Turbo C
  994. Xsupports IBM CGA, EGA, MCGA, VGA and Hercules graphics.  
  995. XOther devices can be added simply, but will require recompiling.
  996. X.PP
  997. XShell escapes and command line substitution.
  998. X.PP
  999. XLoad and save capability.
  1000. X.PP
  1001. XOutput redirection.
  1002. X.PP
  1003. XAll computations performed in the complex domain.  Just the real part is
  1004. Xplotted by default, but functions like imag() and abs() and arg() are
  1005. Xavailable to override this.
  1006. X.SH AUTHORS
  1007. XThomas Williams, Pixar Corporation, 
  1008. X.br
  1009. X(pixar!info-gnuplot@sun.com)
  1010. X.br
  1011. Xand Colin Kelley.
  1012. X.PP
  1013. XAdditions for labelling by Russell Lang, Monash University, Australia.
  1014. X.br
  1015. X(rjl@monu1.cc.monash.edu.au)
  1016. X.br
  1017. XFurther additions by David Kotz, Duke University, North Carolina, USA. 
  1018. X.br
  1019. X(dfk@cs.duke.edu)
  1020. X.SH BUGS
  1021. XThe atan() function does not work correctly for complex arguments.
  1022. X.br
  1023. XSee the 
  1024. X.I help bugs
  1025. Xcommand in gnuplot.
  1026. X.SH SEE ALSO
  1027. XSee the printed manual or the on-line help for details on specific commands.
  1028. *-*-END-of-docs/gnuplot.1-*-*
  1029. echo x - docs/lasergnu.1
  1030. sed 's/^X//' >docs/lasergnu.1 <<'*-*-END-of-docs/lasergnu.1-*-*'
  1031. X.TH LASERGNU l 
  1032. X.SH NAME
  1033. Xlasergnu \- send gnuplot output to a printer
  1034. X.SH SYNOPSIS
  1035. X.B lasergnu
  1036. X[ flags ] plot-command...
  1037. X.SH DESCRIPTION
  1038. X.I lasergnu
  1039. Xruns
  1040. X.IR gnuplot (1)
  1041. Xin an environment to produce typeset output on an IMAGEN  or
  1042. XPostscript printer.
  1043. X.PP
  1044. XThe 
  1045. X.B gnuplot
  1046. Xcommands
  1047. X.B plot-command
  1048. Xare performed and the output sent to the printer. 
  1049. XIf the 
  1050. X.B -f
  1051. Xoption specifies a file for input, the plot command is optional. 
  1052. XThe command-line plot commands are executed prior to any in the
  1053. Xfile(s).
  1054. X.PP
  1055. XFor example, to plot the function
  1056. X.I sin(x)
  1057. Xfrom -1 to +1, and to use printer im1, use the command
  1058. X.br
  1059. X.nf
  1060. X    lasergnu -Pim1 'plot [-1:1] sin(x) with lines'
  1061. X.fi
  1062. XTo execute the gnuplot command file
  1063. X.I myplot,
  1064. Xon the postscript printer lw0, use the command
  1065. X.br
  1066. X.nf
  1067. X    lasergnu -Plw0 -p -f myplot
  1068. X.fi
  1069. XThe following switches are recognized:
  1070. X.TP
  1071. X.BI \-p
  1072. XUse the postscript language to make the plot, instead of Impress.
  1073. XThis is for use on Postscript printers only.
  1074. X.TP
  1075. X.BI \-P\0 printer
  1076. XThe output of this program is intended for 
  1077. X.I printer.
  1078. X\ If the file is being spooled, this determines the printer it is spooled
  1079. Xto (default: $LASER).
  1080. XBe sure to use the -p flag if the printer is a postscript printer.
  1081. X.TP
  1082. X.BI \-f\0 file
  1083. XTake gnuplot commands from the named file.
  1084. XMultiple files  may be supplied with separate -f options.
  1085. X.TP
  1086. X.BI  \-t\0 title
  1087. XSpecify the title of the plot.
  1088. X.TP
  1089. X.BI \-b
  1090. XDo not print a banner page.
  1091. X.TP
  1092. X.BI \-J
  1093. XDo not print a banner page.
  1094. X.TP
  1095. X.B \-help
  1096. XPrints a list of options.
  1097. X.SH SEE ALSO
  1098. Xgnuplot(l), lpr(1)
  1099. *-*-END-of-docs/lasergnu.1-*-*
  1100. echo x - docs/titlepage.ms
  1101. sed 's/^X//' >docs/titlepage.ms <<'*-*-END-of-docs/titlepage.ms-*-*'
  1102. X.nr HM 3.2i
  1103. X.TL
  1104. XGNUPLOT
  1105. X.br
  1106. XAn Interactive Plotting Program
  1107. X.sp
  1108. X.AU
  1109. XThomas Williams & Colin Kelley
  1110. X.br
  1111. XDavid Kotz & Russell Lang (Version 1.2)
  1112. X.AI
  1113. Xpixar!info-gnuplot@sun.com
  1114. X\*(DY
  1115. X.br
  1116. X
  1117. X
  1118. X
  1119. X
  1120. X
  1121. X
  1122. X
  1123. X
  1124. X
  1125. X
  1126. X
  1127. X
  1128. X
  1129. X
  1130. X
  1131. X
  1132. X
  1133. X
  1134. X
  1135. X
  1136. X
  1137. XThis manual is for GNUPLOT version 1.2.
  1138. X.AB no
  1139. X.AE
  1140. X.LP
  1141. X.nr HM 1.2i
  1142. *-*-END-of-docs/titlepage.ms-*-*
  1143. echo x - docs/titlepage.tex
  1144. sed 's/^X//' >docs/titlepage.tex <<'*-*-END-of-docs/titlepage.tex-*-*'
  1145. X\documentstyle{article}
  1146. X\setlength{\textwidth}{6.25in}
  1147. X\setlength{\oddsidemargin}{0.5cm}
  1148. X\setlength{\topmargin}{-0.5in}
  1149. X\setlength{\textheight}{9in}
  1150. X\setlength{\parskip}{1ex}
  1151. X\setlength{\parindent}{0pt}
  1152. X\begin{document}
  1153. X
  1154. X\pagestyle{empty}
  1155. X   \rule{0in}{3in}
  1156. X   \begin{center}
  1157. X   {\huge\bf GNUPLOT}\\
  1158. X   \vspace{3ex}
  1159. X   {\Large An Interactive Plotting Program}\\
  1160. X   \vspace{2ex}
  1161. X   \large
  1162. X   Thomas Williams \& Colin Kelley\\
  1163. X   \vspace{2ex}
  1164. X   Version 1.2: \\
  1165. X   David Kotz \& Russell Lang\\
  1166. X   \vspace{2ex}
  1167. X   \verb+pixar!info-gnuplot@sun.com+
  1168. X
  1169. X   \vfill
  1170. X   {\small This manual is for GNUPLOT version 1.2.}
  1171. X
  1172. X   \end{center}
  1173. X\newpage
  1174. X
  1175. X\tableofcontents
  1176. X\newpage
  1177. X
  1178. X\setcounter{page}{1}
  1179. X\pagestyle{myheadings}
  1180. X\markboth{GNUPLOT 1.2}{GNUPLOT 1.2}
  1181. X
  1182. *-*-END-of-docs/titlepage.tex-*-*
  1183. exit
  1184.  
  1185.  
  1186.