home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / gnuplot / part22 < prev    next >
Encoding:
Text File  |  1993-10-22  |  80.4 KB  |  3,363 lines

  1. Newsgroups: comp.sources.misc
  2. From: woo@playfair.stanford.edu ("Alexander Woo")
  3. Subject: v40i034:  gnuplot - interactive function plotting utility, Part22/33
  4. Message-ID: <1993Oct22.163817.24586@sparky.sterling.com>
  5. X-Md4-Signature: fee931668b85cf77b0e11163acfe85f4
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Fri, 22 Oct 1993 16:38:17 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: woo@playfair.stanford.edu ("Alexander Woo")
  12. Posting-number: Volume 40, Issue 34
  13. Archive-name: gnuplot/part22
  14. Environment: UNIX, MS-DOS, VMS
  15. Supersedes: gnuplot3: Volume 24, Issue 23-48
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  gnuplot/parse.c gnuplot/plot.c gnuplot/term/aed.trm
  22. #   gnuplot/term/gpr.trm gnuplot/term/next.trm gnuplot/util.c
  23. #   gnuplot/win/wgnuplot.mnu
  24. # Wrapped by kent@sparky on Wed Oct 20 17:14:55 1993
  25. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  26. echo If this archive is complete, you will see the following message:
  27. echo '          "shar: End of archive 22 (of 33)."'
  28. if test -f 'gnuplot/parse.c' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'gnuplot/parse.c'\"
  30. else
  31.   echo shar: Extracting \"'gnuplot/parse.c'\" \(11722 characters\)
  32.   sed "s/^X//" >'gnuplot/parse.c' <<'END_OF_FILE'
  33. X#ifndef lint
  34. Xstatic char    *RCSid = "$Id: parse.c%v 3.50.1.8 1993/07/27 05:37:15 woo Exp $";
  35. X#endif
  36. X
  37. X
  38. X/* GNUPLOT - parse.c */
  39. X/*
  40. X * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley 
  41. X *
  42. X * Permission to use, copy, and distribute this software and its documentation
  43. X * for any purpose with or without fee is hereby granted, provided that the
  44. X * above copyright notice appear in all copies and that both that copyright
  45. X * notice and this permission notice appear in supporting documentation. 
  46. X *
  47. X * Permission to modify the software is granted, but not the right to distribute
  48. X * the modified code.  Modifications are to be distributed as patches to
  49. X * released version. 
  50. X *
  51. X * This software is provided "as is" without express or implied warranty. 
  52. X *
  53. X *
  54. X * AUTHORS 
  55. X *
  56. X * Original Software: Thomas Williams,  Colin Kelley. 
  57. X *
  58. X * Gnuplot 2.0 additions: Russell Lang, Dave Kotz, John Campbell. 
  59. X *
  60. X * Gnuplot 3.0 additions: Gershon Elber and many others. 
  61. X *
  62. X */
  63. X
  64. X#include <stdio.h>
  65. X#include <setjmp.h>
  66. X#include <signal.h>
  67. X#include <errno.h>
  68. X#include <math.h>
  69. X#include "plot.h"
  70. X
  71. X#ifndef vms
  72. X#if !defined(__ZTC__) && !defined(__MSC__)
  73. Xextern int      errno;
  74. X#endif
  75. X#endif
  76. X
  77. Xextern int      num_tokens, c_token;
  78. Xextern struct lexical_unit token[];
  79. Xextern char     c_dummy_var[MAX_NUM_VAR][MAX_ID_LEN + 1];    /* name of current dummy
  80. X                                 * vars */
  81. Xextern struct udft_entry *dummy_func;    /* pointer to dummy variable's func */
  82. X
  83. Xstruct value   *
  84. Xpop(), *Ginteger(), *Gcomplex();
  85. Xstruct at_type *
  86. Xtemp_at(), *perm_at();
  87. Xstruct udft_entry *add_udf();
  88. Xstruct udvt_entry *add_udv();
  89. Xunion argument *add_action();
  90. X
  91. Xstruct at_type  at;
  92. X#ifdef _Windows
  93. Xstatic jmp_buf far fpe_env;
  94. X#else
  95. Xstatic jmp_buf  fpe_env;
  96. X#endif
  97. X
  98. X#define dummy (struct value *) 0
  99. X
  100. X#if defined(__TURBOC__) || defined(DJGPP) || defined(SOLARIS)
  101. Xvoid
  102. Xfpe()
  103. X#else
  104. X#if defined( __ZTC__ ) || defined( _CRAY ) || defined( sgi )|| defined( OS2 ) || defined(__EMX__) || defined( __alpha)
  105. Xvoid
  106. Xfpe(an_int)
  107. X    int             an_int;
  108. X#else
  109. X#if defined( NEXT ) || defined( VMS)
  110. Xvoid
  111. Xfpe(int an_int)
  112. X#else
  113. X#ifdef sgi
  114. Xvoid
  115. Xfpe(int sig, int code, struct sigcontext * sc)
  116. X/*
  117. X * void fpe(an_int) int an_int; 
  118. X */
  119. X#else
  120. Xfpe()
  121. X#endif
  122. X#endif
  123. X#endif                /* __ZTC__ || _CRAY */
  124. X#endif                /* __TURBOC__ */
  125. X{
  126. X#if defined(MSDOS) && !defined(__EMX__) && !defined(DJGPP) && !defined(_Windows) || defined(DOS386)
  127. X    /* thanks to lotto@wjh12.UUCP for telling us about this  */
  128. X    _fpreset();
  129. X#endif
  130. X#if defined(MSDOS) && defined(__EMX__)
  131. X    (void)signal(SIGFPE, (void *)fpe);
  132. X#else
  133. X#ifdef DJGPP
  134. X    (void)signal(SIGFPE, (SignalHandler)fpe);
  135. X#else
  136. X#ifdef OS2
  137. X    (void) signal(an_int, SIG_ACK);
  138. X#else
  139. X    (void)signal(SIGFPE, fpe);
  140. X#endif
  141. X#endif
  142. X#endif
  143. X#ifdef ATARI
  144. X    /* do we need this ? (AL) */
  145. X    fprintf(stderr, "floating point exception!\n");
  146. X#endif
  147. X    undefined = TRUE;
  148. X    longjmp(fpe_env, TRUE);
  149. X}
  150. X
  151. X
  152. X#ifdef apollo
  153. X#include <apollo/base.h>
  154. X#include <apollo/pfm.h>
  155. X#include <apollo/fault.h>
  156. X
  157. X/*
  158. X * On an Apollo, the OS can signal a couple errors that are not mapped into
  159. X * SIGFPE, namely signalling NaN and branch on an unordered comparison.  I
  160. X * suppose there are others, but none of these are documented, so I handle
  161. X * them as they arise. 
  162. X *
  163. X * Anyway, we need to catch these faults and signal SIGFPE. 
  164. X */
  165. X
  166. Xpfm_$fh_func_val_t apollo_sigfpe(pfm_$fault_rec_t & fault_rec)
  167. X{
  168. X    kill(getpid(), SIGFPE);
  169. X    return pfm_$continue_fault_handling;
  170. X}
  171. X
  172. Xapollo_pfm_catch()
  173. X{
  174. X    status_$t status;
  175. X    pfm_$establish_fault_handler(fault_$fp_bsun, pfm_$fh_backstop,
  176. X                       apollo_sigfpe, &status);
  177. X    pfm_$establish_fault_handler(fault_$fp_sig_nan, pfm_$fh_backstop,
  178. X                       apollo_sigfpe, &status);
  179. X}
  180. X#endif
  181. X
  182. X
  183. Xevaluate_at(at_ptr, val_ptr)
  184. X    struct at_type *at_ptr;
  185. X    struct value   *val_ptr;
  186. X{
  187. X    double          temp, real();
  188. X
  189. X    undefined = FALSE;
  190. X    errno = 0;
  191. X    reset_stack();
  192. X
  193. X#ifndef DOSX286
  194. X    if (setjmp(fpe_env))
  195. X        return(0);        /* just bail out */
  196. X#if defined(MSDOS) && defined(__EMX__)
  197. X    (void)signal(SIGFPE, (void *)fpe);
  198. X#else
  199. X#if DJGPP
  200. X    (void)signal(SIGFPE, (SignalHandler)fpe);
  201. X#else
  202. X    (void)signal(SIGFPE, fpe);    /* catch core dumps on FPEs */
  203. X#endif
  204. X#endif
  205. X#endif
  206. X
  207. X    execute_at(at_ptr);
  208. X
  209. X#ifndef DOSX286
  210. X    (void)signal(SIGFPE, SIG_DFL);
  211. X#endif
  212. X
  213. X    if (errno == EDOM || errno == ERANGE) {
  214. X        undefined = TRUE;
  215. X    } else {
  216. X        (void)pop(val_ptr);
  217. X        check_stack();
  218. X    }
  219. X    /* At least one machine (ATT 3b1) computes Inf without a SIGFPE */
  220. X    temp = real(val_ptr);
  221. X    if (temp > VERYLARGE || temp < -VERYLARGE) {
  222. X        undefined = TRUE;
  223. X    }
  224. X}
  225. X
  226. X
  227. Xstruct value   *
  228. Xconst_express(valptr)
  229. X    struct value   *valptr;
  230. X{
  231. X    register int    tkn = c_token;
  232. X    if (END_OF_COMMAND)
  233. X        int_error("constant expression required", c_token);
  234. X    evaluate_at(temp_at(), valptr);    /* run it and send answer back */
  235. X    if (undefined) {
  236. X        int_error("undefined value", tkn);
  237. X    }
  238. X    return (valptr);
  239. X}
  240. X
  241. X
  242. Xstruct at_type *
  243. Xtemp_at()
  244. X{                /* build a static action table and return its
  245. X                 * pointer */
  246. X    at.a_count = 0;        /* reset action table !!! */
  247. X    express();
  248. X    return (&at);
  249. X}
  250. X
  251. X
  252. X/* build an action table, put it in dynamic memory, and return its pointer */
  253. X
  254. Xstruct at_type *
  255. Xperm_at()
  256. X{
  257. X    register struct at_type *at_ptr;
  258. X    unsigned int len;
  259. X
  260. X    (void)temp_at();
  261. X    len = sizeof(struct at_type) -
  262. X        (MAX_AT_LEN - at.a_count) * sizeof(struct at_entry);
  263. X    at_ptr = (struct at_type *) alloc((unsigned long)len, "action table");
  264. X    (void)memcpy(at_ptr, &at, len);
  265. X    return (at_ptr);
  266. X}
  267. X
  268. X
  269. X#ifdef NOCOPY
  270. X/*
  271. X * cheap and slow version of memcpy() in case you don't have one 
  272. X */
  273. Xmemcpy(dest, src, len)
  274. X    char           *dest, *src;
  275. X    unsigned int    len;
  276. X{
  277. X    while (len--)
  278. X        *dest++ = *src++;
  279. X}
  280. X#endif                /* NOCOPY */
  281. X
  282. X
  283. Xexpress()
  284. X{                /* full expressions */
  285. X    xterm();
  286. X    xterms();
  287. X}
  288. X
  289. Xxterm()
  290. X{                /* ? : expressions */
  291. X    aterm();
  292. X    aterms();
  293. X}
  294. X
  295. X
  296. Xaterm()
  297. X{
  298. X    bterm();
  299. X    bterms();
  300. X}
  301. X
  302. X
  303. Xbterm()
  304. X{
  305. X    cterm();
  306. X    cterms();
  307. X}
  308. X
  309. X
  310. Xcterm()
  311. X{
  312. X    dterm();
  313. X    dterms();
  314. X}
  315. X
  316. X
  317. Xdterm()
  318. X{
  319. X    eterm();
  320. X    eterms();
  321. X}
  322. X
  323. X
  324. Xeterm()
  325. X{
  326. X    fterm();
  327. X    fterms();
  328. X}
  329. X
  330. X
  331. Xfterm()
  332. X{
  333. X    gterm();
  334. X    gterms();
  335. X}
  336. X
  337. X
  338. Xgterm()
  339. X{
  340. X    hterm();
  341. X    hterms();
  342. X}
  343. X
  344. X
  345. Xhterm()
  346. X{
  347. X    unary();        /* - things */
  348. X    iterms();        /* * / % */
  349. X}
  350. X
  351. X
  352. Xfactor()
  353. X{
  354. X    register int    value;
  355. X
  356. X    if (equals(c_token, "(")) {
  357. X        c_token++;
  358. X        express();
  359. X        if (!equals(c_token, ")"))
  360. X            int_error("')' expected", c_token);
  361. X        c_token++;
  362. X    } else if (isnumber(c_token)) {
  363. X        convert(&(add_action(PUSHC)->v_arg), c_token);
  364. X        c_token++;
  365. X    } else if (isletter(c_token)) {
  366. X        if ((c_token + 1 < num_tokens) && equals(c_token + 1, "(")) {
  367. X            value = standard(c_token);
  368. X            if (value) {    /* it's a standard function */
  369. X                c_token += 2;
  370. X                express();
  371. X                if (equals(c_token, ",")) {
  372. X                    while (equals(c_token, ",")) {
  373. X                        c_token += 1;
  374. X                        express();
  375. X                    }
  376. X                }
  377. X                if (!equals(c_token, ")"))
  378. X                    int_error("')' expected", c_token);
  379. X                c_token++;
  380. X                (void)add_action(value);
  381. X            } else {
  382. X                int             call_type = (int)CALL;
  383. X                value = c_token;
  384. X                c_token += 2;
  385. X                express();
  386. X                if (equals(c_token, ",")) {
  387. X                    struct value    num_params;
  388. X                    num_params.type = INTGR;
  389. X                    num_params.v.int_val = 1;
  390. X                    while (equals(c_token, ",")) {
  391. X                        num_params.v.int_val += 1;
  392. X                        c_token += 1;
  393. X                        express();
  394. X                    }
  395. X                    add_action(PUSHC)->v_arg = num_params;
  396. X                    call_type = (int)CALLN;
  397. X                }
  398. X                if (!equals(c_token, ")"))
  399. X                    int_error("')' expected", c_token);
  400. X                c_token++;
  401. X                add_action(call_type)->udf_arg = add_udf(value);
  402. X            }
  403. X        } else {
  404. X            if (equals(c_token, c_dummy_var[0])) {
  405. X                c_token++;
  406. X                add_action(PUSHD1)->udf_arg = dummy_func;
  407. X            } else if (equals(c_token, c_dummy_var[1])) {
  408. X                c_token++;
  409. X                add_action(PUSHD2)->udf_arg = dummy_func;
  410. X            } else {
  411. X                int             i, param = 0;
  412. X                for (i = 2; i < MAX_NUM_VAR; i++) {
  413. X                    if (equals(c_token, c_dummy_var[i])) {
  414. X                        struct value    num_params;
  415. X                        num_params.type = INTGR;
  416. X                        num_params.v.int_val = i;
  417. X                        param = 1;
  418. X                        c_token++;
  419. X                        add_action(PUSHC)->v_arg = num_params;
  420. X                        add_action(PUSHD)->udf_arg = dummy_func;
  421. X                        break;
  422. X                    }
  423. X                }
  424. X                if (!param) {    /* defined variable */
  425. X                    add_action(PUSH)->udv_arg = add_udv(c_token);
  426. X                    c_token++;
  427. X                }
  428. X            }
  429. X        }
  430. X    }
  431. X    /* end if letter */
  432. X    else
  433. X        int_error("invalid expression ", c_token);
  434. X
  435. X    /* add action code for ! (factorial) operator */
  436. X    while (equals(c_token, "!")) {
  437. X        c_token++;
  438. X        (void)add_action(FACTORIAL);
  439. X    }
  440. X    /* add action code for ** operator */
  441. X    if (equals(c_token, "**")) {
  442. X        c_token++;
  443. X        unary();
  444. X        (void)add_action(POWER);
  445. X    }
  446. X}
  447. X
  448. X
  449. X
  450. Xxterms()
  451. X{                /* create action code for ? : expressions */
  452. X
  453. X    if (equals(c_token, "?")) {
  454. X        register int    savepc1, savepc2;
  455. X        register union argument *argptr1, *argptr2;
  456. X        c_token++;
  457. X        savepc1 = at.a_count;
  458. X        argptr1 = add_action(JTERN);
  459. X        express();
  460. X        if (!equals(c_token, ":"))
  461. X            int_error("expecting ':'", c_token);
  462. X        c_token++;
  463. X        savepc2 = at.a_count;
  464. X        argptr2 = add_action(JUMP);
  465. X        argptr1->j_arg = at.a_count - savepc1;
  466. X        express();
  467. X        argptr2->j_arg = at.a_count - savepc2;
  468. X    }
  469. X}
  470. X
  471. X
  472. Xaterms()
  473. X{                /* create action codes for || operator */
  474. X
  475. X    while (equals(c_token, "||")) {
  476. X        register int    savepc;
  477. X        register union argument *argptr;
  478. X        c_token++;
  479. X        savepc = at.a_count;
  480. X        argptr = add_action(JUMPNZ);    /* short-circuit if already
  481. X                         * TRUE */
  482. X        aterm();
  483. X        argptr->j_arg = at.a_count - savepc;    /* offset for jump */
  484. X        (void)add_action(BOOLE);
  485. X    }
  486. X}
  487. X
  488. X
  489. Xbterms()
  490. X{                /* create action code for && operator */
  491. X
  492. X    while (equals(c_token, "&&")) {
  493. X        register int    savepc;
  494. X        register union argument *argptr;
  495. X        c_token++;
  496. X        savepc = at.a_count;
  497. X        argptr = add_action(JUMPZ);    /* short-circuit if already
  498. X                         * FALSE */
  499. X        bterm();
  500. X        argptr->j_arg = at.a_count - savepc;    /* offset for jump */
  501. X        (void)add_action(BOOLE);
  502. X    }
  503. X}
  504. X
  505. X
  506. Xcterms()
  507. X{                /* create action code for | operator */
  508. X
  509. X    while (equals(c_token, "|")) {
  510. X        c_token++;
  511. X        cterm();
  512. X        (void)add_action(BOR);
  513. X    }
  514. X}
  515. X
  516. X
  517. Xdterms()
  518. X{                /* create action code for ^ operator */
  519. X
  520. X    while (equals(c_token, "^")) {
  521. X        c_token++;
  522. X        dterm();
  523. X        (void)add_action(XOR);
  524. X    }
  525. X}
  526. X
  527. X
  528. Xeterms()
  529. X{                /* create action code for & operator */
  530. X
  531. X    while (equals(c_token, "&")) {
  532. X        c_token++;
  533. X        eterm();
  534. X        (void)add_action(BAND);
  535. X    }
  536. X}
  537. X
  538. X
  539. Xfterms()
  540. X{                /* create action codes for == and !=
  541. X                 * operators */
  542. X
  543. X    while (TRUE) {
  544. X        if (equals(c_token, "==")) {
  545. X            c_token++;
  546. X            fterm();
  547. X            (void)add_action(EQ);
  548. X        } else if (equals(c_token, "!=")) {
  549. X            c_token++;
  550. X            fterm();
  551. X            (void)add_action(NE);
  552. X        } else
  553. X            break;
  554. X    }
  555. X}
  556. X
  557. X
  558. Xgterms()
  559. X{                /* create action code for < > >= or <=
  560. X                 * operators */
  561. X
  562. X    while (TRUE) {
  563. X        /* I hate "else if" statements */
  564. X        if (equals(c_token, ">")) {
  565. X            c_token++;
  566. X            gterm();
  567. X            (void)add_action(GT);
  568. X        } else if (equals(c_token, "<")) {
  569. X            c_token++;
  570. X            gterm();
  571. X            (void)add_action(LT);
  572. X        } else if (equals(c_token, ">=")) {
  573. X            c_token++;
  574. X            gterm();
  575. X            (void)add_action(GE);
  576. X        } else if (equals(c_token, "<=")) {
  577. X            c_token++;
  578. X            gterm();
  579. X            (void)add_action(LE);
  580. X        } else
  581. X            break;
  582. X    }
  583. X
  584. X}
  585. X
  586. X
  587. X
  588. Xhterms()
  589. X{                /* create action codes for + and - operators */
  590. X
  591. X    while (TRUE) {
  592. X        if (equals(c_token, "+")) {
  593. X            c_token++;
  594. X            hterm();
  595. X            (void)add_action(PLUS);
  596. X        } else if (equals(c_token, "-")) {
  597. X            c_token++;
  598. X            hterm();
  599. X            (void)add_action(MINUS);
  600. X        } else
  601. X            break;
  602. X    }
  603. X}
  604. X
  605. X
  606. Xiterms()
  607. X{                /* add action code for * / and % operators */
  608. X
  609. X    while (TRUE) {
  610. X        if (equals(c_token, "*")) {
  611. X            c_token++;
  612. X            unary();
  613. X            (void)add_action(MULT);
  614. X        } else if (equals(c_token, "/")) {
  615. X            c_token++;
  616. X            unary();
  617. X            (void)add_action(DIV);
  618. X        } else if (equals(c_token, "%")) {
  619. X            c_token++;
  620. X            unary();
  621. X            (void)add_action(MOD);
  622. X        } else
  623. X            break;
  624. X    }
  625. X}
  626. X
  627. X
  628. Xunary()
  629. X{                /* add code for unary operators */
  630. X    if (equals(c_token, "!")) {
  631. X        c_token++;
  632. X        unary();
  633. X        (void)add_action(LNOT);
  634. X    } else if (equals(c_token, "~")) {
  635. X        c_token++;
  636. X        unary();
  637. X        (void)add_action(BNOT);
  638. X    } else if (equals(c_token, "-")) {
  639. X        c_token++;
  640. X        unary();
  641. X        (void)add_action(UMINUS);
  642. X    } else
  643. X        factor();
  644. X}
  645. END_OF_FILE
  646.   if test 11722 -ne `wc -c <'gnuplot/parse.c'`; then
  647.     echo shar: \"'gnuplot/parse.c'\" unpacked with wrong size!
  648.   fi
  649.   # end of 'gnuplot/parse.c'
  650. fi
  651. if test -f 'gnuplot/plot.c' -a "${1}" != "-c" ; then 
  652.   echo shar: Will not clobber existing file \"'gnuplot/plot.c'\"
  653. else
  654.   echo shar: Extracting \"'gnuplot/plot.c'\" \(13195 characters\)
  655.   sed "s/^X//" >'gnuplot/plot.c' <<'END_OF_FILE'
  656. X#ifndef lint
  657. Xstatic char *RCSid = "$Id: plot.c%v 3.50.1.8 1993/07/27 05:37:15 woo Exp $";
  658. X#endif
  659. X
  660. X
  661. X/* GNUPLOT - plot.c */
  662. X/*
  663. X * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  664. X *
  665. X * Permission to use, copy, and distribute this software and its
  666. X * documentation for any purpose with or without fee is hereby granted, 
  667. X * provided that the above copyright notice appear in all copies and 
  668. X * that both that copyright notice and this permission notice appear 
  669. X * in supporting documentation.
  670. X *
  671. X * Permission to modify the software is granted, but not the right to
  672. X * distribute the modified code.  Modifications are to be distributed 
  673. X * as patches to released version.
  674. X *  
  675. X * This software is provided "as is" without express or implied warranty.
  676. X * 
  677. X *
  678. X * AUTHORS
  679. X * 
  680. X *   Original Software:
  681. X *     Thomas Williams,  Colin Kelley.
  682. X * 
  683. X *   Gnuplot 2.0 additions:
  684. X *       Russell Lang, Dave Kotz, John Campbell.
  685. X *
  686. X *   Gnuplot 3.0 additions:
  687. X *       Gershon Elber and many others.
  688. X * 
  689. X * There is a mailing list for gnuplot users. Note, however, that the
  690. X * newsgroup 
  691. X *    comp.graphics.gnuplot 
  692. X * is identical to the mailing list (they
  693. X * both carry the same set of messages). We prefer that you read the
  694. X * messages through that newsgroup, to subscribing to the mailing list.
  695. X * (If you can read that newsgroup, and are already on the mailing list,
  696. X * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  697. X * removed from the mailing list.)
  698. X *
  699. X * The address for mailing to list members is
  700. X *       info-gnuplot@dartmouth.edu
  701. X * and for mailing administrative requests is 
  702. X *       info-gnuplot-request@dartmouth.edu
  703. X * The mailing list for bug reports is 
  704. X *       bug-gnuplot@dartmouth.edu
  705. X * The list of those interested in beta-test versions is
  706. X *       info-gnuplot-beta@dartmouth.edu
  707. X */
  708. X
  709. X#include <stdio.h>
  710. X#include <setjmp.h>
  711. X#include <signal.h>
  712. X#ifdef XPG3_LOCALE
  713. X#include <locale.h>
  714. X#endif
  715. X#include "plot.h"
  716. X#include "setshow.h"
  717. X#if defined(MSDOS) || defined(DOS386)
  718. X#include <io.h>
  719. X#endif
  720. X#ifdef vms
  721. X#include <unixio.h>
  722. X#include <smgdef.h>
  723. Xextern int vms_vkid;
  724. Xextern smg$create_virtual_keyboard();
  725. Xunsigned int status[2] = {1, 0};
  726. X#endif
  727. X#ifdef AMIGA_SC_6_1
  728. X#include <proto/dos.h>
  729. X#endif
  730. X
  731. X#ifdef _Windows
  732. X#include <windows.h>
  733. X#ifndef SIGINT
  734. X#define SIGINT 2    /* for MSC */
  735. X#endif
  736. X#else
  737. X# ifdef __TURBOC__
  738. X# include <graphics.h>
  739. X# endif
  740. X#endif
  741. X
  742. X#ifndef AMIGA_SC_6_1
  743. Xextern char *getenv(),*strcat(),*strcpy(),*strncpy();
  744. X#endif /* !AMIGA_SC_6_1 */
  745. X
  746. Xextern char input_line[];
  747. Xextern int c_token;
  748. Xextern FILE *outfile;
  749. Xextern int term;
  750. X
  751. XTBOOLEAN interactive = TRUE;    /* FALSE if stdin not a terminal */
  752. XTBOOLEAN noinputfiles = TRUE;    /* FALSE if there are script files */
  753. Xchar *infile_name = NULL;    /* name of command file; NULL if terminal */
  754. X
  755. X#ifndef STDOUT
  756. X#define STDOUT 1
  757. X#endif
  758. X
  759. X#ifdef _Windows
  760. Xjmp_buf far env;
  761. X#else
  762. Xjmp_buf env;
  763. X#endif
  764. X
  765. Xstruct value *Ginteger(),*Gcomplex();
  766. X
  767. X
  768. Xextern f_push(),f_pushc(),f_pushd1(),f_pushd2(),f_pushd(),f_call(),f_calln(),
  769. X    f_lnot(),f_bnot(),f_uminus(),f_lor(),f_land(),f_bor(),f_xor(),
  770. X    f_band(),f_eq(),f_ne(),f_gt(),f_lt(),
  771. X    f_ge(),f_le(),f_plus(),f_minus(),f_mult(),f_div(),f_mod(),f_power(),
  772. X    f_factorial(),f_bool(),f_jump(),f_jumpz(),f_jumpnz(),f_jtern();
  773. X
  774. Xextern f_real(),f_imag(),f_arg(),f_conjg(),f_sin(),f_cos(),f_tan(),f_asin(),
  775. X    f_acos(),f_atan(),f_sinh(),f_cosh(),f_tanh(),f_int(),f_abs(),f_sgn(),
  776. X    f_sqrt(),f_exp(),f_log10(),f_log(),f_besj0(),f_besj1(),f_besy0(),f_besy1(),
  777. X    f_erf(), f_erfc(), f_gamma(), f_lgamma(), f_ibeta(), f_igamma(), f_rand(),
  778. X    f_floor(),f_ceil(),
  779. X    f_normal(), f_inverse_erf(), f_inverse_normal();   /* XXX - JG */
  780. X
  781. X
  782. Xstruct ft_entry GPFAR ft[] = {    /* built-in function table */
  783. X
  784. X/* internal functions: */
  785. X    {"push", f_push},    {"pushc", f_pushc},
  786. X    {"pushd1", f_pushd1},    {"pushd2", f_pushd2},    {"pushd", f_pushd},
  787. X    {"call", f_call},    {"calln", f_calln},    {"lnot", f_lnot},
  788. X    {"bnot", f_bnot},    {"uminus", f_uminus},    {"lor", f_lor},
  789. X    {"land", f_land},    {"bor", f_bor},        {"xor", f_xor},
  790. X    {"band", f_band},    {"eq", f_eq},        {"ne", f_ne},
  791. X    {"gt", f_gt},        {"lt", f_lt},        {"ge", f_ge},
  792. X    {"le", f_le},        {"plus", f_plus},    {"minus", f_minus},
  793. X    {"mult", f_mult},    {"div", f_div},        {"mod", f_mod},
  794. X    {"power", f_power}, {"factorial", f_factorial},
  795. X    {"bool", f_bool},    {"jump", f_jump},    {"jumpz", f_jumpz},
  796. X    {"jumpnz",f_jumpnz},{"jtern", f_jtern},
  797. X
  798. X/* standard functions: */
  799. X    {"real", f_real},    {"imag", f_imag},    {"arg", f_arg},
  800. X    {"conjg", f_conjg}, {"sin", f_sin},        {"cos", f_cos},
  801. X    {"tan", f_tan},        {"asin", f_asin},    {"acos", f_acos},
  802. X    {"atan", f_atan},    {"sinh", f_sinh},    {"cosh", f_cosh},
  803. X    {"tanh", f_tanh},    {"int", f_int},        {"abs", f_abs},
  804. X    {"sgn", f_sgn},        {"sqrt", f_sqrt},    {"exp", f_exp},
  805. X    {"log10", f_log10},    {"log", f_log},        {"besj0", f_besj0},
  806. X    {"besj1", f_besj1},    {"besy0", f_besy0},    {"besy1", f_besy1},
  807. X        {"erf", f_erf},         {"erfc", f_erfc},       {"gamma", f_gamma},     {"lgamma", f_lgamma},
  808. X        {"ibeta", f_ibeta},     {"igamma", f_igamma},   {"rand", f_rand},
  809. X        {"floor", f_floor},     {"ceil", f_ceil},
  810. X
  811. X    {"norm",        f_normal},              /* XXX-JG */
  812. X    {"inverf",      f_inverse_erf},         /* XXX-JG */
  813. X    {"invnorm",     f_inverse_normal},      /* XXX-JG */
  814. X
  815. X    {NULL, NULL}
  816. X};
  817. X
  818. Xstatic struct udvt_entry udv_pi = {NULL, "pi",FALSE};
  819. X                                    /* first in linked list */
  820. Xstruct udvt_entry *first_udv = &udv_pi;
  821. Xstruct udft_entry *first_udf = NULL;
  822. X
  823. X
  824. X
  825. X#ifdef vms
  826. X
  827. X#define HOME "sys$login:"
  828. X
  829. X#else /* vms */
  830. X#if defined(MSDOS) ||  defined(AMIGA_AC_5) || defined(AMIGA_SC_6_1) || defined(ATARI) || defined(OS2) || defined(_Windows) || defined(DOS386)
  831. X
  832. X#define HOME "GNUPLOT"
  833. X
  834. X#else /* MSDOS || AMIGA || ATARI || OS2 || _Windows || defined(DOS386)*/
  835. X
  836. X#define HOME "HOME"
  837. X
  838. X#endif /* MSDOS || AMIGA || ATARI || OS2 || _Windows || defined(DOS386)*/
  839. X#endif /* vms */
  840. X
  841. X#if defined(unix) || defined(AMIGA_AC_5) || defined(AMIGA_SC_6_1)
  842. X#define PLOTRC ".gnuplot"
  843. X#else /* AMIGA || unix */
  844. X#define PLOTRC "gnuplot.ini"
  845. X#endif /* AMIGA || unix */
  846. X
  847. X#if defined (__TURBOC__) || defined (__PUREC__)
  848. Xvoid tc_interrupt()
  849. X#else
  850. X#ifdef __ZTC__
  851. Xvoid ztc_interrupt()
  852. X#else
  853. X#if defined( _CRAY ) || defined( sgi ) || defined( __alpha )
  854. Xvoid inter(an_int)
  855. Xint an_int;
  856. X#else
  857. X#if defined( NEXT ) || defined( OS2 ) || defined( VMS )
  858. Xvoid inter(int an_int)
  859. X#else
  860. X#ifdef sgi
  861. Xvoid inter(int sig, int code, struct sigcontext *sc)
  862. X#else
  863. X#if defined(SOLARIS)
  864. Xvoid inter()
  865. X#else
  866. Xinter()
  867. X#endif
  868. X#endif
  869. X#endif
  870. X#endif
  871. X#endif
  872. X#endif
  873. X{
  874. X#if defined (MSDOS) || defined(_Windows) || (defined (ATARI) && defined(__PUREC__)) || defined(DOS386)
  875. X#if defined (__TURBOC__) || defined (__PUREC__)
  876. X#ifndef DOSX286
  877. X    (void) signal(SIGINT, tc_interrupt);
  878. X#endif
  879. X#else
  880. X#ifdef __ZTC__
  881. X   (void) signal(SIGINT, ztc_interrupt);
  882. X#else
  883. X#ifdef __EMX__
  884. X    (void) signal(SIGINT, (void *)inter);
  885. X#else
  886. X#ifdef DJGPP
  887. X    (void) signal(SIGINT, (SignalHandler)inter);
  888. X#else
  889. X#if defined __MSC__
  890. X    (void) signal(SIGINT, inter);
  891. X#endif    /* __MSC__ */
  892. X
  893. X#endif    /* DJGPP */
  894. X#endif  /* __EMX__ */
  895. X#endif    /* ZTC */
  896. X#endif  /* __TURBOC__ */
  897. X
  898. X#else  /* MSDOS */
  899. X#ifdef OS2
  900. X    (void) signal(an_int, SIG_ACK);
  901. X#else
  902. X    (void) signal(SIGINT, inter);
  903. X#endif  /* OS2 */
  904. X#endif  /* MSDOS */
  905. X#ifndef DOSX286
  906. X    (void) signal(SIGFPE, SIG_DFL);    /* turn off FPE trapping */
  907. X#endif
  908. X    if (term && term_init)
  909. X        (*term_tbl[term].text)();    /* hopefully reset text mode */
  910. X    (void) fflush(outfile);
  911. X    (void) putc('\n',stderr);
  912. X    longjmp(env, TRUE);        /* return to prompt */
  913. X}
  914. X
  915. X
  916. X#ifdef _Windows
  917. Xgnu_main(argc, argv)
  918. X#else
  919. Xmain(argc, argv)
  920. X#endif
  921. X    int argc;
  922. X    char **argv;
  923. X{
  924. X#ifdef XPG3_LOCALE
  925. X    (void) setlocale(LC_CTYPE, "");
  926. X#endif
  927. X/* Register the Borland Graphics Interface drivers. If they have been */
  928. X/* included by the linker.                                            */
  929. X
  930. X#ifndef DOSX286
  931. X#ifndef _Windows
  932. X#if defined (__TURBOC__) && defined (MSDOS)
  933. Xregisterfarbgidriver(EGAVGA_driver_far);
  934. Xregisterfarbgidriver(CGA_driver_far);
  935. Xregisterfarbgidriver(Herc_driver_far);
  936. Xregisterfarbgidriver(ATT_driver_far);
  937. X# endif
  938. X#endif
  939. X#endif
  940. X#ifdef X11
  941. X     { int n = X11_args(argc, argv); argv += n; argc -= n; }
  942. X#endif 
  943. X
  944. X#ifdef apollo
  945. X    apollo_pfm_catch();
  946. X#endif
  947. X
  948. X    setbuf(stderr,(char *)NULL);
  949. X#ifdef UNIX
  950. X    setlinebuf(stdout);
  951. X#endif
  952. X    outfile = stdout;
  953. X    (void) Gcomplex(&udv_pi.udv_value, Pi, 0.0);
  954. X
  955. X     interactive = FALSE;
  956. X     init_terminal();        /* can set term type if it likes */
  957. X
  958. X#ifdef AMIGA_SC_6_1
  959. X     if (IsInteractive(Input()) == DOSTRUE) interactive = TRUE;
  960. X     else interactive = FALSE;
  961. X#else
  962. X#if defined(__MSC__) && defined(_Windows)
  963. X     interactive = TRUE;
  964. X#else
  965. X     interactive = isatty(fileno(stdin));
  966. X#endif
  967. X#endif
  968. X     if (argc > 1)
  969. X      interactive = noinputfiles = FALSE;
  970. X     else
  971. X      noinputfiles = TRUE;
  972. X
  973. X     if (interactive)
  974. X      show_version();
  975. X#ifdef vms   /* initialise screen management routines for command recall */
  976. X          if (status[1] = smg$create_virtual_keyboard(&vms_vkid) != SS$_NORMAL)
  977. X               done(status[1]);
  978. X#endif
  979. X
  980. X    if (!setjmp(env)) {
  981. X        /* first time */
  982. X        interrupt_setup();
  983. X        load_rcfile();
  984. X
  985. X        if (interactive && term != 0)    /* not unknown */
  986. X         fprintf(stderr, "\nTerminal type set to '%s'\n", 
  987. X                term_tbl[term].name);
  988. X    } else {    
  989. X        /* come back here from int_error() */
  990. X        load_file_error();    /* if we were in load_file(), cleanup */
  991. X#ifdef _Windows
  992. X    SetCursor(LoadCursor((HINSTANCE)NULL, IDC_ARROW));
  993. X#endif
  994. X#ifdef vms
  995. X        /* after catching interrupt */
  996. X        /* VAX stuffs up stdout on SIGINT while writing to stdout,
  997. X          so reopen stdout. */
  998. X        if (outfile == stdout) {
  999. X           if ( (stdout = freopen("SYS$OUTPUT","w",stdout))  == NULL) {
  1000. X              /* couldn't reopen it so try opening it instead */
  1001. X              if ( (stdout = fopen("SYS$OUTPUT","w"))  == NULL) {
  1002. X                 /* don't use int_error here - causes infinite loop! */
  1003. X                 fprintf(stderr,"Error opening SYS$OUTPUT as stdout\n");
  1004. X              }
  1005. X           }
  1006. X           outfile = stdout;
  1007. X        }
  1008. X#endif                    /* VMS */
  1009. X        if (!interactive && !noinputfiles) {
  1010. X            if (term && term_init)
  1011. X                (*term_tbl[term].reset)();
  1012. X#ifdef vms
  1013. X            vms_reset();
  1014. X#endif
  1015. X            return(IO_ERROR);    /* exit on non-interactive error */
  1016. X         }
  1017. X    }
  1018. X
  1019. X     if (argc > 1) {
  1020. X        /* load filenames given as arguments */
  1021. X        while (--argc > 0) {
  1022. X           ++argv;
  1023. X           c_token = NO_CARET; /* in case of file not found */
  1024. X           load_file(fopen(*argv,"r"), *argv);    
  1025. X        }
  1026. X    } else {
  1027. X        /* take commands from stdin */
  1028. X        while(!com_line());
  1029. X    }
  1030. X
  1031. X    if (term && term_init)
  1032. X        (*term_tbl[term].reset)();
  1033. X#ifdef vms
  1034. X    vms_reset();
  1035. X#endif
  1036. X    return(IO_SUCCESS);
  1037. X}
  1038. X
  1039. X#if defined(ATARI) && defined(__PUREC__)
  1040. X#include <math.h>
  1041. Xint purec_matherr(struct exception *e)
  1042. X{    char *c;
  1043. X    switch (e->type) {
  1044. X        case DOMAIN:    c = "domain error"; break;
  1045. X        case SING  :    c = "argument singularity"; break;
  1046. X        case OVERFLOW:  c = "overflow range"; break;
  1047. X        case UNDERFLOW: c = "underflow range"; break;
  1048. X        default:        c = "(unknown error"; break;
  1049. X    }
  1050. X    fprintf(stderr, "math exception : %s\n", c);
  1051. X    fprintf(stderr, "    name : %s\n", e->name);
  1052. X    fprintf(stderr, "    arg 1: %e\n", e->arg1);
  1053. X    fprintf(stderr, "    arg 2: %e\n", e->arg2);
  1054. X    fprintf(stderr, "    ret  : %e\n", e->retval);
  1055. X    return 1;
  1056. X}
  1057. X#endif
  1058. X
  1059. X/* Set up to catch interrupts */
  1060. Xinterrupt_setup()
  1061. X{
  1062. X#if defined (MSDOS) || defined(_Windows) || (defined (ATARI) && defined(__PUREC__)) || defined(DOS386)
  1063. X#ifdef __PUREC__
  1064. X    setmatherr(purec_matherr);
  1065. X#endif
  1066. X#if defined (__TURBOC__) || defined (__PUREC__)
  1067. X#if !defined(DOSX286) && !defined(BROKEN_SIGINT)
  1068. X        (void) signal(SIGINT, tc_interrupt);    /* go there on interrupt char */
  1069. X#endif
  1070. X#else
  1071. X#ifdef __ZTC__
  1072. X        (void) signal(SIGINT, ztc_interrupt);
  1073. X#else
  1074. X#ifdef __EMX__
  1075. X        (void) signal(SIGINT, (void *)inter);    /* go there on interrupt char */
  1076. X#else
  1077. X#ifdef DJGPP
  1078. X        (void) signal(SIGINT, (SignalHandler)inter);    /* go there on interrupt char */
  1079. X#else
  1080. X               (void) signal(SIGINT, inter);
  1081. X#endif
  1082. X#endif
  1083. X#endif
  1084. X#endif
  1085. X#else /* MSDOS */
  1086. X        (void) signal(SIGINT, inter);    /* go there on interrupt char */
  1087. X#endif /* MSDOS */
  1088. X}
  1089. X
  1090. X
  1091. X/* Look for a gnuplot start-up file */
  1092. Xload_rcfile()
  1093. X{
  1094. X    register FILE *plotrc;
  1095. X    char home[80]; 
  1096. X    char rcfile[sizeof(PLOTRC)+80];
  1097. X
  1098. X    /* Look for a gnuplot init file in . or home directory */
  1099. X#ifdef vms
  1100. X    (void) strcpy(home,HOME);
  1101. X#else /* vms */
  1102. X    char *tmp_home=getenv(HOME);
  1103. X    char *p;    /* points to last char in home path, or to \0, if none */
  1104. X    char c='\0';/* character that should be added, or \0, if none */
  1105. X
  1106. X
  1107. X    if(tmp_home) {
  1108. X        strcpy(home,tmp_home);
  1109. X    if( strlen(home) ) p = &home[strlen(home)-1];
  1110. X    else           p = home;
  1111. X#if defined(MSDOS) || defined(ATARI) || defined( OS2 ) || defined(_Windows) || defined(DOS386)
  1112. X    if( *p!='\\' && *p!='\0' ) c='\\';
  1113. X#else
  1114. X#if defined(AMIGA_AC_5)
  1115. X    if( *p!='/' && *p!=':' && *p!='\0' ) c='/';
  1116. X#else /* that leaves unix */
  1117. X    c='/';
  1118. X#endif
  1119. X#endif
  1120. X    if(c) {
  1121. X        if(*p) p++;
  1122. X        *p++=c;
  1123. X        *p='\0';
  1124. X    }
  1125. X    }
  1126. X#endif /* vms */
  1127. X
  1128. X#ifdef NOCWDRC
  1129. X    /* inhibit check of init file in current directory for security reasons */
  1130. X    {
  1131. X#else
  1132. X    (void) strcpy(rcfile, PLOTRC);
  1133. X    plotrc = fopen(rcfile,"r");
  1134. X    if (plotrc == (FILE *)NULL) {
  1135. X#endif
  1136. X#ifndef vms
  1137. X    if( tmp_home ) {
  1138. X#endif
  1139. X       (void) sprintf(rcfile, "%s%s", home, PLOTRC);
  1140. X       plotrc = fopen(rcfile,"r");
  1141. X#ifndef vms
  1142. X    } else
  1143. X        plotrc=NULL;
  1144. X#endif
  1145. X    }
  1146. X    if (plotrc)
  1147. X     load_file(plotrc, rcfile);
  1148. X}
  1149. END_OF_FILE
  1150.   if test 13195 -ne `wc -c <'gnuplot/plot.c'`; then
  1151.     echo shar: \"'gnuplot/plot.c'\" unpacked with wrong size!
  1152.   fi
  1153.   # end of 'gnuplot/plot.c'
  1154. fi
  1155. if test -f 'gnuplot/term/aed.trm' -a "${1}" != "-c" ; then 
  1156.   echo shar: Will not clobber existing file \"'gnuplot/term/aed.trm'\"
  1157. else
  1158.   echo shar: Extracting \"'gnuplot/term/aed.trm'\" \(2382 characters\)
  1159.   sed "s/^X//" >'gnuplot/term/aed.trm' <<'END_OF_FILE'
  1160. X/*
  1161. X * $Id: aed.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  1162. X *
  1163. X */
  1164. X
  1165. X/* GNUPLOT - aed.trm */
  1166. X/*
  1167. X * Copyright (C) 1990 - 1993
  1168. X *
  1169. X * Permission to use, copy, and distribute this software and its
  1170. X * documentation for any purpose with or without fee is hereby granted, 
  1171. X * provided that the above copyright notice appear in all copies and 
  1172. X * that both that copyright notice and this permission notice appear 
  1173. X * in supporting documentation.
  1174. X *
  1175. X * Permission to modify the software is granted, but not the right to
  1176. X * distribute the modified code.  Modifications are to be distributed 
  1177. X * as patches to released version.
  1178. X *  
  1179. X * This software  is provided "as is" without express or implied warranty.
  1180. X * 
  1181. X * This file is included by ../term.c.
  1182. X *
  1183. X * This terminal driver supports:
  1184. X *   AED terminals
  1185. X *
  1186. X * AUTHORS
  1187. X *     Colin Kelley, Thomas Williams, Russell Lang
  1188. X *
  1189. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  1190. X * 
  1191. X */
  1192. X
  1193. X#define AED_XMAX 768
  1194. X#define AED_YMAX 575
  1195. X
  1196. X#define AED_XLAST (AED_XMAX - 1)
  1197. X#define AED_YLAST (AED_YMAX - 1)
  1198. X
  1199. X#define AED_VCHAR    13
  1200. X#define AED_HCHAR    8
  1201. X#define AED_VTIC    8
  1202. X#define AED_HTIC    7
  1203. X
  1204. X/* slightly different for AED 512 */
  1205. X#define AED5_XMAX 512
  1206. X#define AED5_XLAST (AED5_XMAX - 1)
  1207. X
  1208. XAED_init()
  1209. X{
  1210. X    fprintf(outfile,
  1211. X    "\033SEN3DDDN.SEC.7.SCT.0.1.80.80.90.SBC.0.AAV2.MOV.0.9.CHR.0.FFD");
  1212. X/*   2            3     4                5     7    6       1
  1213. X    1. Clear Screen
  1214. X    2. Set Encoding
  1215. X    3. Set Default Color
  1216. X    4. Set Backround Color Table Entry
  1217. X    5. Set Backround Color
  1218. X    6. Move to Bottom Lefthand Corner
  1219. X    7. Anti-Alias Vectors
  1220. X*/
  1221. X}
  1222. X
  1223. X
  1224. XAED_graphics()
  1225. X{
  1226. X    fprintf(outfile,"\033FFD\033");
  1227. X}
  1228. X
  1229. X
  1230. XAED_text()
  1231. X{
  1232. X    fprintf(outfile,"\033MOV.0.9.SEC.7.XXX");
  1233. X}
  1234. X
  1235. X
  1236. X
  1237. XAED_linetype(linetype)
  1238. Xint linetype;
  1239. X{
  1240. Xstatic int color[2+9] = { 7, 1, 6, 2, 3, 5, 1, 6, 2, 3, 5 };
  1241. Xstatic int type[2+9] = { 85, 85, 255, 255, 255, 255, 255, 85, 85, 85, 85 };
  1242. X
  1243. X    if (linetype >= 10)
  1244. X        linetype %= 10;
  1245. X    fprintf(outfile,"\033SLS%d.255.",type[linetype+2]);
  1246. X    fprintf(outfile,"\033SEC%d.",color[linetype+2]);
  1247. X}
  1248. X
  1249. X
  1250. X
  1251. XAED_move(x,y)
  1252. Xint x,y;
  1253. X{
  1254. X    fprintf(outfile,"\033MOV%d.%d.",x,y);
  1255. X}
  1256. X
  1257. X
  1258. XAED_vector(x,y)
  1259. Xint x,y;
  1260. X{
  1261. X    fprintf(outfile,"\033DVA%d.%d.",x,y);
  1262. X}
  1263. X
  1264. X
  1265. XAED_put_text(x,y,str)
  1266. Xint x,y;
  1267. Xchar str[];
  1268. X{
  1269. X    AED_move(x,y - AED_VCHAR/2 + 2);
  1270. X    fprintf(outfile,"\033XXX%s\033",str);
  1271. X}
  1272. X
  1273. X
  1274. X#define hxt (AED_HTIC/2)
  1275. X#define hyt (AED_VTIC/2)
  1276. X
  1277. XAED_reset()
  1278. X{
  1279. X    fprintf(outfile,"\033SCT0.1.0.0.0.SBC.0.FFD");
  1280. X}
  1281. X
  1282. END_OF_FILE
  1283.   if test 2382 -ne `wc -c <'gnuplot/term/aed.trm'`; then
  1284.     echo shar: \"'gnuplot/term/aed.trm'\" unpacked with wrong size!
  1285.   fi
  1286.   # end of 'gnuplot/term/aed.trm'
  1287. fi
  1288. if test -f 'gnuplot/term/gpr.trm' -a "${1}" != "-c" ; then 
  1289.   echo shar: Will not clobber existing file \"'gnuplot/term/gpr.trm'\"
  1290. else
  1291.   echo shar: Extracting \"'gnuplot/term/gpr.trm'\" \(11708 characters\)
  1292.   sed "s/^X//" >'gnuplot/term/gpr.trm' <<'END_OF_FILE'
  1293. X/*
  1294. X * $Id: gpr.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  1295. X *
  1296. X */
  1297. X
  1298. X/* GNUPLOT - gpr.trm */
  1299. X/*
  1300. X * Copyright (C) 1990 - 1993   
  1301. X *
  1302. X * Permission to use, copy, and distribute this software and its
  1303. X * documentation for any purpose with or without fee is hereby granted, 
  1304. X * provided that the above copyright notice appear in all copies and 
  1305. X * that both that copyright notice and this permission notice appear 
  1306. X * in supporting documentation.
  1307. X *
  1308. X * Permission to modify the software is granted, but not the right to
  1309. X * distribute the modified code.  Modifications are to be distributed 
  1310. X * as patches to released version.
  1311. X *  
  1312. X * This software  is provided "as is" without express or implied warranty.
  1313. X * 
  1314. X * This file is included by ../term.c.
  1315. X *
  1316. X * This terminal driver supports:
  1317. X *   APOLLO's GPR windowing system
  1318. X *
  1319. X * AUTHORS
  1320. X *  Michael Aramini
  1321. X *  Roque D Oliveira , oliveria@caen.engin.umich.edu
  1322. X * 
  1323. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  1324. X * 
  1325. X */
  1326. X#include <apollo/base.h>
  1327. X#include <apollo/error.h>
  1328. X#include <apollo/gpr.h>
  1329. X#include <apollo/pad.h>
  1330. X/* landscape window */
  1331. X/*
  1332. X#define GPR_XMAX 720
  1333. X#define GPR_YMAX 450
  1334. X*/
  1335. X/* portrait window */
  1336. X#define GPR_XMAX 585
  1337. X#define GPR_YMAX 735
  1338. X
  1339. X#define GPR_XLAST (GPR_XMAX - 1)
  1340. X#define GPR_YLAST (GPR_YMAX - 1)
  1341. X
  1342. X#define GPR_VCHAR 19
  1343. X#define GPR_HCHAR 10
  1344. X#define GPR_VTIC (GPR_YMAX/80)
  1345. X#define GPR_HTIC (GPR_XMAX/80)
  1346. X
  1347. Xgpr_$direction_t  gpr_path=gpr_$right;
  1348. Xint               gpr_ang=0;            /* text angle, 0=horizontal, 1=vertical */
  1349. Xenum JUSTIFY      gpr_justify=LEFT;     /* text is flush left */
  1350. X
  1351. Xstatic status_$t  status;
  1352. Xunsigned int      Debug    = 0;         /* set it to 1 when debugging program */
  1353. X
  1354. X
  1355. Xstatic void check(messagex)
  1356. Xchar *messagex;
  1357. X{
  1358. X  if (status.all = status_$ok)
  1359. X  {
  1360. X    error_$print(status);
  1361. X    printf("Error occurred while %s.\n", messagex);
  1362. X  }
  1363. X}
  1364. X
  1365. X/* return whether stdout is a DM pad . Called by term.c */
  1366. Xgpr_isa_pad()
  1367. X{
  1368. X    pad_$isa(1, &status);
  1369. X    return (status.all == status_$ok);
  1370. X}
  1371. X
  1372. X
  1373. XGPR_init()
  1374. X{
  1375. X  gpr_$offset_t dm_bitmap_size;
  1376. X  gpr_$bitmap_desc_t dm_bitmap_desc;
  1377. X  pad_$window_desc_t window;
  1378. X  short font_id;
  1379. X  stream_$id_t stream_id;
  1380. X  static gpr_$rgb_plane_t  hi_plane;
  1381. X  static gpr_$disp_char_t  display_characteristics;
  1382. X  static float             screen_size_r_width,screen_size_r_height ;
  1383. X  static short int         disp_len = sizeof(gpr_$disp_char_t);
  1384. X  static short int         disp_len_returned;
  1385. X
  1386. X
  1387. X  /* open a pad to do graphics in */
  1388. X  window.top    = 0;
  1389. X  window.left   = 0;
  1390. X  window.width  = GPR_XMAX + 10; /* 10 accounts for width of window border */
  1391. X  window.height = GPR_YMAX + 35; /* 35 accounts for height of window border */
  1392. X  pad_$create_window("",(short)0,pad_$transcript,(short)1,window,&stream_id,&status);
  1393. X  check("pad_$create_window");
  1394. X
  1395. X/*  pad_$set_full_window(stream_id,(short) 1,&window, &status); */
  1396. X/*  pad_$set_border (stream_id,(short) 1, true, &status); */
  1397. X  pad_$set_scale (stream_id,(short) 1,(short) 1, &status);
  1398. X  pad_$set_auto_close(stream_id, (short) 1, true, &status );
  1399. X
  1400. X  gpr_$inq_disp_characteristics(gpr_$direct,stream_id,disp_len,&display_characteristics,&disp_len_returned,&status);
  1401. X  check("in gpr_$inq_display_characteristics");
  1402. X  screen_size_r_width    = (float) display_characteristics.x_window_size;    /*x_window_size in pixels */
  1403. X  screen_size_r_height   = (float) display_characteristics.y_window_size;    /*y_window_size in pixels */
  1404. X  hi_plane  = display_characteristics.n_planes - 1;  
  1405. X  if(Debug) printf("width=%f height=%f \n",screen_size_r_width,screen_size_r_height);
  1406. X
  1407. X  dm_bitmap_size.x_size = 1280;
  1408. X  dm_bitmap_size.y_size = 1024;
  1409. X  gpr_$init(gpr_$direct,stream_id,dm_bitmap_size,hi_plane,&dm_bitmap_desc,&status); 
  1410. X  check("in gpr_$init");
  1411. X/*
  1412. X  gpr_$set_obscured_opt(gpr_$pop_if_obs, &status); 
  1413. X  check("in gpr_$set_obscured_opt");
  1414. X*/
  1415. X  gpr_$set_auto_refresh(true, &status); 
  1416. X  check("in gpr_$set_auto_refresh");
  1417. X
  1418. X  /* load a font and make it current */
  1419. X  gpr_$load_font_file("f7x13", 5, &font_id, &status);
  1420. X  check("in gpr_$load_font_file");
  1421. X  gpr_$set_text_font(font_id, &status);
  1422. X  check("in gpr_$set_text_font");
  1423. X
  1424. X  /* set up color values */
  1425. X  gpr_$set_draw_value((gpr_$pixel_value_t)7, &status);  /* white */
  1426. X  check("in gpr_set_draw_value");
  1427. X  gpr_$set_text_background_value((gpr_$pixel_value_t)(-1), &status); /* trans */
  1428. X  check("in gpr_$set_text_background_value");
  1429. X  gpr_$set_text_value((gpr_$pixel_value_t)7, &status);  /* white */
  1430. X  check("in gpr_$set_text_value");
  1431. X}
  1432. X
  1433. X
  1434. XGPR_graphics()
  1435. X{
  1436. X  gpr_$coordinate_t locx,locy,marker_size;
  1437. X
  1438. X  (void) gpr_$acquire_display(&status);
  1439. X  check("in gpr_$acquire display");
  1440. X  gpr_$clear((gpr_$pixel_value_t)0, &status);  /* black */
  1441. X  check("in gpr_$clear");
  1442. X
  1443. X  if(Debug) 
  1444. X   {
  1445. X    marker_size = (short) 10;  
  1446. X
  1447. X    locx = (short) 5;
  1448. X    locy = (short) 5;
  1449. X    gpr_$set_draw_value((gpr_$pixel_value_t)2, &status);  /* white */
  1450. X    gpr_$move( (locx - marker_size/2) ,locy,&status);
  1451. X    gpr_$line( (locx + marker_size/2) ,locy,&status);
  1452. X    gpr_$move( locx, (locy + marker_size/2),&status);
  1453. X    gpr_$line( locx, (locy - marker_size/2),&status);
  1454. X    
  1455. X    locx = (short) (GPR_XMAX -1 - 5);
  1456. X    locy = (short) 5;
  1457. X    gpr_$set_draw_value((gpr_$pixel_value_t)3, &status);  /* white */
  1458. X    gpr_$move( (locx - marker_size/2) ,locy,&status);
  1459. X    gpr_$line( (locx + marker_size/2) ,locy,&status);
  1460. X    gpr_$move( locx, (locy + marker_size/2),&status);
  1461. X    gpr_$line( locx, (locy - marker_size/2),&status);
  1462. X    
  1463. X    locx = (short) 5;
  1464. X    locy = (short) (GPR_YMAX -1 - 5);
  1465. X    gpr_$set_draw_value((gpr_$pixel_value_t)4, &status);  /* white */
  1466. X    gpr_$move( (locx - marker_size/2) ,locy,&status);
  1467. X    gpr_$line( (locx + marker_size/2) ,locy,&status);
  1468. X    gpr_$move( locx, (locy + marker_size/2),&status);
  1469. X    gpr_$line( locx, (locy - marker_size/2),&status);
  1470. X    
  1471. X    locx = (short) (GPR_XMAX -1 - 5);
  1472. X    locy = (short) (GPR_YMAX -1 - 5);
  1473. X    gpr_$set_draw_value((gpr_$pixel_value_t)5, &status);  /* white */
  1474. X    gpr_$move( (locx - marker_size/2) ,locy,&status);
  1475. X    gpr_$line( (locx + marker_size/2) ,locy,&status);
  1476. X    gpr_$move( locx, (locy + marker_size/2),&status);
  1477. X    gpr_$line( locx, (locy - marker_size/2),&status);
  1478. X    
  1479. X    gpr_$set_draw_value((gpr_$pixel_value_t)7, &status);  /* white */
  1480. X    check("in gpr_$set_draw_value");
  1481. X   } /* end if(Debug) */
  1482. X
  1483. X}
  1484. X
  1485. X
  1486. XGPR_text()
  1487. X{
  1488. X  gpr_$release_display(&status);
  1489. X  check("gpr_$release_display");
  1490. X}
  1491. X
  1492. X
  1493. XGPRold_linetype(linetype)
  1494. Xint linetype;
  1495. X{
  1496. X  static gpr_$line_pattern_t patterns[2+5] = {
  1497. X      { 0xFFFF },   /* solid              1111111111111111 */
  1498. X      { 0x3FFF },   /* very long dashed   0011111111111111 */
  1499. X      { 0xFFFF },   /* solid              1111111111111111 */
  1500. X      { 0x5555 },   /* dotted             0101010101010101 */
  1501. X      { 0x3333 },   /* short dashed       0011001100110011 */
  1502. X      { 0xB5AD },   /* dot short-dashed   1011010110101101 */
  1503. X      { 0x3FFF }    /* very long dashed   0011111111111111 */
  1504. X                                             };
  1505. X  if (linetype >= 5) linetype %= 5;
  1506. X  gpr_$set_line_pattern((short)1, patterns[linetype+2], (short)16, &status);
  1507. X  check("in gpr_$set_line_pattern");
  1508. X}
  1509. X
  1510. XGPR_linetype(linetype)
  1511. Xint linetype;
  1512. X{
  1513. X  static gpr_$line_pattern_t patterns[2+7] = {
  1514. X      { 0xFFFF },   /* solid              1111111111111111 */
  1515. X      { 0x1111 },   /* long-spaced dotted 0001000100010001 */
  1516. X      { 0xFFFF },   /* solid              1111111111111111 */
  1517. X      { 0x5555 },   /* dotted             0101010101010101 */
  1518. X      { 0x3333 },   /* short  dashed      0011001100110011 */
  1519. X      { 0x7777 },   /* medium dashed      0111011101110111 */
  1520. X      { 0x3F3F },   /* long   dashed      0011111100111111 */
  1521. X      { 0x0F0F },   /* long-spaced dashed 0000111100001111 */
  1522. X      { 0x5F5F }    /* dot dashed         0101111101011111 */
  1523. X                                             };
  1524. X  if (linetype >= 7) linetype %= 7;
  1525. X  gpr_$set_line_pattern((short)1, patterns[linetype+2], (short)16, &status);
  1526. X  check("in gpr_$set_line_pattern");
  1527. X
  1528. X/*
  1529. X  gpr_$set_draw_value((gpr_$pixel_value_t)(linetype + 1), &status);
  1530. X  check("in gpr_$set_draw_value");
  1531. X*/
  1532. X}
  1533. X
  1534. X
  1535. XGPR_move(x, y)
  1536. Xunsigned int x, y;
  1537. X{
  1538. X  gpr_$move((short)x, (short)(GPR_YMAX -1 - y), &status);
  1539. X  check("in gpr_$move");
  1540. X}
  1541. X
  1542. X
  1543. XGPR_vector(x, y)
  1544. Xunsigned int x, y;
  1545. X{
  1546. X  gpr_$line((short)x, (short)(GPR_YMAX -1 - y), &status);
  1547. X  check("in gpr_$line");
  1548. X}
  1549. X
  1550. X
  1551. XGPR_put_text(x,y,str)
  1552. Xunsigned int x,y;        /* reference point of string */
  1553. Xchar str[];              /* the text */
  1554. X{
  1555. X  gpr_$coordinate_t xgpr,ygpr;
  1556. X  gpr_$offset_t     str_size_in_pixels;
  1557. X  short int         str_len;     
  1558. X
  1559. X  gpr_$coordinate_t locx,locy,marker_size;
  1560. X
  1561. X  if(Debug) 
  1562. X   {
  1563. X    locx = (short) x;
  1564. X    locy = (short) (GPR_YMAX -1 - y);
  1565. X    marker_size = (short) 20;  
  1566. X    gpr_$set_draw_value((gpr_$pixel_value_t)1, &status);  /* white */
  1567. X    gpr_$move( (locx - marker_size/2) ,locy,&status);
  1568. X    gpr_$line( (locx + marker_size/2) ,locy,&status);
  1569. X    gpr_$move( locx, (locy + marker_size/2),&status);
  1570. X    gpr_$line( locx, (locy - marker_size/2),&status);
  1571. X    gpr_$set_draw_value((gpr_$pixel_value_t)7, &status);  /* white */
  1572. X   }
  1573. X
  1574. X  xgpr = (short) x;
  1575. X  ygpr = (short) (GPR_YMAX -1 - y); 
  1576. X  gpr_$set_text_path(gpr_path, &status); 
  1577. X  check("gpr_$set_text_path");
  1578. X
  1579. X  str_len = (short) strlen(str);
  1580. X  gpr_$inq_text_extent(str,str_len,&str_size_in_pixels,&status); /* Calculate how much space (in pixels) the string requires */    
  1581. X  check("in gpr_$inq_text_extent");
  1582. X
  1583. X  switch (gpr_justify) 
  1584. X   {
  1585. X    case LEFT :
  1586. X        {
  1587. X         switch (gpr_path) 
  1588. X          {
  1589. X           case gpr_$up :           /* vertical */
  1590. X               {
  1591. X                if(Debug) printf("LEFT and up , str=%s\n",str);
  1592. X                break;
  1593. X               }
  1594. X           case gpr_$right :        /* horizontal */
  1595. X               {
  1596. X                ygpr = ygpr + str_size_in_pixels.y_size/2;
  1597. X                if(Debug) printf("LEFT and right, str=%s \n",str);
  1598. X                break;
  1599. X               }
  1600. X          }
  1601. X         break;
  1602. X        }
  1603. X
  1604. X    case CENTRE :
  1605. X        {  
  1606. X         switch (gpr_path) 
  1607. X          {
  1608. X           case gpr_$up :           /* vertical */
  1609. X               {
  1610. X                xgpr = xgpr + str_size_in_pixels.x_size/2;
  1611. X                ygpr = ygpr + str_size_in_pixels.y_size/2;
  1612. X                if(Debug) printf("CENTRE and up, str=%s \n",str);
  1613. X                break;
  1614. X               }
  1615. X           case gpr_$right :        /* horizontal */
  1616. X               {
  1617. X                xgpr = xgpr - str_size_in_pixels.x_size/2;
  1618. X                ygpr = ygpr + str_size_in_pixels.y_size/2;
  1619. X                if(Debug) printf("CENTRE and right, str=%s \n",str);
  1620. X                break;
  1621. X               }
  1622. X          }
  1623. X         break;
  1624. X        }
  1625. X    case RIGHT :
  1626. X        {
  1627. X         switch (gpr_path) 
  1628. X          {
  1629. X           case gpr_$up :           /* vertical */
  1630. X               {
  1631. X                ygpr = ygpr + str_size_in_pixels.y_size;
  1632. X                if(Debug) printf("RIGHT and up, str=%s \n",str);
  1633. X                break;
  1634. X               }
  1635. X           case gpr_$right :        /* horizontal */
  1636. X               {
  1637. X                xgpr = xgpr - str_size_in_pixels.x_size;
  1638. X                ygpr = ygpr + str_size_in_pixels.y_size/2;
  1639. X                if(Debug) printf("RIGHT and right, str=%s \n",str);
  1640. X                break;
  1641. X               }
  1642. X          }
  1643. X         break;
  1644. X        }
  1645. X   }
  1646. X
  1647. X  gpr_$move(xgpr,ygpr,&status);
  1648. X  check("in gpr_$move");
  1649. X  gpr_$text(str, str_len, &status);
  1650. X  check("in gpr_$text");
  1651. X}
  1652. X
  1653. Xint GPR_text_angle(ang)
  1654. Xint ang;
  1655. X{   
  1656. X    if (gpr_ang != ang)
  1657. X      {
  1658. X        gpr_ang  = ang;
  1659. X        gpr_path = (gpr_ang == 1 ? gpr_$up : gpr_$right);
  1660. X      }
  1661. X    return (TRUE);
  1662. X}
  1663. X
  1664. Xint GPR_justify_text(mode)
  1665. Xenum JUSTIFY mode;
  1666. X{
  1667. X    gpr_justify = mode;
  1668. X    return (TRUE);
  1669. X}
  1670. X
  1671. XGPR_reset()
  1672. X{
  1673. X  gpr_$terminate(false, &status);
  1674. X  check("in gpr_$terminate");
  1675. X}
  1676. END_OF_FILE
  1677.   if test 11708 -ne `wc -c <'gnuplot/term/gpr.trm'`; then
  1678.     echo shar: \"'gnuplot/term/gpr.trm'\" unpacked with wrong size!
  1679.   fi
  1680.   # end of 'gnuplot/term/gpr.trm'
  1681. fi
  1682. if test -f 'gnuplot/term/next.trm' -a "${1}" != "-c" ; then 
  1683.   echo shar: Will not clobber existing file \"'gnuplot/term/next.trm'\"
  1684. else
  1685.   echo shar: Extracting \"'gnuplot/term/next.trm'\" \(11383 characters\)
  1686.   sed "s/^X//" >'gnuplot/term/next.trm' <<'END_OF_FILE'
  1687. X/*
  1688. X * $Id: next.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  1689. X *
  1690. X */
  1691. X
  1692. X/* GNUPLOT - next.trm */
  1693. X/*
  1694. X * Copyright (C) 1991, 1992   
  1695. X *
  1696. X * Permission to use, copy, and distribute this software and its
  1697. X * documentation for any purpose with or without fee is hereby granted, 
  1698. X * provided that the above copyright notice appear in all copies and 
  1699. X * that both that copyright notice and this permission notice appear 
  1700. X * in supporting documentation.
  1701. X *
  1702. X * Permission to modify the software is granted, but not the right to
  1703. X * distribute the modified code.  Modifications are to be distributed 
  1704. X * as patches to released version.
  1705. X *  
  1706. X * This software  is provided "as is" without express or implied warranty.
  1707. X * 
  1708. X * This file is included by ../term.c.
  1709. X *
  1710. X * This terminal driver supports:
  1711. X *     next
  1712. X *
  1713. X * AUTHORS
  1714. X *  Nick Strobel from Russell Lang's post.trm
  1715. X * 
  1716. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  1717. X *
  1718. X * The 'postscript' driver produces landscape output 10" wide and 7" high.  
  1719. X * To get a smaller epsf output use 'set size 0.5,0.5', 
  1720. X * 'set term postscript portrait', make only one plot per file
  1721. X * and change the first line of the postscript file from
  1722. X * '%!PS-Adobe-2.0' to '%!PS-Adobe-2.0 EPSF-2.0'
  1723. X * To change font to Times-Roman and font size to 20pts use 
  1724. X * 'set term postscript "Times-Roman" 20'.
  1725. X */
  1726. X
  1727. X
  1728. X/* NeXT driver by Nick Strobel, strobel@phast.phys.washington.edu */
  1729. X#import <math.h>
  1730. X#import <dpsclient/dpsclient.h>
  1731. X#import <dpsclient/dpsNeXT.h>
  1732. X#import <stdlib.h>
  1733. X#import "../epsviewe.h"
  1734. X
  1735. XDPSContext d;
  1736. Xstatic void window_create(float width, float height);
  1737. Xfloat width,height;    
  1738. Xfloat xsize_orig,ysize_orig;  
  1739. X
  1740. Xchar next_font[MAX_ID_LEN+1] = "Helvetica" ; /* name of font */
  1741. Xint next_fontsize = 14;                     /* size of font in pts */
  1742. XTBOOLEAN next_portrait = FALSE;                 /* vertical page */
  1743. XTBOOLEAN next_color = FALSE;
  1744. XTBOOLEAN init_called = FALSE;
  1745. XTBOOLEAN initframe_called = FALSE;
  1746. X
  1747. Xint next_page=0;            /* page count */
  1748. Xint next_path_count=0;     /* count of lines in path */
  1749. Xint next_ang=0;            /* text angle */
  1750. Xenum JUSTIFY next_justify=LEFT;    /* text is flush left */
  1751. X
  1752. Xchar *NEXT_header[] = {
  1753. X"/vpt2 vpt 2 mul def\n",
  1754. X"/hpt2 hpt 2 mul def\n",
  1755. X/* flush left show */
  1756. X"/Lshow { currentpoint stroke moveto\n",
  1757. X"  0 vshift rmoveto show } def\n", 
  1758. X/* flush right show */
  1759. X"/Rshow { currentpoint stroke moveto\n",
  1760. X"  dup stringwidth pop neg vshift rmoveto show } def\n", 
  1761. X/* centred show */
  1762. X"/Cshow { currentpoint stroke moveto\n",
  1763. X"  dup stringwidth pop -2 div vshift rmoveto show } def\n", 
  1764. X/* Dash or Color Line */
  1765. X"/DL { Color {setrgbcolor [] 0 setdash pop}\n",
  1766. X" {pop pop pop 0 setdash} ifelse } def\n",
  1767. X/* Border Lines */
  1768. X"/BL { stroke gnulinewidth 2 mul setlinewidth } def\n",
  1769. X/* Axes Lines */
  1770. X"/AL { stroke gnulinewidth 2 div setlinewidth } def\n",
  1771. X/* Plot Lines */
  1772. X"/PL { stroke gnulinewidth setlinewidth } def\n",
  1773. X/* Line Types */
  1774. X"/LTb { BL [] 0 0 0 DL } def\n", /* border */
  1775. X"/LTa { AL [1 dl 2 dl] 0 setdash 0 0 0 setrgbcolor } def\n", /* axes */
  1776. X"/LT0 { PL [] 0 1 0 DL } def\n",
  1777. X"/LT1 { PL [4 dl 2 dl] 0 0 1 DL } def\n",
  1778. X"/LT2 { PL [2 dl 3 dl] 1 0 0 DL } def\n",
  1779. X"/LT3 { PL [1 dl 1.5 dl] 1 0 1 DL } def\n",
  1780. X"/LT4 { PL [5 dl 2 dl 1 dl 2 dl] 0 1 1 DL } def\n",
  1781. X"/LT5 { PL [4 dl 3 dl 1 dl 3 dl] 1 1 0 DL } def\n",
  1782. X"/LT6 { PL [2 dl 2 dl 2 dl 4 dl] 0 0 0 DL } def\n",
  1783. X"/LT7 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 1 0.3 0 DL } def\n",
  1784. X"/LT8 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 0.5 0.5 0.5 DL } def\n",
  1785. X"/M {moveto} def\n",
  1786. X"/L {lineto} def\n",
  1787. X"/P { stroke [] 0 setdash\n", /* Point */
  1788. X"  currentlinewidth 2 div sub moveto\n",
  1789. X"  0 currentlinewidth rlineto  stroke } def\n",
  1790. X"/D { stroke [] 0 setdash  2 copy  vpt add moveto\n", /* Diamond */
  1791. X"  hpt neg vpt neg rlineto  hpt vpt neg rlineto\n",
  1792. X"  hpt vpt rlineto  hpt neg vpt rlineto  closepath  stroke\n",
  1793. X"  P  } def\n",
  1794. X"/A { stroke [] 0 setdash  vpt sub moveto  0 vpt2 rlineto\n", /* Plus (Add) */
  1795. X"  currentpoint stroke moveto\n",
  1796. X"  hpt neg vpt neg rmoveto  hpt2 0 rlineto stroke\n",
  1797. X"  } def\n",
  1798. X"/B { stroke [] 0 setdash  2 copy  exch hpt sub exch vpt add moveto\n", /* Box */
  1799. X"  0 vpt2 neg rlineto  hpt2 0 rlineto  0 vpt2 rlineto\n",
  1800. X"  hpt2 neg 0 rlineto  closepath  stroke\n",
  1801. X"  P  } def\n",
  1802. X"/C { stroke [] 0 setdash  exch hpt sub exch vpt add moveto\n", /* Cross */
  1803. X"  hpt2 vpt2 neg rlineto  currentpoint  stroke  moveto\n",
  1804. X"  hpt2 neg 0 rmoveto  hpt2 vpt2 rlineto stroke  } def\n",
  1805. X"/T { stroke [] 0 setdash  2 copy  vpt 1.12 mul add moveto\n", /* Triangle */
  1806. X"  hpt neg vpt -1.62 mul rlineto\n",
  1807. X"  hpt 2 mul 0 rlineto\n",
  1808. X"  hpt neg vpt 1.62 mul rlineto  closepath  stroke\n",
  1809. X"  P  } def\n",
  1810. X"/S { 2 copy A C} def\n", /* Star */
  1811. XNULL
  1812. X};
  1813. X
  1814. X#define NEXT_XOFF    50    /* page offset in pts */
  1815. X#define NEXT_YOFF    50
  1816. X
  1817. X#define NEXT_XMAX 7200
  1818. X#define NEXT_YMAX 5040
  1819. X
  1820. X#define NEXT_XLAST (NEXT_XMAX - 1)
  1821. X#define NEXT_YLAST (NEXT_YMAX - 1)
  1822. X
  1823. X#define NEXT_VTIC (NEXT_YMAX/80)
  1824. X#define NEXT_HTIC (NEXT_YMAX/80)
  1825. X
  1826. X#define NEXT_SC (10)                /* scale is 1pt = 10 units */
  1827. X#define    NEXT_LW (0.5*NEXT_SC)        /* linewidth = 0.5 pts */
  1828. X
  1829. X#define NEXT_VCHAR (14*NEXT_SC)        /* default is 14 point characters */
  1830. X#define NEXT_HCHAR (14*NEXT_SC*6/10)
  1831. X
  1832. XNEXT_options()
  1833. X{
  1834. X    extern struct value *const_express();
  1835. X    extern double real();
  1836. X
  1837. X    if (!END_OF_COMMAND) {
  1838. X        if (almost_equals(c_token,"p$ortrait")) {
  1839. X            next_portrait=TRUE;
  1840. X            c_token++;
  1841. X        }
  1842. X        else if (almost_equals(c_token,"l$andscape")) {
  1843. X            next_portrait=FALSE;
  1844. X            c_token++;
  1845. X        }
  1846. X        else if (almost_equals(c_token,"d$efault")) {
  1847. X            next_portrait=FALSE;
  1848. X            next_color=FALSE;
  1849. X            strcpy(next_font,"Helvetica");
  1850. X            next_fontsize = 14;
  1851. X            c_token++;
  1852. X        }
  1853. X    }
  1854. X
  1855. X    if (!END_OF_COMMAND) {
  1856. X        if (almost_equals(c_token,"m$onochrome")) {
  1857. X            next_color=FALSE;
  1858. X            c_token++;
  1859. X        }
  1860. X        else if (almost_equals(c_token,"c$olor")) {
  1861. X            next_color=TRUE;
  1862. X            c_token++;
  1863. X        }
  1864. X    }
  1865. X
  1866. X    if (!END_OF_COMMAND && isstring(c_token)) {
  1867. X        quote_str(next_font,c_token);
  1868. X        c_token++;
  1869. X    }
  1870. X
  1871. X    if (!END_OF_COMMAND) {
  1872. X        /* We have font size specified */
  1873. X        struct value a;
  1874. X        next_fontsize = (int)real(const_express(&a));
  1875. X        c_token++;
  1876. X        term_tbl[term].v_char = (unsigned int)(next_fontsize*NEXT_SC);
  1877. X        term_tbl[term].h_char = (unsigned int)(next_fontsize*NEXT_SC*6/10);
  1878. X    }
  1879. X
  1880. X    sprintf(term_options,"%s %s \"%s\" %d",
  1881. X        next_portrait ? "portrait" : "landscape",
  1882. X        next_color ? "color" : "monochrome",next_font,next_fontsize);
  1883. X}
  1884. X
  1885. X
  1886. XNEXT_init()
  1887. X{
  1888. Xstruct termentry *t = &term_tbl[term];
  1889. Xint i;
  1890. Xfloat llx,lly,urx,ury;
  1891. X/* I commented out the postscript comment fields because they are not really 
  1892. X*  needed (even the bounding box). However, if you'd like to send all the
  1893. X*  postscript to the context d, they're still there for you
  1894. X*/
  1895. X
  1896. X        llx=NEXT_XOFF;
  1897. X        lly=NEXT_YOFF;
  1898. X
  1899. X    if(!initframe_called) {
  1900. X        if(!next_portrait){
  1901. X            urx=(xsize*(NEXT_XMAX)/NEXT_SC+0.5+NEXT_XOFF);
  1902. X            ury=(ysize*(NEXT_YMAX)/NEXT_SC+0.5+NEXT_YOFF);
  1903. X        } else {
  1904. X            urx=(ysize*(NEXT_YMAX)/NEXT_SC+0.5+NEXT_XOFF);
  1905. X            ury=(xsize*(NEXT_XMAX)/NEXT_SC+0.5+NEXT_YOFF);
  1906. X        }
  1907. X          width=urx-llx;    
  1908. X          height=ury-lly;
  1909. X          xsize_orig=xsize;
  1910. X          ysize_orig=ysize;    
  1911. X          window_create(width,height);
  1912. X             d=DPSGetCurrentContext();
  1913. X       DPSPrintf(d,"/showpage {initgraphics} bind def\n");
  1914. X      }
  1915. X        DPSPrintf(d,"1 setgray\n");
  1916. X        DPSPrintf(d,"0 1 %g %g rectfill\n",rint(width),rint(height));
  1917. X        DPSPrintf(d,"0 setgray\n");
  1918. X        DPSPrintf(d,"0 1 %g %g rectstroke\n",rint(width),rint(height));
  1919. X//           DPSPrintf(d,"/_the_saved_vm_ save def\n");
  1920. X        DPSPrintf(d,"%g %g translate\n",-llx,-lly); /* KEEP this IN! */
  1921. X
  1922. X//        DPSPrintf(d,"%%!PS-ADOBE-2.0 EPSF-2.0\n");
  1923. X//        DPSPrintf(d,"%%%%Creator: gnuplot\n");
  1924. X//        DPSPrintf(d,"%%%%DocumentFonts: %s\n", next_font);
  1925. X//        DPSPrintf(d,"%%%%BoundingBox: %d %d ", NEXT_XOFF,NEXT_YOFF);
  1926. X//        if (!next_portrait)
  1927. X//            DPSPrintf(d,"%d %d\n",(int)width, (int)height);
  1928. X//        else 
  1929. X//            DPSPrintf(d,"%d %d\n",(int)width, (int)height);
  1930. X//        DPSPrintf(d,"%%%%Pages: (atend)\n");
  1931. X//        DPSPrintf(d,"%%%%EndComments\n");
  1932. X        DPSPrintf(d,"/gnudict 40 dict def\ngnudict begin\n");
  1933. X        DPSPrintf(d,"/Color %s def\n",next_color ? "true" : "false");
  1934. X        DPSPrintf(d,"/gnulinewidth %.3f def\n",NEXT_LW);
  1935. X        DPSPrintf(d,"/vshift %d def\n", (int)(t->v_char)/(-3));
  1936. X        DPSPrintf(d,"/dl {%d mul} def\n",NEXT_SC); /* dash length */
  1937. X        DPSPrintf(d,"/hpt %.1f def\n",NEXT_HTIC/2.0);
  1938. X        DPSPrintf(d,"/vpt %.1f def\n",NEXT_VTIC/2.0);
  1939. X        for ( i=0; NEXT_header[i] != NULL; i++)
  1940. X            DPSPrintf(d,"%s",NEXT_header[i]);
  1941. X        DPSPrintf(d,"end\n");
  1942. X//        DPSPrintf(d,"%%%%EndProlog\n");
  1943. X        init_called=TRUE;
  1944. X}
  1945. X
  1946. Xstatic void window_create(float width, float height)
  1947. X{
  1948. X    initframe_called=TRUE;
  1949. X    
  1950. X    NXApp=[EpsViewer new];
  1951. X    [NXApp windowCreate:width Height:height];
  1952. X}
  1953. X
  1954. XNEXT_graphics()
  1955. X{
  1956. Xstruct termentry *t = &term_tbl[term];
  1957. X    next_page++;
  1958. X    if(!init_called)
  1959. X        NEXT_init();    /* set up the frame properly */
  1960. X    init_called=FALSE;
  1961. X//    DPSPrintf(d,"%%%%Page: %d %d\n",next_page,next_page);
  1962. X    DPSPrintf(d,"gnudict begin\n");
  1963. X    DPSPrintf(d,"gsave\n");
  1964. X    DPSPrintf(d,"%d %d translate\n",NEXT_XOFF,NEXT_YOFF);
  1965. X    if (!next_portrait) {
  1966. X/* keep plot entirely in the window */
  1967. X        if(xsize>xsize_orig)
  1968. X            xsize=xsize_orig;
  1969. X        if(ysize>ysize_orig)
  1970. X            ysize=ysize_orig;
  1971. X        DPSPrintf(d,"%.3f %.3f scale\n", xsize/NEXT_SC, ysize/NEXT_SC);
  1972. X    }
  1973. X    else {
  1974. X        if(xsize>xsize_orig)
  1975. X            xsize=xsize_orig;
  1976. X        if(ysize>ysize_orig)
  1977. X            ysize=ysize_orig;
  1978. X        DPSPrintf(d,"%.3f %.3f scale\n", ysize/NEXT_SC, xsize/NEXT_SC);
  1979. X        DPSPrintf(d,"90 rotate\n0 %d translate\n", -NEXT_YMAX);
  1980. X    }
  1981. X    DPSPrintf(d,"0 setgray\n");
  1982. X    DPSPrintf(d,"/%s findfont %d ", next_font, (t->v_char) );
  1983. X    DPSPrintf(d,"scalefont setfont\n");
  1984. X    DPSPrintf(d,"newpath\n");
  1985. X    next_path_count = 0;    
  1986. X}
  1987. X
  1988. X
  1989. XNEXT_text()
  1990. X{
  1991. X    next_path_count = 0;
  1992. X    DPSPrintf(d,"stroke\ngrestore\nend\nshowpage\n");
  1993. X//    DPSPrintf(d,"\ngrestoreall _the_saved_vm_ restore\n");
  1994. X        
  1995. X    DPSFlushContext(d);
  1996. X    
  1997. X    
  1998. X}
  1999. X
  2000. X
  2001. XNEXT_reset()
  2002. X{    
  2003. X    DPSPrintf(d,"currentwindow termwindow\n");
  2004. X    DPSPrintf(d,"nulldevice\n");
  2005. X
  2006. X    DPSFlushContext(d);
  2007. X    initframe_called=FALSE;
  2008. X}
  2009. X
  2010. X
  2011. XNEXT_linetype(linetype)
  2012. Xint linetype;
  2013. X{
  2014. Xchar *line = "ba012345678"; 
  2015. X    DPSPrintf(d,"LT%c\n", line[(linetype%9)+2]);
  2016. X    next_path_count = 0;
  2017. X}
  2018. X
  2019. X
  2020. XNEXT_move(x,y)
  2021. Xunsigned int x,y;
  2022. X{
  2023. X    DPSPrintf(d,"%d %d M\n", x, y);
  2024. X    next_path_count += 1;
  2025. X}
  2026. X
  2027. X
  2028. XNEXT_vector(x,y)
  2029. Xunsigned int x,y;
  2030. X{
  2031. X    DPSPrintf(d,"%d %d L\n", x, y);
  2032. X    next_path_count += 1;
  2033. X    if (next_path_count >= 400) {
  2034. X        DPSPrintf(d,"currentpoint stroke moveto\n");
  2035. X        next_path_count = 0;
  2036. X    }
  2037. X}
  2038. X
  2039. X
  2040. XNEXT_put_text(x,y,str)
  2041. Xunsigned int x, y;
  2042. Xchar *str;
  2043. X{
  2044. Xchar ch;
  2045. X    NEXT_move(x,y);
  2046. X    if (next_ang != 0)
  2047. X        DPSPrintf(d,"currentpoint gsave translate %d rotate 0 0 moveto\n"
  2048. X            ,next_ang*90);
  2049. X/*    NXPutc(psStream,'(');            */
  2050. X    DPSPrintf(d,"%c",'(');
  2051. X    ch = *str++;
  2052. X    while(ch!='\0') {
  2053. X        if ( (ch=='(') || (ch==')') || (ch=='\\') )
  2054. X/*            NXPutc(psStream,'\\');
  2055. X        NXPutc(psStream,ch);            */
  2056. X            DPSPrintf(d,"%c",'\\');
  2057. X        DPSPrintf(d,"%c",ch);
  2058. X        ch = *str++;
  2059. X    }
  2060. X    switch(next_justify) {
  2061. X        case LEFT : DPSPrintf(d,") Lshow\n");
  2062. X            break;
  2063. X        case CENTRE : DPSPrintf(d,") Cshow\n");
  2064. X            break;
  2065. X        case RIGHT : DPSPrintf(d,") Rshow\n");
  2066. X            break;
  2067. X    }
  2068. X    if (next_ang != 0)
  2069. X        DPSPrintf(d,"grestore\n");
  2070. X    next_path_count = 0;
  2071. X}
  2072. X
  2073. Xint NEXT_text_angle(ang)
  2074. Xint ang;
  2075. X{
  2076. X    next_ang=ang;
  2077. X    return TRUE;
  2078. X}
  2079. X
  2080. Xint NEXT_justify_text(mode)
  2081. Xenum JUSTIFY mode;
  2082. X{
  2083. X    next_justify=mode;
  2084. X    return TRUE;
  2085. X}
  2086. X
  2087. X/* postscript point routines */
  2088. XNEXT_point(x,y,number)
  2089. Xint x,y;
  2090. Xint number;
  2091. X{
  2092. Xchar *point = "PDABCTS";
  2093. X    number %= POINT_TYPES;
  2094. X     if (number < -1)
  2095. X        number = -1;        /* negative types are all 'dot' */
  2096. X    DPSPrintf(d,"%d %d %c\n", x, y, point[number+1]);
  2097. X    next_path_count = 0;
  2098. X}
  2099. X
  2100. END_OF_FILE
  2101.   if test 11383 -ne `wc -c <'gnuplot/term/next.trm'`; then
  2102.     echo shar: \"'gnuplot/term/next.trm'\" unpacked with wrong size!
  2103.   fi
  2104.   # end of 'gnuplot/term/next.trm'
  2105. fi
  2106. if test -f 'gnuplot/util.c' -a "${1}" != "-c" ; then 
  2107.   echo shar: Will not clobber existing file \"'gnuplot/util.c'\"
  2108. else
  2109.   echo shar: Extracting \"'gnuplot/util.c'\" \(12972 characters\)
  2110.   sed "s/^X//" >'gnuplot/util.c' <<'END_OF_FILE'
  2111. X#ifndef lint
  2112. Xstatic char *RCSid = "$Id: util.c%v 3.50 1993/07/09 05:35:24 woo Exp $";
  2113. X#endif
  2114. X
  2115. X
  2116. X/* GNUPLOT - util.c */
  2117. X/*
  2118. X * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  2119. X *
  2120. X * Permission to use, copy, and distribute this software and its
  2121. X * documentation for any purpose with or without fee is hereby granted, 
  2122. X * provided that the above copyright notice appear in all copies and 
  2123. X * that both that copyright notice and this permission notice appear 
  2124. X * in supporting documentation.
  2125. X *
  2126. X * Permission to modify the software is granted, but not the right to
  2127. X * distribute the modified code.  Modifications are to be distributed 
  2128. X * as patches to released version.
  2129. X *  
  2130. X * This software is provided "as is" without express or implied warranty.
  2131. X * 
  2132. X *
  2133. X * AUTHORS
  2134. X * 
  2135. X *   Original Software:
  2136. X *     Thomas Williams,  Colin Kelley.
  2137. X * 
  2138. X *   Gnuplot 2.0 additions:
  2139. X *       Russell Lang, Dave Kotz, John Campbell.
  2140. X *
  2141. X *   Gnuplot 3.0 additions:
  2142. X *       Gershon Elber and many others.
  2143. X * 
  2144. X */
  2145. X
  2146. X#include <ctype.h>
  2147. X#include <setjmp.h>
  2148. X#include <stdio.h>
  2149. X#include <errno.h>
  2150. X#include "plot.h"
  2151. X
  2152. XTBOOLEAN screen_ok;
  2153. X    /* TRUE if command just typed; becomes FALSE whenever we
  2154. X        send some other output to screen.  If FALSE, the command line
  2155. X        will be echoed to the screen before the ^ error message. */
  2156. X
  2157. X#ifndef vms
  2158. X#if !defined(__ZTC__) && !defined(__PUREC__)
  2159. X#if !defined(__MSC__)
  2160. Xextern int errno;
  2161. X#endif
  2162. Xextern int sys_nerr;
  2163. Xextern char *sys_errlist[];
  2164. X#endif
  2165. X#endif /* vms */
  2166. X
  2167. Xextern char input_line[];
  2168. Xextern struct lexical_unit token[];
  2169. X#ifdef _Windows
  2170. Xextern jmp_buf far env;    /* from plot.c */
  2171. X#else
  2172. Xextern jmp_buf env;    /* from plot.c */
  2173. X#endif
  2174. Xextern int inline_num;        /* from command.c */
  2175. Xextern TBOOLEAN interactive;    /* from plot.c */
  2176. Xextern char *infile_name;    /* from plot.c */
  2177. X
  2178. X#ifdef sequent
  2179. Xextern char *index();
  2180. X#else
  2181. Xextern char *strchr();
  2182. X#endif
  2183. X
  2184. X#ifndef AMIGA_AC_5
  2185. Xextern double sqrt(), atan2();
  2186. X#endif
  2187. X
  2188. X/*
  2189. X * chr_in_str() compares the characters in the string of token number t_num
  2190. X * with c, and returns TRUE if a match was found.
  2191. X */
  2192. Xchr_in_str(t_num, c)
  2193. Xint t_num;
  2194. Xchar c;
  2195. X{
  2196. Xregister int i;
  2197. X
  2198. X    if (!token[t_num].is_token)
  2199. X        return(FALSE);                /* must be a value--can't be equal */
  2200. X    for (i = 0; i < token[t_num].length; i++) {
  2201. X        if (input_line[token[t_num].start_index+i] == c)
  2202. X            return(TRUE);
  2203. X        }
  2204. X    return FALSE;
  2205. X}
  2206. X
  2207. X
  2208. X/*
  2209. X * equals() compares string value of token number t_num with str[], and
  2210. X *   returns TRUE if they are identical.
  2211. X */
  2212. Xequals(t_num, str)
  2213. Xint t_num;
  2214. Xchar *str;
  2215. X{
  2216. Xregister int i;
  2217. X
  2218. X    if (!token[t_num].is_token)
  2219. X        return(FALSE);                /* must be a value--can't be equal */
  2220. X    for (i = 0; i < token[t_num].length; i++) {
  2221. X        if (input_line[token[t_num].start_index+i] != str[i])
  2222. X            return(FALSE);
  2223. X        }
  2224. X    /* now return TRUE if at end of str[], FALSE if not */
  2225. X    return(str[i] == '\0');
  2226. X}
  2227. X
  2228. X
  2229. X
  2230. X/*
  2231. X * almost_equals() compares string value of token number t_num with str[], and
  2232. X *   returns TRUE if they are identical up to the first $ in str[].
  2233. X */
  2234. Xalmost_equals(t_num, str)
  2235. Xint t_num;
  2236. Xchar *str;
  2237. X{
  2238. Xregister int i;
  2239. Xregister int after = 0;
  2240. Xregister start = token[t_num].start_index;
  2241. Xregister length = token[t_num].length;
  2242. X
  2243. X    if (!token[t_num].is_token)
  2244. X        return(FALSE);                /* must be a value--can't be equal */
  2245. X    for (i = 0; i < length + after; i++) {
  2246. X        if (str[i] != input_line[start + i]) {
  2247. X            if (str[i] != '$')
  2248. X                return(FALSE);
  2249. X            else {
  2250. X                after = 1;
  2251. X                start--;    /* back up token ptr */
  2252. X                }
  2253. X            }
  2254. X        }
  2255. X
  2256. X    /* i now beyond end of token string */
  2257. X
  2258. X    return(after || str[i] == '$' || str[i] == '\0');
  2259. X}
  2260. X
  2261. X
  2262. X
  2263. Xisstring(t_num)
  2264. Xint t_num;
  2265. X{
  2266. X    
  2267. X    return(token[t_num].is_token &&
  2268. X           (input_line[token[t_num].start_index] == '\'' ||
  2269. X           input_line[token[t_num].start_index] == '\"'));
  2270. X}
  2271. X
  2272. X
  2273. Xisnumber(t_num)
  2274. Xint t_num;
  2275. X{
  2276. X    return(!token[t_num].is_token);
  2277. X}
  2278. X
  2279. X
  2280. Xisletter(t_num)
  2281. Xint t_num;
  2282. X{
  2283. X    return(token[t_num].is_token &&
  2284. X            ((isalpha(input_line[token[t_num].start_index]))||
  2285. X             (input_line[token[t_num].start_index] == '_')));
  2286. X}
  2287. X
  2288. X
  2289. X/*
  2290. X * is_definition() returns TRUE if the next tokens are of the form
  2291. X *   identifier =
  2292. X *        -or-
  2293. X *   identifier ( identifer {,identifier} ) =
  2294. X */
  2295. Xis_definition(t_num)
  2296. Xint t_num;
  2297. X{
  2298. X    /* variable? */
  2299. X    if(isletter(t_num) && equals(t_num+1,"="))
  2300. X        return 1;
  2301. X
  2302. X    /* function? */
  2303. X    /* look for dummy variables */
  2304. X    if(isletter(t_num) && equals(t_num+1,"(") && isletter(t_num+2)) {
  2305. X        t_num += 3;  /* point past first dummy */
  2306. X        while(equals(t_num,",")) {
  2307. X            if(!isletter(++t_num))
  2308. X                return 0;
  2309. X            t_num += 1;
  2310. X        }
  2311. X        return(equals(t_num,")") && equals(t_num+1,"="));
  2312. X    }
  2313. X
  2314. X    /* neither */
  2315. X    return 0;
  2316. X}
  2317. X
  2318. X
  2319. X
  2320. X/*
  2321. X * copy_str() copies the string in token number t_num into str, appending
  2322. X *   a null.  No more than MAX_ID_LEN chars are copied.
  2323. X */
  2324. Xcopy_str(str, t_num)
  2325. Xchar str[];
  2326. Xint t_num;
  2327. X{
  2328. Xregister int i = 0;
  2329. Xregister int start = token[t_num].start_index;
  2330. Xregister int count;
  2331. X
  2332. X    if ((count = token[t_num].length) > MAX_ID_LEN)
  2333. X        count = MAX_ID_LEN;
  2334. X    do {
  2335. X        str[i++] = input_line[start++];
  2336. X        } while (i != count);
  2337. X    str[i] = '\0';
  2338. X}
  2339. X
  2340. X
  2341. X/*
  2342. X * quote_str() does the same thing as copy_str, except it ignores the
  2343. X *   quotes at both ends.  This seems redundant, but is done for
  2344. X *   efficency.
  2345. X */
  2346. Xquote_str(str, t_num)
  2347. Xchar str[];
  2348. Xint t_num;
  2349. X{
  2350. Xregister int i = 0;
  2351. Xregister int start = token[t_num].start_index + 1;
  2352. Xregister int count;
  2353. X
  2354. X    if ((count = token[t_num].length - 2) > MAX_ID_LEN)
  2355. X        count = MAX_ID_LEN;
  2356. X    if (count>0) {
  2357. X        do {
  2358. X            str[i++] = input_line[start++];
  2359. X            } while (i != count);
  2360. X    }
  2361. X    str[i] = '\0';
  2362. X}
  2363. X
  2364. X
  2365. X/*
  2366. X * quotel_str() does the same thing as quote_str, except it uses
  2367. X * MAX_LINE_LEN instead of MAX_ID_LEN. 
  2368. X */ 
  2369. Xquotel_str(str, t_num) 
  2370. Xchar str[]; 
  2371. Xint t_num; 
  2372. X{
  2373. Xregister int i = 0;
  2374. Xregister int start = token[t_num].start_index + 1;
  2375. Xregister int count;
  2376. X
  2377. X    if ((count = token[t_num].length - 2) > MAX_LINE_LEN)
  2378. X        count = MAX_LINE_LEN;
  2379. X    if (count>0) {
  2380. X        do {
  2381. X            str[i++] = input_line[start++];
  2382. X            } while (i != count);
  2383. X    }
  2384. X    str[i] = '\0';
  2385. X}
  2386. X
  2387. X
  2388. X/*
  2389. X *    capture() copies into str[] the part of input_line[] which lies between
  2390. X *    the begining of token[start] and end of token[end].
  2391. X */
  2392. Xcapture(str,start,end)
  2393. Xchar str[];
  2394. Xint start,end;
  2395. X{
  2396. Xregister int i,e;
  2397. X
  2398. X    e = token[end].start_index + token[end].length;
  2399. X    for (i = token[start].start_index; i < e && input_line[i] != '\0'; i++)
  2400. X        *str++ = input_line[i];
  2401. X    *str = '\0';
  2402. X}
  2403. X
  2404. X
  2405. X/*
  2406. X *    m_capture() is similar to capture(), but it mallocs storage for the
  2407. X *  string.
  2408. X */
  2409. Xm_capture(str,start,end)
  2410. Xchar **str;
  2411. Xint start,end;
  2412. X{
  2413. Xregister int i,e;
  2414. Xregister char *s;
  2415. X
  2416. X    if (*str)        /* previous pointer to malloc'd memory there */
  2417. X        free(*str);
  2418. X    e = token[end].start_index + token[end].length;
  2419. X    *str = alloc((unsigned long)(e - token[start].start_index + 1), "string");
  2420. X     s = *str;
  2421. X     for (i = token[start].start_index; i < e && input_line[i] != '\0'; i++)
  2422. X      *s++ = input_line[i];
  2423. X     *s = '\0';
  2424. X}
  2425. X
  2426. X
  2427. X/*
  2428. X *    m_quote_capture() is similar to m_capture(), but it removes
  2429. X    quotes from either end if the string.
  2430. X */
  2431. Xm_quote_capture(str,start,end)
  2432. Xchar **str;
  2433. Xint start,end;
  2434. X{
  2435. Xregister int i,e;
  2436. Xregister char *s;
  2437. X
  2438. X    if (*str)        /* previous pointer to malloc'd memory there */
  2439. X        free(*str);
  2440. X    e = token[end].start_index + token[end].length-1;
  2441. X    *str = alloc((unsigned long)(e - token[start].start_index + 1), "string");
  2442. X     s = *str;
  2443. X    for (i = token[start].start_index + 1; i < e && input_line[i] != '\0'; i++)
  2444. X     *s++ = input_line[i];
  2445. X    *s = '\0';
  2446. X}
  2447. X
  2448. X
  2449. Xconvert(val_ptr, t_num)
  2450. Xstruct value *val_ptr;
  2451. Xint t_num;
  2452. X{
  2453. X    *val_ptr = token[t_num].l_val;
  2454. X}
  2455. X
  2456. Xstatic char *num_to_str(r)
  2457. Xdouble r;
  2458. X{
  2459. X    static i = 0;
  2460. X    static char s[4][20];
  2461. X    int j = i++;
  2462. X
  2463. X    if ( i > 3 ) i = 0;
  2464. X
  2465. X    sprintf( s[j], "%g", r );
  2466. X#ifdef sequent
  2467. X    if ( index( s[j], '.' ) == NULL &&
  2468. X         index( s[j], 'e' ) == NULL &&
  2469. X         index( s[j], 'E' ) == NULL )
  2470. X#else
  2471. X    if ( strchr( s[j], '.' ) == NULL &&
  2472. X         strchr( s[j], 'e' ) == NULL &&
  2473. X         strchr( s[j], 'E' ) == NULL )
  2474. X#endif
  2475. X        strcat( s[j], ".0" );
  2476. X
  2477. X    return s[j];
  2478. X} 
  2479. X
  2480. Xdisp_value(fp,val)
  2481. XFILE *fp;
  2482. Xstruct value *val;
  2483. X{
  2484. X    switch(val->type) {
  2485. X        case INTGR:
  2486. X            fprintf(fp,"%d",val->v.int_val);
  2487. X            break;
  2488. X        case CMPLX:
  2489. X            if (val->v.cmplx_val.imag != 0.0 )
  2490. X                fprintf(fp,"{%s, %s}",
  2491. X                    num_to_str(val->v.cmplx_val.real),
  2492. X                    num_to_str(val->v.cmplx_val.imag));
  2493. X            else
  2494. X                fprintf(fp,"%s",
  2495. X                    num_to_str(val->v.cmplx_val.real));
  2496. X            break;
  2497. X        default:
  2498. X            int_error("unknown type in disp_value()",NO_CARET);
  2499. X    }
  2500. X}
  2501. X
  2502. X
  2503. Xdouble
  2504. Xreal(val)        /* returns the real part of val */
  2505. Xstruct value *val;
  2506. X{
  2507. X    switch(val->type) {
  2508. X        case INTGR:
  2509. X            return((double) val->v.int_val);
  2510. X        case CMPLX:
  2511. X            return(val->v.cmplx_val.real);
  2512. X    }
  2513. X    int_error("unknown type in real()",NO_CARET);
  2514. X    /* NOTREACHED */
  2515. X    return((double)0.0);
  2516. X}
  2517. X
  2518. X
  2519. Xdouble
  2520. Ximag(val)        /* returns the imag part of val */
  2521. Xstruct value *val;
  2522. X{
  2523. X    switch(val->type) {
  2524. X        case INTGR:
  2525. X            return(0.0);
  2526. X        case CMPLX:
  2527. X            return(val->v.cmplx_val.imag);
  2528. X    }
  2529. X    int_error("unknown type in imag()",NO_CARET);
  2530. X    /* NOTREACHED */
  2531. X    return((double)0.0);
  2532. X}
  2533. X
  2534. X
  2535. X
  2536. Xdouble
  2537. Xmagnitude(val)        /* returns the magnitude of val */
  2538. Xstruct value *val;
  2539. X{
  2540. X    switch(val->type) {
  2541. X        case INTGR:
  2542. X            return((double) abs(val->v.int_val));
  2543. X        case CMPLX:
  2544. X            return(sqrt(val->v.cmplx_val.real*
  2545. X                    val->v.cmplx_val.real +
  2546. X                    val->v.cmplx_val.imag*
  2547. X                    val->v.cmplx_val.imag));
  2548. X    }
  2549. X    int_error("unknown type in magnitude()",NO_CARET);
  2550. X    /* NOTREACHED */
  2551. X    return((double)0.0);
  2552. X}
  2553. X
  2554. X
  2555. X
  2556. Xdouble
  2557. Xangle(val)        /* returns the angle of val */
  2558. Xstruct value *val;
  2559. X{
  2560. X    switch(val->type) {
  2561. X        case INTGR:
  2562. X            return((val->v.int_val > 0) ? 0.0 : Pi);
  2563. X        case CMPLX:
  2564. X            if (val->v.cmplx_val.imag == 0.0) {
  2565. X                if (val->v.cmplx_val.real >= 0.0)
  2566. X                    return(0.0);
  2567. X                else
  2568. X                    return(Pi);
  2569. X            }
  2570. X            return(atan2(val->v.cmplx_val.imag,
  2571. X                     val->v.cmplx_val.real));
  2572. X    }
  2573. X    int_error("unknown type in angle()",NO_CARET);
  2574. X    /* NOTREACHED */
  2575. X    return((double)0.0);
  2576. X}
  2577. X
  2578. X
  2579. Xstruct value *
  2580. XGcomplex(a,realpart,imagpart)
  2581. Xstruct value *a;
  2582. Xdouble realpart, imagpart;
  2583. X{
  2584. X    a->type = CMPLX;
  2585. X    a->v.cmplx_val.real = realpart;
  2586. X    a->v.cmplx_val.imag = imagpart;
  2587. X    return(a);
  2588. X}
  2589. X
  2590. X
  2591. Xstruct value *
  2592. XGinteger(a,i)
  2593. Xstruct value *a;
  2594. Xint i;
  2595. X{
  2596. X    a->type = INTGR;
  2597. X    a->v.int_val = i;
  2598. X    return(a);
  2599. X}
  2600. X
  2601. X
  2602. X
  2603. Xos_error(str,t_num)
  2604. Xchar str[];
  2605. Xint t_num;
  2606. X{
  2607. X#ifdef vms
  2608. Xstatic status[2] = {1, 0};        /* 1 is count of error msgs */
  2609. X#endif
  2610. X
  2611. Xregister int i;
  2612. X
  2613. X    /* reprint line if screen has been written to */
  2614. X
  2615. X    if (t_num != NO_CARET) {        /* put caret under error */
  2616. X        if (!screen_ok)
  2617. X            fprintf(stderr,"\n%s%s\n", PROMPT, input_line);
  2618. X
  2619. X        for (i = 0; i < sizeof(PROMPT) - 1; i++)
  2620. X            (void) putc(' ',stderr);
  2621. X        for (i = 0; i < token[t_num].start_index; i++) {
  2622. X            (void) putc((input_line[i] == '\t') ? '\t' : ' ',stderr);
  2623. X            }
  2624. X        (void) putc('^',stderr);
  2625. X        (void) putc('\n',stderr);
  2626. X    }
  2627. X
  2628. X    for (i = 0; i < sizeof(PROMPT) - 1; i++)
  2629. X        (void) putc(' ',stderr);
  2630. X    fprintf(stderr,"%s\n",str);
  2631. X
  2632. X    for (i = 0; i < sizeof(PROMPT) - 1; i++)
  2633. X        (void) putc(' ',stderr);
  2634. X     if (!interactive)
  2635. X      if (infile_name != NULL)
  2636. X        fprintf(stderr,"\"%s\", line %d: ", infile_name, inline_num);
  2637. X      else
  2638. X        fprintf(stderr,"line %d: ", inline_num);
  2639. X
  2640. X
  2641. X#ifdef vms
  2642. X    status[1] = vaxc$errno;
  2643. X    sys$putmsg(status);
  2644. X    (void) putc('\n',stderr);
  2645. X#else
  2646. X#ifdef __ZTC__
  2647. X    fprintf(stderr,"error number %d\n\n",errno);
  2648. X#else
  2649. X    if (errno >= sys_nerr)
  2650. X        fprintf(stderr, "unknown errno %d\n\n", errno);
  2651. X    else
  2652. X        fprintf(stderr,"(%s)\n\n",sys_errlist[errno]);
  2653. X#endif
  2654. X#endif
  2655. X
  2656. X    longjmp(env, TRUE);    /* bail out to command line */
  2657. X}
  2658. X
  2659. X
  2660. Xint_error(str,t_num)
  2661. Xchar str[];
  2662. Xint t_num;
  2663. X{
  2664. Xregister int i;
  2665. X
  2666. X    /* reprint line if screen has been written to */
  2667. X
  2668. X    if (t_num != NO_CARET) {        /* put caret under error */
  2669. X        if (!screen_ok)
  2670. X            fprintf(stderr,"\n%s%s\n", PROMPT, input_line);
  2671. X
  2672. X        for (i = 0; i < sizeof(PROMPT) - 1; i++)
  2673. X            (void) putc(' ',stderr);
  2674. X        for (i = 0; i < token[t_num].start_index; i++) {
  2675. X            (void) putc((input_line[i] == '\t') ? '\t' : ' ',stderr);
  2676. X            }
  2677. X        (void) putc('^',stderr);
  2678. X        (void) putc('\n',stderr);
  2679. X    }
  2680. X
  2681. X    for (i = 0; i < sizeof(PROMPT) - 1; i++)
  2682. X        (void) putc(' ',stderr);
  2683. X     if (!interactive)
  2684. X      if (infile_name != NULL)
  2685. X        fprintf(stderr,"\"%s\", line %d: ", infile_name, inline_num);
  2686. X      else
  2687. X        fprintf(stderr,"line %d: ", inline_num);
  2688. X     fprintf(stderr,"%s\n\n", str);
  2689. X
  2690. X    longjmp(env, TRUE);    /* bail out to command line */
  2691. X}
  2692. X
  2693. X/* Lower-case the given string (DFK) */
  2694. X/* Done in place. */
  2695. Xvoid
  2696. Xlower_case(s)
  2697. X     char *s;
  2698. X{
  2699. X  register char *p = s;
  2700. X
  2701. X  while (*p != '\0') {
  2702. X    if (isupper(*p))
  2703. X     *p = tolower(*p);
  2704. X    p++;
  2705. X  }
  2706. X}
  2707. X
  2708. X/* Squash spaces in the given string (DFK) */
  2709. X/* That is, reduce all multiple white-space chars to single spaces */
  2710. X/* Done in place. */
  2711. Xvoid
  2712. Xsquash_spaces(s)
  2713. X     char *s;
  2714. X{
  2715. X  register char *r = s;        /* reading point */
  2716. X  register char *w = s;        /* writing point */
  2717. X  TBOOLEAN space = FALSE;        /* TRUE if we've already copied a space */
  2718. X
  2719. X  for (w = r = s; *r != '\0'; r++) {
  2720. X     if (isspace(*r)) {
  2721. X        /* white space; only copy if we haven't just copied a space */
  2722. X        if (!space) {
  2723. X            space = TRUE;
  2724. X            *w++ = ' ';
  2725. X        }                /* else ignore multiple spaces */
  2726. X     } else {
  2727. X        /* non-space character; copy it and clear flag */
  2728. X        *w++ = *r;
  2729. X        space = FALSE;
  2730. X     }
  2731. X  }
  2732. X  *w = '\0';                /* null terminate string */
  2733. X}
  2734. END_OF_FILE
  2735.   if test 12972 -ne `wc -c <'gnuplot/util.c'`; then
  2736.     echo shar: \"'gnuplot/util.c'\" unpacked with wrong size!
  2737.   fi
  2738.   # end of 'gnuplot/util.c'
  2739. fi
  2740. if test -f 'gnuplot/win/wgnuplot.mnu' -a "${1}" != "-c" ; then 
  2741.   echo shar: Will not clobber existing file \"'gnuplot/win/wgnuplot.mnu'\"
  2742. else
  2743.   echo shar: Extracting \"'gnuplot/win/wgnuplot.mnu'\" \(11011 characters\)
  2744.   sed "s/^X//" >'gnuplot/win/wgnuplot.mnu' <<'END_OF_FILE'
  2745. X; Menu file for Windows gnuplot
  2746. X; Roger Hadgraft, 26-5-92
  2747. X; Russell Lang, 30 Nov 1992
  2748. X
  2749. X[Menu]
  2750. X&File
  2751. X    &Open ...
  2752. X        load '[OPEN]load[EOS]*.plt[EOS]'{ENTER}
  2753. X    &Save ...
  2754. X        save '[SAVE]save[EOS]*.plt[EOS]'{ENTER}
  2755. X    &Demos ...
  2756. X        load '[OPEN]load[EOS]*.dem[EOS]'{ENTER}
  2757. X    --
  2758. X    &Change Directory ...
  2759. X        cd '[INPUT]New directory?[EOS]'{ENTER}
  2760. X    show Current &Directory
  2761. X        pwd{ENTER}
  2762. X    --
  2763. X    O&utput ...
  2764. X        set output "[INPUT]Output filename?[EOS]"{ENTER}
  2765. X    &Printer Output
  2766. X        set output "PRN"{ENTER}
  2767. X    &Window Output
  2768. X         set output{ENTER}set terminal win{ENTER} 
  2769. X    Show Output
  2770. X        show output{ENTER}
  2771. X    Ou&tput Device ...
  2772. X        set terminal [INPUT]Terminal type?{ENTER}
  2773. X    Show Output Devices
  2774. X        set terminal{ENTER}show terminal{ENTER}
  2775. X    --
  2776. X    [Menu]
  2777. X    History
  2778. X        Previous command    ^P
  2779. X            {^P}
  2780. X        Next command    ^N
  2781. X            {^N}
  2782. X        --
  2783. X        Back one character    ^B
  2784. X            {^B}
  2785. X        Forward one character    ^F
  2786. X            {^F}
  2787. X        --
  2788. X        Beginning of the line    ^A
  2789. X            {^A}
  2790. X        End of the line    ^E
  2791. X            {^E}
  2792. X        --
  2793. X        Delete previous character    ^H
  2794. X            {^H}
  2795. X        Delete current character    ^D
  2796. X            {^D}
  2797. X        Delete last word    ^W
  2798. X            {^W}
  2799. X        Delete to end of line    ^K
  2800. X            {^K}
  2801. X        Delete entire line    ^U
  2802. X            {^U}
  2803. X        --
  2804. X        Redraw the line    ^L
  2805. X            {^L}
  2806. X        [EndMenu]
  2807. X        open DOS window
  2808. X            shell{ENTER}
  2809. X        run DOS command ...
  2810. X            ![INPUT]DOS command?{ENTER}
  2811. X        --
  2812. X        E&xit
  2813. X        quit{ENTER}
  2814. X[EndMenu]
  2815. X
  2816. X[Menu]
  2817. X&Plot
  2818. X    Plot
  2819. X        plot 
  2820. X    3D Plot
  2821. X        splot 
  2822. X    Replot
  2823. X        replot{ENTER}
  2824. X    Clear device
  2825. X        clear{ENTER}
  2826. X    --
  2827. X    Simple Range
  2828. X        [[INPUT]Lower bound?[EOS]:[INPUT]Upper bound?[EOS]] [EOS]
  2829. X    Named Range
  2830. X        [[INPUT]Variable name?[EOS]=[INPUT]Lower bound?[EOS]:[INPUT]Upper bound?[EOS]] [EOS]
  2831. X    --
  2832. X    Data filename ...
  2833. X        '[OPEN]Open[EOS]*.dat[EOS]' [EOS]
  2834. X    using x,y columns
  2835. X        using [INPUT]X column?[EOS]:[INPUT]Y column?[EOS] [EOS]
  2836. X    using x,y,ydelta columns
  2837. X        using [INPUT]X column?[EOS]:[INPUT]Y column?[EOS]:[INPUT]Ydelta column?[EOS] [EOS]
  2838. X    using x,y,ylow,yhigh columns
  2839. X        using [INPUT]X column?[EOS]:[INPUT]Y column?[EOS]:[INPUT]Ylow column?[EOS]:[INPUT]Yhigh column?[EOS] [EOS]
  2840. X    --
  2841. X    [Menu]
  2842. X    with Style
  2843. X        Lines
  2844. X            with lines
  2845. X        Points
  2846. X            with points
  2847. X        Lines and Points
  2848. X            with linespoints
  2849. X        Impulses
  2850. X            with impulses
  2851. X        Dots
  2852. X            with dots
  2853. X        Error Bars
  2854. X            with errorbars
  2855. X        Boxes
  2856. X            with boxes
  2857. X        Box Error Bars
  2858. X            with boxerrorbars
  2859. X    [EndMenu]
  2860. X[EndMenu]
  2861. X
  2862. X[Menu]
  2863. X&Expressions
  2864. X    Evaluate
  2865. X        print 
  2866. X    Complex number ...
  2867. X        {[INPUT]Real part?[EOS],[INPUT]Imaginary part?[EOS]}
  2868. X    --
  2869. X    Exponentiation    **
  2870. X        **
  2871. X;    Multiply    *
  2872. X;        *
  2873. X;    Divide    /
  2874. X;        /
  2875. X;    Add    +
  2876. X;        +
  2877. X;    Subtract    -
  2878. X;        -
  2879. X    --
  2880. X    Modulo    %
  2881. X        %
  2882. X    Equality    ==
  2883. X        ==
  2884. X    Inequality    !=
  2885. X        !=
  2886. X    --
  2887. X    Bitwise AND    &
  2888. X        &
  2889. X    Bitwise exclusive OR    ^
  2890. X        ^
  2891. X    Bitwise inclusive OR    |
  2892. X        |
  2893. X    --
  2894. X    Logical AND    &&
  2895. X        &&
  2896. X    Logical OR    ||
  2897. X        ||
  2898. X;    --
  2899. X;    Ternary operator 1    ?
  2900. X;        ?
  2901. X;    Ternary operator 2    :
  2902. X;        :
  2903. X[EndMenu]
  2904. X
  2905. X[Menu]
  2906. XFu&nctions
  2907. X    abs
  2908. X        abs
  2909. X    arg
  2910. X        arg
  2911. X    imag
  2912. X        imag
  2913. X    real
  2914. X        real
  2915. X    sgn
  2916. X        sgn
  2917. X    --
  2918. X    ceil
  2919. X        ceil
  2920. X    floor
  2921. X        floor
  2922. X    int
  2923. X        int
  2924. X    --
  2925. X    sqrt
  2926. X        sqrt
  2927. X    exp
  2928. X        exp
  2929. X    log
  2930. X        log
  2931. X    log10
  2932. X        log10
  2933. X    |
  2934. X    acos
  2935. X        acos
  2936. X    asin
  2937. X        asin
  2938. X    atan
  2939. X        atan
  2940. X    --
  2941. X    cos
  2942. X        cos
  2943. X    sin
  2944. X        sin
  2945. X    tan
  2946. X        tan
  2947. X    --
  2948. X    cosh
  2949. X        cosh
  2950. X    sinh
  2951. X        sinh
  2952. X    tanh
  2953. X        tanh
  2954. X    --
  2955. X    pi
  2956. X        pi
  2957. X    gamma
  2958. X        gamma
  2959. X    (x)
  2960. X        (x)
  2961. X    |
  2962. X    besj0
  2963. X        besj0
  2964. X    besj1
  2965. X        besj1
  2966. X    --
  2967. X    besy0
  2968. X        besy0
  2969. X    besy1
  2970. X        besy1
  2971. X    --
  2972. X    Define User Function ...
  2973. X        [INPUT]Name for function?[EOS][INPUT]Variable/s, eg. (a,b) ?[EOS]=
  2974. X    Show User Functions
  2975. X        show functions{ENTER}
  2976. X    --
  2977. X    Define User Variable ...
  2978. X        [INPUT]Name for variable?[EOS]=[INPUT]Value, eg. 9.81 ?{ENTER}
  2979. X    Show User Variables
  2980. X        show variables{ENTER}
  2981. X    --
  2982. X    x Dummy variable
  2983. X        set dummy [INPUT]Variable name?{ENTER}
  2984. X    x,y Dummy variables
  2985. X        set dummy [INPUT]Variable names (eg. u,v)?{ENTER}
  2986. X    Show Dummy variables
  2987. X        show dummy{ENTER}
  2988. X[EndMenu]
  2989. X
  2990. X[Menu]
  2991. X&General
  2992. X    Border on
  2993. X        set border{ENTER}
  2994. X    Border off
  2995. X        set noborder{ENTER}
  2996. X    Show Border
  2997. X        show border{ENTER}
  2998. X    --
  2999. X    Box width
  3000. X        set boxwidth [INPUT]Box Width?{ENTER}
  3001. X    Auto Box Width
  3002. X        set boxwidth{ENTER}
  3003. X    Show Box width
  3004. X        show boxwidth{ENTER}
  3005. X    --
  3006. X    Show Line Types
  3007. X        test{ENTER}
  3008. X    --
  3009. X    [Menu]
  3010. X    Parametric
  3011. X        Set Parametric
  3012. X            set parametric{ENTER}
  3013. X        Not Parametric
  3014. X            set noparametric{ENTER}
  3015. X        Show Parametric
  3016. X            show parametric{ENTER}
  3017. X        --
  3018. X        t Range
  3019. X            set trange [[INPUT]Lower bound?[EOS]:[INPUT]Upper bound?[EOS]]{ENTER}
  3020. X        u Range
  3021. X            set urange [[INPUT]Lower bound?[EOS]:[INPUT]Upper bound?[EOS]]{ENTER}
  3022. X        v Range
  3023. X            set vrange [[INPUT]Lower bound?[EOS]:[INPUT]Upper bound?[EOS]]{ENTER}
  3024. X    [EndMenu]
  3025. X    --
  3026. X    [Menu]
  3027. X    Clipping
  3028. X    Clip near points
  3029. X        set clip points{ENTER}
  3030. X    Clip one point
  3031. X        set clip one{ENTER}
  3032. X    Clip two points
  3033. X        set clip two{ENTER}
  3034. X    No Clipping
  3035. X        set noclip{ENTER}
  3036. X    Show Clip type
  3037. X        show clip{ENTER}
  3038. X    [EndMenu]
  3039. X    --
  3040. X    [Menu]
  3041. X    Polar
  3042. X    Polar
  3043. X        set polar{ENTER}
  3044. X    Not Polar
  3045. X        set nopolar{ENTER}
  3046. X    Show Polar
  3047. X        show polar{ENTER}
  3048. X    Radial Range
  3049. X        set rrange [[INPUT]Lower bound?[EOS]:[INPUT]Upper bound?[EOS]]{ENTER}
  3050. X    Angles in Degrees
  3051. X        set angles degrees{ENTER}
  3052. X    Angles in Radians
  3053. X        set angles radians{ENTER}
  3054. X    Show Angle units
  3055. X        show angles{ENTER}
  3056. X    [EndMenu]
  3057. X    --
  3058. X    Set Plot Size
  3059. X        set size [INPUT]Xscale?[EOS],[INPUT]Yscale?{ENTER}
  3060. X    Show Plot Size
  3061. X        show size{ENTER}
  3062. X    --
  3063. X    Sampling Rate
  3064. X        set sample [INPUT]Sampling rate (default=100)?{ENTER}
  3065. X    Show Sampling Rate
  3066. X        show sample{ENTER}
  3067. X[EndMenu]
  3068. X
  3069. X[Menu]
  3070. X&Axes
  3071. X    Autoscale xy
  3072. X        set autoscale [INPUT]Which axes (eg. xy)?{ENTER}
  3073. X    No Autoscale xy
  3074. X        set noautoscale [INPUT]Which axes (eg. xy)?{ENTER}
  3075. X    Show Autoscale
  3076. X        show autoscale{ENTER}
  3077. X    --
  3078. X    Logscale xyz
  3079. X        set logscale [INPUT]Which axes (eg. xy)?{ENTER}
  3080. X    No Logscale xyz
  3081. X        set nologscale [INPUT]Which axes (eg. xy)?{ENTER}
  3082. X    Show Logscale
  3083. X        show logscale{ENTER}
  3084. X    --
  3085. X    [Menu]
  3086. X    Tics
  3087. X        Tic format string
  3088. X            set format [INPUT]Axes?[EOS] "[INPUT]Format string?[EOS]"{ENTER}
  3089. X        Tic marks format
  3090. X            show format{ENTER}
  3091. X        --
  3092. X        Inward facing tics (default)
  3093. X            set tics in{ENTER}
  3094. X        Outward facing tics
  3095. X            set tics out{ENTER}
  3096. X        Show tics
  3097. X            show tics{ENTER}
  3098. X        --
  3099. X        Tics level
  3100. X            set ticslevel [INPUT]Level (default=0.5)?{ENTER}
  3101. X        --
  3102. X        Tic interval
  3103. X            set [INPUT]Axis: x, y or z ?[EOS]tics [INPUT]Start, Increment, End (eg. 0,0.5,10) ?{ENTER}
  3104. X        --
  3105. X        Tic labels start
  3106. X            set [INPUT]Axis: x, y or z ?[EOS]tics ("[INPUT]Label text?[EOS]" [INPUT]Position?[EOS]
  3107. X        another Tic label
  3108. X            ,"[INPUT]Label text?[EOS]" [INPUT]Position?[EOS]
  3109. X        Tic labels finish
  3110. X            ){ENTER}
  3111. X    [EndMenu]
  3112. X    --
  3113. X    X Range
  3114. X        set xrange [[INPUT]Lower bound?[EOS]:[INPUT]Upper bound?[EOS]]{ENTER}
  3115. X    Y Range
  3116. X        set yrange [[INPUT]Lower bound?[EOS]:[INPUT]Upper bound?[EOS]]{ENTER}
  3117. X    Z Range
  3118. X        set zrange [[INPUT]Lower bound?[EOS]:[INPUT]Upper bound?[EOS]]{ENTER}
  3119. X    --
  3120. X    X Label
  3121. X        set xlabel "[INPUT]Label text?[EOS]" [INPUT]X offset, Y offset (eg. 2,3) ?{ENTER}
  3122. X    Y Label
  3123. X        set ylabel "[INPUT]Label text?[EOS]" [INPUT]X offset, Y offset (eg. 2,3) ?{ENTER}
  3124. X    Z Label
  3125. X        set zlabel "[INPUT]Label text?[EOS]" [INPUT]X offset, Y offset (eg. 2,3) ?{ENTER}
  3126. X    Show axis Labels
  3127. X        show xlabel{ENTER}show ylabel{ENTER}show zlabel{ENTER}
  3128. X    --
  3129. X    No X zero axis
  3130. X        set noxzeroaxis{ENTER}
  3131. X    No Y zero axis
  3132. X        set noyzeroaxis{ENTER}
  3133. X    X,Y zero axes on
  3134. X        set zeroaxis{ENTER}
  3135. X    Show zero axis status
  3136. X        show zeroaxis{ENTER}
  3137. X[EndMenu]
  3138. X
  3139. X[Menu]
  3140. X&Chart
  3141. X    Grid on
  3142. X        set grid{ENTER}
  3143. X    Grid off
  3144. X        set nogrid{ENTER}
  3145. X    Show Grid
  3146. X        show grid{ENTER}
  3147. X    --
  3148. X    Add Arrow
  3149. X        set arrow [INPUT]Tag (1-99)?[EOS] from [INPUT]From coordinate?[EOS] to [INPUT]To coordinate?{ENTER}
  3150. X    Remove arrow
  3151. X        set noarrow [INPUT]Tag (1-99)?{ENTER}
  3152. X    Show Arrows
  3153. X        show arrow{ENTER}
  3154. X    --
  3155. X    Add Label
  3156. X        set label [INPUT]Tag?[EOS] "[INPUT]Label?[EOS]" at [INPUT]Coordinate?[EOS] [INPUT]Justification (l,c,r)?{ENTER}
  3157. X    Remove Label
  3158. X        set nolabel [INPUT]Tag?{ENTER}
  3159. X    Show Labels
  3160. X        show label{ENTER}
  3161. X    --
  3162. X    Set Title
  3163. X        set title "[INPUT]Title text?[EOS]" [INPUT]X position, Y position (eg. 2,4)?{ENTER}
  3164. X    Show Title
  3165. X        show title{ENTER}
  3166. X    |
  3167. X    Key (legend) position
  3168. X        set key [INPUT]Key position?{ENTER}
  3169. X    Default Key position
  3170. X        set key{ENTER}
  3171. X    No Key
  3172. X        set nokey{ENTER}
  3173. X    Show Key position
  3174. X        show key{ENTER}
  3175. X    --
  3176. X    Offsets
  3177. X        set offsets [INPUT]Offsets left,right,top,bottom ?{ENTER}
  3178. X    Show Offsets
  3179. X        show offsets{ENTER}
  3180. X    --
  3181. X    Time location
  3182. X        set time [INPUT]Location (eg. 1,1)?{ENTER}
  3183. X    No Time
  3184. X        set notime{ENTER}
  3185. X    Show Time Location
  3186. X        show time{ENTER}
  3187. X[EndMenu]
  3188. X
  3189. X[Menu]
  3190. X&Styles
  3191. X    [Menu]
  3192. X    Data Style
  3193. X    Lines
  3194. X        set data style lines{ENTER}
  3195. X    Points
  3196. X        set data style points{ENTER}
  3197. X    Lines + Points
  3198. X        set data style linespoints{ENTER}
  3199. X    Dots
  3200. X        set data style dots{ENTER}
  3201. X    Impulses
  3202. X        set data style impulses{ENTER}
  3203. X    --
  3204. X    Error Bars
  3205. X        set data style errorbars{ENTER}
  3206. X    Boxes
  3207. X        set data style boxes{ENTER}
  3208. X    Box Error Bars
  3209. X        set data style boxerrorbars{ENTER}
  3210. X    [EndMenu]
  3211. X    Show Data Style
  3212. X        show data style{ENTER}
  3213. X    --
  3214. X    [Menu]
  3215. X    Function Style
  3216. X    Lines
  3217. X        set function style lines{ENTER}
  3218. X    Points
  3219. X        set function style points{ENTER}
  3220. X    Lines + Points
  3221. X        set function style linespoints{ENTER}
  3222. X    Dots
  3223. X        set function style dots{ENTER}
  3224. X    Impulses
  3225. X        set function style impulses{ENTER}
  3226. X    --
  3227. X    Error Bars
  3228. X        set function style errorbars{ENTER}
  3229. X    Boxes
  3230. X        set function style boxes{ENTER}
  3231. X    Box Error Bars
  3232. X        set function style boxerrorbars{ENTER}
  3233. X    [EndMenu]
  3234. X    Show Function style
  3235. X        show function style{ENTER}
  3236. X[EndMenu]
  3237. X
  3238. X[Menu]
  3239. X&3D
  3240. X    [Menu]
  3241. X    Contours
  3242. X        Linear Contours
  3243. X            set cntrparam linear{ENTER}
  3244. X        Cubic Spline Contours
  3245. X            set cntrparam cubicspline{ENTER}
  3246. X        B-spline Contours
  3247. X            set cntrparam bspline{ENTER}
  3248. X        Number of Contours
  3249. X            set cntrparam levels [INPUT]How many contours?{ENTER}
  3250. X        Points for Contours
  3251. X            set cntrparam points [INPUT]How many points for the contours?{ENTER}
  3252. X        Order of B-splines
  3253. X            set cntrparam order [INPUT]Order of B-splines (2-10)?{ENTER}
  3254. X        --
  3255. X        Contours on Base
  3256. X            set contour base{ENTER}
  3257. X        Contours on Surfaces
  3258. X            set contour surface{ENTER}
  3259. X        Contours on Both
  3260. X            set contour both{ENTER}
  3261. X        No Contours
  3262. X            set nocontour{ENTER}
  3263. X        Show Contour
  3264. X            show contour{ENTER}
  3265. X        --
  3266. X        Number of Isosamples
  3267. X            set isosamples [INPUT]Number of isosamples?{ENTER}
  3268. X        Show Isosamples
  3269. X            show isosamples{ENTER}
  3270. X    [EndMenu]
  3271. X    --
  3272. X    Cartesian Mapping
  3273. X        set mapping cartesian{ENTER}
  3274. X    Spherical Mapping
  3275. X        set mapping spherical{ENTER}
  3276. X    Cylindrical Mapping
  3277. X        set mapping cylindrical{ENTER}
  3278. X    Show Mapping
  3279. X        show mapping{ENTER}
  3280. X    --
  3281. X    Hidden line removal
  3282. X        set hidden3d{ENTER}
  3283. X    No Hidden line removal
  3284. X        set nohidden3d{ENTER}
  3285. X    Show Hidden line removal
  3286. X        show hidden3d{ENTER}
  3287. X    --
  3288. X    Display Surface mesh
  3289. X        set surface{ENTER}
  3290. X    No Surface mesh
  3291. X        set nosurface{ENTER}
  3292. X    Show Surface status
  3293. X        show surface{ENTER}
  3294. X    --
  3295. X    Set View
  3296. X        set view [INPUT]X rotation (degrees)?[EOS],[INPUT]Z rotation?[EOS],[INPUT]Scale?[EOS],[INPUT]Z scale?{ENTER}
  3297. X    Show View
  3298. X        show view{ENTER}
  3299. X[EndMenu]
  3300. X
  3301. X[Menu]
  3302. X&Help
  3303. X    &Index
  3304. X        help{ENTER}
  3305. X    Introduction
  3306. X        help introduction{ENTER}
  3307. X    &Topic
  3308. X        help [INPUT]Help Topic?{ENTER}
  3309. X    &Windows
  3310. X        help windows{ENTER}
  3311. X[EndMenu]
  3312. X
  3313. X; now some buttons
  3314. X; DON'T put a shortcut key (&) on any of these because
  3315. X; it doesn't work with Windows 3.1 and it HANGS Windows 3.0.
  3316. X[Button]
  3317. X    Replot
  3318. X        replot{ENTER}
  3319. X[Button]
  3320. X    Open
  3321. X        load '[OPEN]load[EOS]*.plt[EOS]'{ENTER}
  3322. X[Button]
  3323. X    Save
  3324. X        save '[SAVE]save[EOS]*.plt[EOS]'{ENTER}
  3325. X[Button]
  3326. X    ChDir
  3327. X        cd '[INPUT]New directory?[EOS]'{ENTER}
  3328. X[Button]
  3329. X    Print
  3330. X        set terminal [INPUT]Terminal type?{ENTER}set output "PRN"{ENTER}replot{ENTER}set terminal win{ENTER}set output{ENTER}
  3331. X[Button]
  3332. X    PrtSc
  3333. X        screendump{ENTER}
  3334. X[Button]
  3335. X    Prev
  3336. X        {^P}
  3337. X[Button]
  3338. X    Next
  3339. X        {^N}
  3340. END_OF_FILE
  3341.   if test 11011 -ne `wc -c <'gnuplot/win/wgnuplot.mnu'`; then
  3342.     echo shar: \"'gnuplot/win/wgnuplot.mnu'\" unpacked with wrong size!
  3343.   fi
  3344.   # end of 'gnuplot/win/wgnuplot.mnu'
  3345. fi
  3346. echo shar: End of archive 22 \(of 33\).
  3347. cp /dev/null ark22isdone
  3348. MISSING=""
  3349. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
  3350.     if test ! -f ark${I}isdone ; then
  3351.     MISSING="${MISSING} ${I}"
  3352.     fi
  3353. done
  3354. if test "${MISSING}" = "" ; then
  3355.     echo You have unpacked all 33 archives.
  3356.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  3357. else
  3358.     echo You still must unpack the following archives:
  3359.     echo "        " ${MISSING}
  3360. fi
  3361. exit 0
  3362. exit 0 # Just in case...
  3363.