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

  1. Newsgroups: comp.sources.misc
  2. From: gershon%gr@cs.utah.edu (Elber Gershon)
  3. Subject:  v24i045:  gnuplot3 - interactive function plotting utility, Part23/26
  4. Message-ID: <1991Oct29.031035.4185@sparky.imd.sterling.com>
  5. X-Md4-Signature: a397e0c1865fa9e306257edf6bdbfaa2
  6. Date: Tue, 29 Oct 1991 03:10:35 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: gershon%gr@cs.utah.edu (Elber Gershon)
  10. Posting-number: Volume 24, Issue 45
  11. Archive-name: gnuplot3/part23
  12. Environment: UNIX, MS-DOS, VMS
  13. Supersedes: gnuplot2: Volume 11, Issue 65-79
  14.  
  15. #!/bin/sh
  16. # this is Part.23 (part 23 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file gnuplot/plot.c continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 23; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test ! -f _shar_wnt_.tmp; then
  33.     echo 'x - still skipping gnuplot/plot.c'
  34. else
  35. echo 'x - continuing file gnuplot/plot.c'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/plot.c' &&
  37. X        /* VAX stuffs up stdout on SIGINT while writing to stdout,
  38. X          so reopen stdout. */
  39. X        if (outfile == stdout) {
  40. X           if ( (stdout = freopen("SYS$OUTPUT","w",stdout))  == NULL) {
  41. X              /* couldn't reopen it so try opening it instead */
  42. X              if ( (stdout = fopen("SYS$OUTPUT","w"))  == NULL) {
  43. X                 /* don't use int_error here - causes infinite loop! */
  44. X                 fprintf(stderr,"Error opening SYS$OUTPUT as stdout\n");
  45. X              }
  46. X           }
  47. X           outfile = stdout;
  48. X        }
  49. #endif                    /* VMS */
  50. X        if (!interactive)
  51. X         done(IO_ERROR);            /* exit on non-interactive error */
  52. X    }
  53. X
  54. X     if (argc > 1) {
  55. X        /* load filenames given as arguments */
  56. X        while (--argc > 0) {
  57. X           ++argv;
  58. X           c_token = NO_CARET; /* in case of file not found */
  59. X           load_file(fopen(*argv,"r"), *argv);    
  60. X        }
  61. X    } else {
  62. X        /* take commands from stdin */
  63. X        while(TRUE)
  64. X         com_line();
  65. X    }
  66. X
  67. X     done(IO_SUCCESS);
  68. }
  69. X
  70. /* Set up to catch interrupts */
  71. interrupt_setup()
  72. {
  73. #ifdef MSDOS
  74. #ifdef __TURBOC__
  75. X        (void) signal(SIGINT, tc_interrupt);    /* go there on interrupt char */
  76. #else
  77. X        void ss_interrupt();
  78. X        save_stack();                /* work-around for MSC 4.0/MSDOS 3.x bug */
  79. X        (void) signal(SIGINT, ss_interrupt);
  80. #endif
  81. #else /* MSDOS */
  82. X        (void) signal(SIGINT, inter);    /* go there on interrupt char */
  83. #endif /* MSDOS */
  84. }
  85. X
  86. X
  87. /* Look for a gnuplot start-up file */
  88. load_rcfile()
  89. {
  90. X    register FILE *plotrc;
  91. X    static char home[80];
  92. X    static char rcfile[sizeof(PLOTRC)+80];
  93. X
  94. X    /* Look for a gnuplot init file in . or home directory */
  95. #ifdef vms
  96. X    (void) strcpy(home,HOME);
  97. #else /* vms */
  98. #if defined(AMIGA_AC_5) || defined(AMIGA_LC_5_1)
  99. X    strcpy(home,getenv(HOME));
  100. X    {
  101. X        int h;
  102. X        h = strlen(home) - 1;
  103. X        if (h >= 0) {
  104. X            if ((home[h] != ':') && (home[h] != '/')) {
  105. X                home[h] = '/';
  106. X                home[h+1] = '\0';
  107. X            }
  108. X           }
  109. X    }
  110. #else /* AMIGA */
  111. X    (void) strcat(strcpy(home,getenv(HOME)),"/");
  112. #endif /* AMIGA */
  113. #endif /* vms */
  114. #ifdef NOCWDRC
  115. X    /* inhibit check of init file in current directory for security reasons */
  116. X    {
  117. #else
  118. X    (void) strcpy(rcfile, PLOTRC);
  119. X    plotrc = fopen(rcfile,"r");
  120. X    if (plotrc == (FILE *)NULL) {
  121. #endif
  122. X       (void) sprintf(rcfile, "%s%s", home, PLOTRC);
  123. X       plotrc = fopen(rcfile,"r");
  124. X    }
  125. X    if (plotrc)
  126. X     load_file(plotrc, rcfile);
  127. }
  128. SHAR_EOF
  129. echo 'File gnuplot/plot.c is complete' &&
  130. chmod 0644 gnuplot/plot.c ||
  131. echo 'restore of gnuplot/plot.c failed'
  132. Wc_c="`wc -c < 'gnuplot/plot.c'`"
  133. test 8795 -eq "$Wc_c" ||
  134.     echo 'gnuplot/plot.c: original size 8795, current size' "$Wc_c"
  135. rm -f _shar_wnt_.tmp
  136. fi
  137. # ============= gnuplot/plot.h ==============
  138. if test -f 'gnuplot/plot.h' -a X"$1" != X"-c"; then
  139.     echo 'x - skipping gnuplot/plot.h (File already exists)'
  140.     rm -f _shar_wnt_.tmp
  141. else
  142. > _shar_wnt_.tmp
  143. echo 'x - extracting gnuplot/plot.h (Text)'
  144. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/plot.h' &&
  145. /* GNUPLOT - plot.h */
  146. /*
  147. X * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  148. X *
  149. X * Permission to use, copy, and distribute this software and its
  150. X * documentation for any purpose with or without fee is hereby granted, 
  151. X * provided that the above copyright notice appear in all copies and 
  152. X * that both that copyright notice and this permission notice appear 
  153. X * in supporting documentation.
  154. X *
  155. X * Permission to modify the software is granted, but not the right to
  156. X * distribute the modified code.  Modifications are to be distributed 
  157. X * as patches to released version.
  158. X *  
  159. X * This software is provided "as is" without express or implied warranty.
  160. X * 
  161. X *
  162. X * AUTHORS
  163. X * 
  164. X *   Original Software:
  165. X *     Thomas Williams,  Colin Kelley.
  166. X * 
  167. X *   Gnuplot 2.0 additions:
  168. X *       Russell Lang, Dave Kotz, John Campbell.
  169. X *
  170. X *   Gnuplot 3.0 additions:
  171. X *       Gershon Elber and many others.
  172. X * 
  173. X * Send your comments or suggestions to 
  174. X *  pixar!info-gnuplot@sun.com.
  175. X * This is a mailing list; to join it send a note to 
  176. X *  pixar!info-gnuplot-request@sun.com.  
  177. X * Send bug reports to
  178. X *  pixar!bug-gnuplot@sun.com.
  179. X */
  180. X
  181. #define PROGRAM "G N U P L O T"
  182. #define PROMPT "gnuplot> "
  183. #if defined(AMIGA_LC_5_1) || defined(AMIGA_AC_5)
  184. #define SHELL "NewShell"
  185. #else /* AMIGA */
  186. #define SHELL "/bin/sh"        /* used if SHELL env variable not set */
  187. #endif /* AMIGA  */
  188. X
  189. #define SAMPLES 100        /* default number of samples for a plot */
  190. #define ISO_SAMPLES 10        /* default number of isolines per splot */
  191. #define ZERO    1e-8        /* default for 'zero' set option */
  192. X
  193. #ifndef TERM
  194. /* default terminal is "unknown"; but see init_terminal */
  195. #define TERM "unknown"
  196. #endif
  197. X
  198. #define TRUE 1
  199. #define FALSE 0
  200. X
  201. X
  202. #define Pi 3.141592653589793
  203. #define DEG2RAD (Pi / 180.0)
  204. X
  205. X
  206. #define MIN_CRV_POINTS 100        /* minimum size of points[] in curve_points */
  207. #define MIN_SRF_POINTS 1000        /* minimum size of points[] in surface_points */
  208. X
  209. #define MAX_LINE_LEN 1024    /* maximum number of chars allowed on line */
  210. #define MAX_TOKENS 200
  211. #define MAX_ID_LEN 50        /* max length of an identifier */
  212. X
  213. X
  214. #define MAX_AT_LEN 150        /* max number of entries in action table */
  215. #define STACK_DEPTH 100
  216. #define NO_CARET (-1)
  217. X
  218. X
  219. #define MAX_NUM_VAR    2    /* Ploting projection of func. of max. two vars. */
  220. X
  221. #define MAP3D_CARTESIAN        0    /* 3D Data mapping. */
  222. #define MAP3D_SPHERICAL        1
  223. #define MAP3D_CYLINDRICAL    2
  224. X
  225. #define CONTOUR_NONE    0    /* Where to place contour maps if at all. */
  226. #define CONTOUR_BASE    1
  227. #define CONTOUR_SRF    2
  228. #define CONTOUR_BOTH    3
  229. X
  230. #define CONTOUR_KIND_LINEAR    0 /* See contour.h in contours subdirectory. */
  231. #define CONTOUR_KIND_CUBIC_SPL    1
  232. #define CONTOUR_KIND_BSPLINE    2
  233. X
  234. #define ANGLES_RADIANS    0
  235. #define ANGLES_DEGREES    1
  236. X
  237. X
  238. #if defined(AMIGA_LC_5_1) || defined(AMIGA_AC_5)
  239. #define OS "Amiga "
  240. #endif
  241. X
  242. X
  243. #ifdef vms
  244. #define OS "VMS "
  245. #endif
  246. X
  247. X
  248. #ifdef unix
  249. #define OS "unix "
  250. #endif
  251. X
  252. X
  253. #ifdef MSDOS
  254. #define OS "MS-DOS "
  255. #endif
  256. X
  257. X
  258. #ifndef OS
  259. #define OS ""
  260. #endif
  261. X
  262. X
  263. /*
  264. X * Note about VERYLARGE:  This is the upper bound double (or float, if PC)
  265. X * numbers. This flag indicates very large numbers. It doesn't have to 
  266. X * be the absolutely biggest number on the machine.  
  267. X * If your machine doesn't have HUGE, or float.h,
  268. X * define VERYLARGE here. 
  269. X *
  270. X * example:
  271. #define VERYLARGE 1e38
  272. X */
  273. X
  274. #ifdef PC
  275. #include <float.h>
  276. #define VERYLARGE FLT_MAX
  277. #else
  278. #if defined( vms ) || defined( _CRAY ) || defined( NEXT )
  279. #include <float.h>
  280. #define VERYLARGE DBL_MAX
  281. #else
  282. #if defined(AMIGA_AC_5) || defined(AMIGA_LC_5_1)
  283. #include <math.h>
  284. #define VERYLARGE HUGE
  285. #else
  286. #define VERYLARGE HUGE
  287. #endif
  288. #endif
  289. #endif
  290. X
  291. X
  292. #define END_OF_COMMAND (c_token >= num_tokens || equals(c_token,";"))
  293. X
  294. #ifdef vms
  295. X
  296. X
  297. #define is_comment(c) ((c) == '#' || (c) == '!')
  298. #define is_system(c) ((c) == '$')
  299. X
  300. X
  301. #else /* vms */
  302. X
  303. X
  304. #define is_comment(c) ((c) == '#')
  305. #define is_system(c) ((c) == '!')
  306. X
  307. X
  308. #endif /* vms */
  309. X
  310. /* If you don't have vfork, then undefine this */
  311. #if defined(NOVFORK) || defined(MSDOS)
  312. # undef VFORK
  313. #else
  314. # ifdef unix
  315. #  define VFORK
  316. # endif
  317. #endif
  318. X
  319. /* 
  320. X * memcpy() comes by many names. The default is now to assume bcopy, 
  321. X * since it is the most common case. Define 
  322. X *  MEMCPY to use memcpy(), 
  323. X *  vms to use the vms function,
  324. X *  NOCOPY to use a handwritten version in parse.c
  325. X */
  326. #ifdef vms
  327. # define memcpy(dest,src,len) lib$movc3(&len,src,dest)
  328. #else
  329. # if defined(MEMCPY) || defined(MSDOS)
  330. X   /* use memcpy directly */
  331. # else 
  332. #  ifdef NOCOPY
  333. X    /* use the handwritten memcpy in parse.c */
  334. #  else
  335. X    /* assume bcopy is in use */
  336. #   define memcpy(dest,src,len) bcopy(src,dest,len)
  337. #  endif /* NOCOPY */
  338. # endif /* MEMCPY || MSDOS */
  339. #endif /* vms */
  340. X
  341. /*
  342. X * In case you have MEMSET instead of BZERO. If you have something 
  343. X * else, define bzero to that something.
  344. X */
  345. #if defined(MEMSET) || defined(MSDOS)
  346. #define bzero(dest,len)  (void)(memset(dest, (char)NULL, len))
  347. #endif /* MEMSET || MSDOS */
  348. X
  349. /* Give the name of your gamma function, or undefine it if you have none.  */
  350. #if defined(NOGAMMA) || defined(MSDOS)
  351. # undef GAMMA
  352. #else
  353. # ifndef GAMMA
  354. #  define GAMMA gamma
  355. # endif /* GAMMA */
  356. #endif /* NOGAMMA ||MSDOS */
  357. X
  358. #define top_of_stack stack[s_p]
  359. X
  360. typedef int BOOLEAN;
  361. X
  362. #ifdef __ZTC__
  363. typedef int (*FUNC_PTR)(...);
  364. #else
  365. typedef int (*FUNC_PTR)();
  366. #endif
  367. X
  368. #if defined(AMIGA_LC_5_1) || defined(AMIGA_AC_5)
  369. enum operators {
  370. X    PUSH, PUSHC, PUSHD1, PUSHD2, CALL, CALL2, LNOT, BNOT, UMINUS, LOR, LAND,
  371. X    BOR, XOR, BAND, EQ, NE, GT, LT, GE, LE, PLUS, MINUS, MULT, DIV,
  372. X    MOD, POWER, FACTORIAL, ABOOL, JUMP, JUMPZ, JUMPNZ, JTERN, SF_START
  373. };
  374. #else
  375. enum operators {
  376. X    PUSH, PUSHC, PUSHD1, PUSHD2, CALL, CALL2, LNOT, BNOT, UMINUS, LOR, LAND,
  377. X    BOR, XOR, BAND, EQ, NE, GT, LT, GE, LE, PLUS, MINUS, MULT, DIV,
  378. X    MOD, POWER, FACTORIAL, BOOL, JUMP, JUMPZ, JUMPNZ, JTERN, SF_START
  379. };
  380. #endif
  381. X
  382. X
  383. #define is_jump(operator) ((operator) >=(int)JUMP && (operator) <(int)SF_START)
  384. X
  385. X
  386. enum DATA_TYPES {
  387. X    INT, CMPLX
  388. };
  389. X
  390. X
  391. enum PLOT_TYPE {
  392. X    FUNC, DATA, FUNC3D, DATA3D
  393. };
  394. X
  395. X
  396. enum PLOT_STYLE {
  397. X    LINES, POINTS, IMPULSES, LINESPOINTS, DOTS, ERRORBARS
  398. };
  399. X
  400. enum JUSTIFY {
  401. X    LEFT, CENTRE, RIGHT
  402. };
  403. X
  404. struct cmplx {
  405. X    double real, imag;
  406. };
  407. X
  408. X
  409. struct value {
  410. X    enum DATA_TYPES type;
  411. X    union {
  412. X        int int_val;
  413. X        struct cmplx cmplx_val;
  414. X    } v;
  415. };
  416. X
  417. X
  418. struct lexical_unit {    /* produced by scanner */
  419. X    BOOLEAN is_token;    /* true if token, false if a value */ 
  420. X    struct value l_val;
  421. X    int start_index;    /* index of first char in token */
  422. X    int length;            /* length of token in chars */
  423. };
  424. X
  425. X
  426. struct ft_entry {        /* standard/internal function table entry */
  427. X    char *f_name;        /* pointer to name of this function */
  428. X    FUNC_PTR func;        /* address of function to call */
  429. };
  430. X
  431. X
  432. struct udft_entry {                /* user-defined function table entry */
  433. X    struct udft_entry *next_udf;         /* pointer to next udf in linked list */
  434. X    char udf_name[MAX_ID_LEN+1];         /* name of this function entry */
  435. X    struct at_type *at;            /* pointer to action table to execute */
  436. X    char *definition;             /* definition of function as typed */
  437. X    struct value dummy_values[MAX_NUM_VAR];    /* current value of dummy variables */
  438. };
  439. X
  440. X
  441. struct udvt_entry {            /* user-defined value table entry */
  442. X    struct udvt_entry *next_udv; /* pointer to next value in linked list */
  443. X    char udv_name[MAX_ID_LEN+1]; /* name of this value entry */
  444. X    BOOLEAN udv_undef;        /* true if not defined yet */
  445. X    struct value udv_value;    /* value it has */
  446. };
  447. X
  448. X
  449. union argument {            /* p-code argument */
  450. X    int j_arg;                /* offset for jump */
  451. X    struct value v_arg;        /* constant value */
  452. X    struct udvt_entry *udv_arg;    /* pointer to dummy variable */
  453. X    struct udft_entry *udf_arg; /* pointer to udf to execute */
  454. };
  455. X
  456. X
  457. struct at_entry {            /* action table entry */
  458. X    enum operators index;    /* index of p-code function */
  459. X    union argument arg;
  460. };
  461. X
  462. X
  463. struct at_type {
  464. X    int a_count;                /* count of entries in .actions[] */
  465. X    struct at_entry actions[MAX_AT_LEN];
  466. X        /* will usually be less than MAX_AT_LEN is malloc()'d copy */
  467. };
  468. X
  469. X
  470. /* Defines the type of a coordinate */
  471. /* INRANGE and OUTRANGE points have an x,y point associated with them */
  472. enum coord_type {
  473. X    INRANGE,                /* inside plot boundary */
  474. X    OUTRANGE,                /* outside plot boundary, but defined */
  475. X    UNDEFINED                /* not defined at all */
  476. };
  477. X  
  478. #ifdef PC
  479. typedef float coordval;        /* memory is tight on PCs! */
  480. #else
  481. typedef double coordval;
  482. #endif
  483. X
  484. struct coordinate {
  485. X    enum coord_type type;    /* see above */
  486. X    coordval x, y, z;
  487. X    coordval ylow, yhigh;    /* ignored in 3d */
  488. };
  489. X
  490. struct curve_points {
  491. X    struct curve_points *next_cp;    /* pointer to next plot in linked list */
  492. X    enum PLOT_TYPE plot_type;
  493. X    enum PLOT_STYLE plot_style;
  494. X    char *title;
  495. X    int line_type;
  496. X    int point_type;
  497. X     int p_max;                    /* how many points are allocated */
  498. X    int p_count;                    /* count of points in points */
  499. X    struct coordinate *points;
  500. };
  501. X
  502. struct gnuplot_contours {
  503. X    struct gnuplot_contours *next;
  504. X    struct coordinate *coords;
  505. X    int num_pts;
  506. };
  507. X
  508. struct iso_curve {
  509. X    struct iso_curve *next;
  510. X     int p_max;                    /* how many points are allocated */
  511. X    int p_count;                    /* count of points in points */
  512. X    struct coordinate *points;
  513. };
  514. X
  515. struct surface_points {
  516. X    struct surface_points *next_sp;    /* pointer to next plot in linked list */
  517. X    enum PLOT_TYPE plot_type;
  518. X    enum PLOT_STYLE plot_style;
  519. X    char *title;
  520. X    int line_type;
  521. X    int point_type;
  522. X    int has_grid_topology;
  523. X    int num_iso_read;  /* Data files only - num of isolines read from file. */
  524. X    struct gnuplot_contours *contours;    /* Not NULL If have contours. */
  525. X    struct iso_curve *iso_crvs;
  526. };
  527. X
  528. struct termentry {
  529. X    char *name;
  530. X    char *description;
  531. X    unsigned int xmax,ymax,v_char,h_char,v_tic,h_tic;
  532. X    FUNC_PTR options,init,reset,text,scale,graphics,move,vector,linetype,
  533. X        put_text,text_angle,justify_text,point,arrow;
  534. };
  535. X
  536. X
  537. struct text_label {
  538. X    struct text_label *next;    /* pointer to next label in linked list */
  539. X    int tag;            /* identifies the label */
  540. X    double x,y,z;
  541. X    enum JUSTIFY pos;
  542. X    char text[MAX_LINE_LEN+1];
  543. };
  544. X
  545. struct arrow_def {
  546. X    struct arrow_def *next;    /* pointer to next arrow in linked list */
  547. X    int tag;            /* identifies the arrow */
  548. X    double sx,sy,sz;        /* start position */
  549. X    double ex,ey,ez;        /* end position */
  550. X    BOOLEAN head;            /* arrow has a head or not */
  551. };
  552. X
  553. /* Tic-mark labelling definition; see set xtics */
  554. struct ticdef {
  555. X    int type;                /* one of three values below */
  556. #define TIC_COMPUTED 1        /* default; gnuplot figures them */
  557. #define TIC_SERIES 2        /* user-defined series */
  558. #define TIC_USER 3            /* user-defined points */
  559. X    union {
  560. X       struct {            /* for TIC_SERIES */
  561. X          double start, incr;
  562. X          double end;        /* ymax, if VERYLARGE */
  563. X       } series;
  564. X       struct ticmark *user;    /* for TIC_USER */
  565. X    } def;
  566. };
  567. X
  568. /* Defines one ticmark for TIC_USER style.
  569. X * If label==NULL, the value is printed with the usual format string.
  570. X * else, it is used as the format string (note that it may be a constant
  571. X * string, like "high" or "low").
  572. X */
  573. struct ticmark {
  574. X    double position;        /* where on axis is this */
  575. X    char *label;            /* optional (format) string label */
  576. X    struct ticmark *next;    /* linked list */
  577. };
  578. X
  579. /*
  580. X * SS$_NORMAL is "normal completion", STS$M_INHIB_MSG supresses
  581. X
  582. X * printing a status message.
  583. X * SS$_ABORT is the general abort status code.
  584. X from:    Martin Minow
  585. X    decvax!minow
  586. X */
  587. #ifdef    vms
  588. #include        <ssdef.h>
  589. #include        <stsdef.h>
  590. #define    IO_SUCCESS    (SS$_NORMAL | STS$M_INHIB_MSG)
  591. #define    IO_ERROR    SS$_ABORT
  592. #endif /* vms */
  593. X
  594. X
  595. #ifndef    IO_SUCCESS    /* DECUS or VMS C will have defined these already */
  596. #define    IO_SUCCESS    0
  597. #endif
  598. #ifndef    IO_ERROR
  599. #define    IO_ERROR    1
  600. #endif
  601. X
  602. /* Some key global variables */
  603. extern BOOLEAN screen_ok;
  604. extern BOOLEAN term_init;
  605. extern BOOLEAN undefined;
  606. extern struct termentry term_tbl[];
  607. X
  608. extern char *alloc();
  609. /* allocating and managing curve_points structures */
  610. extern struct curve_points *cp_alloc();
  611. extern int cp_extend();
  612. extern int cp_free();
  613. /* allocating and managing surface_points structures */
  614. extern struct surface_points *sp_alloc();
  615. extern int sp_replace();
  616. extern int sp_free();
  617. /* allocating and managing is_curve structures */
  618. extern struct iso_curve *iso_alloc();
  619. extern int iso_extend();
  620. extern int iso_free();
  621. SHAR_EOF
  622. chmod 0644 gnuplot/plot.h ||
  623. echo 'restore of gnuplot/plot.h failed'
  624. Wc_c="`wc -c < 'gnuplot/plot.h'`"
  625. test 11940 -eq "$Wc_c" ||
  626.     echo 'gnuplot/plot.h: original size 11940, current size' "$Wc_c"
  627. rm -f _shar_wnt_.tmp
  628. fi
  629. # ============= gnuplot/README.amiga ==============
  630. if test -f 'gnuplot/README.amiga' -a X"$1" != X"-c"; then
  631.     echo 'x - skipping gnuplot/README.amiga (File already exists)'
  632.     rm -f _shar_wnt_.tmp
  633. else
  634. > _shar_wnt_.tmp
  635. echo 'x - extracting gnuplot/README.amiga (Text)'
  636. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/README.amiga' &&
  637. SOME NOTES ON GNUPLOT ON THE AMIGA ...
  638. X
  639. X
  640. X
  641. Environment Variables:
  642. X
  643. X   GNUFONT   You can say "setenv GNUFONT <Fontname>/<Pointsize>" to get the font
  644. X             of your liking on the screen, e.g. "setenv GNUFONT sapphire/14".
  645. X             Otherwise gnuplot will select the default-font you chose with
  646. X             "Preferences".
  647. X
  648. X   GNUHELP   Allows you to define a pathname for the GNUPlot help file.  For
  649. X             example, "setenv GNUHELP TEX:gnuplot.gih"
  650. X
  651. X   GNUPLOT   Your current directory is searched for the file ".gnuplot".
  652. X             If you say "setenv GNUPLOT <Path>" (without the filename!)
  653. X             GNUPlot will look for it there.
  654. X
  655. X   GNUTERM   You can define a default driver with "setenv GNUTERM <driver>".
  656. X             A good choice is "setenv GNUTERM amiga" :^)
  657. X
  658. X   SHELL     If you don't like "NewShell" as your shell, you can say
  659. X             "setenv SHELL <Shell>".
  660. X
  661. X
  662. Stack Size:
  663. X
  664. X   Set your stack to at least 20000 and you'll be fine (I hope).
  665. X   If you're using the integral feature, a stack size of at least 70000
  666. X   is necessary (at least it is for "bivariat.demo" to execute).
  667. X
  668. X
  669. X
  670. --------------------------   LATTICE C VERSION   ------------------------------
  671. X
  672. X
  673. Default paths/directories:
  674. X
  675. X   Gnuplot looks for the file "gnuplot.gih" in your "S:"-directory unless you
  676. X   specify the full pathname including the filename via "setenv GNUHELP".
  677. X
  678. X
  679. Bugs/deficiencies:
  680. X
  681. X   The SAS/C 5.1 library routine [fs]scanf will not correctly handle
  682. X   format-strings like "%[^\n]s". Maybe this will be fixed by SAS in future
  683. X   versions.
  684. X
  685. X   When using "%g" as format-string, SAS/C 5.1 [fs]printf will incorrectly
  686. X   output "0" as "0.". This looks rather ugly as a axis-label.
  687. X
  688. X
  689. SAS/C 5.1 bugs:
  690. X
  691. X   SAS/C 5.1 [fs]scanf will count parameters overread with the "%*s" format-
  692. X   string as properly matched. I included a fix for this by counting the
  693. X   "%*"-sequences in the given format-string. Therfore the "*" must immediately
  694. X   follow the "%" (I don't know if it's legal to put something in-between
  695. X   these two characters anyway...).
  696. X
  697. X   If you start a shell via the gnuplot "shell"-command you won't be able to
  698. X   close your CLI/Shell again. This is probably due to an error in the
  699. X   SAS/C "system"-call.
  700. X
  701. X   "isatty(fileno(stdin))" did not work correctly. A fix is included.
  702. X
  703. X   SAS/C does not seem to handle float-parameters in function-calls and
  704. X   -declarations correctly. (This cost me at least 2 hours to figure out >:-( ).
  705. X   See the latex- and eepic-drivers for details.
  706. X
  707. X
  708. X
  709. X
  710. ---------------------------   AZTEC C VERSION   -------------------------------
  711. X
  712. X
  713. Default paths/directories:
  714. X
  715. X   GNUPlot looks for the "gnuplot.gih" file in "GNUPLOT:docs/gnuplot.gih" if
  716. X   GNUHELP is not defined.   This is defined in the makefile (makefile.ami).
  717. X
  718. X
  719. Terminal Drivers:
  720. X
  721. X   The Aztec C version can now use the "amiga.trm" driver written by
  722. X   Carsten Steger.  Under KS/WB 2.0, a custom screen will be used with a size
  723. X   specified by the Prefs/Overscan program.
  724. SHAR_EOF
  725. chmod 0644 gnuplot/README.amiga ||
  726. echo 'restore of gnuplot/README.amiga failed'
  727. Wc_c="`wc -c < 'gnuplot/README.amiga'`"
  728. test 2981 -eq "$Wc_c" ||
  729.     echo 'gnuplot/README.amiga: original size 2981, current size' "$Wc_c"
  730. rm -f _shar_wnt_.tmp
  731. fi
  732. # ============= gnuplot/scanner.c ==============
  733. if test -f 'gnuplot/scanner.c' -a X"$1" != X"-c"; then
  734.     echo 'x - skipping gnuplot/scanner.c (File already exists)'
  735.     rm -f _shar_wnt_.tmp
  736. else
  737. > _shar_wnt_.tmp
  738. echo 'x - extracting gnuplot/scanner.c (Text)'
  739. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/scanner.c' &&
  740. /* GNUPLOT - scanner.c */
  741. /*
  742. X * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  743. X *
  744. X * Permission to use, copy, and distribute this software and its
  745. X * documentation for any purpose with or without fee is hereby granted, 
  746. X * provided that the above copyright notice appear in all copies and 
  747. X * that both that copyright notice and this permission notice appear 
  748. X * in supporting documentation.
  749. X *
  750. X * Permission to modify the software is granted, but not the right to
  751. X * distribute the modified code.  Modifications are to be distributed 
  752. X * as patches to released version.
  753. X *  
  754. X * This software is provided "as is" without express or implied warranty.
  755. X * 
  756. X *
  757. X * AUTHORS
  758. X * 
  759. X *   Original Software:
  760. X *     Thomas Williams,  Colin Kelley.
  761. X * 
  762. X *   Gnuplot 2.0 additions:
  763. X *       Russell Lang, Dave Kotz, John Campbell.
  764. X *
  765. X *   Gnuplot 3.0 additions:
  766. X *       Gershon Elber and many others.
  767. X * 
  768. X * Send your comments or suggestions to 
  769. X *  pixar!info-gnuplot@sun.com.
  770. X * This is a mailing list; to join it send a note to 
  771. X *  pixar!info-gnuplot-request@sun.com.  
  772. X * Send bug reports to
  773. X *  pixar!bug-gnuplot@sun.com.
  774. X */
  775. X
  776. #include <stdio.h>
  777. #include <ctype.h>
  778. #include "plot.h"
  779. X
  780. #ifdef AMIGA_AC_5
  781. #define O_RDONLY    0
  782. int open(const char * _name, int _mode, ...);
  783. int close(int);
  784. #endif
  785. X
  786. #ifdef vms
  787. X
  788. #include stdio
  789. #include descrip
  790. #include errno
  791. X
  792. #define MAILBOX "PLOT$MAILBOX"
  793. #define pclose(f) fclose(f)
  794. X
  795. #endif /* vms */
  796. X
  797. X
  798. #define isident(c) (isalnum(c) || (c) == '_')
  799. X
  800. #ifndef STDOUT
  801. #define STDOUT 1
  802. #endif
  803. X
  804. #define LBRACE '{'
  805. #define RBRACE '}'
  806. X
  807. #define APPEND_TOKEN {token[t_num].length++; current++;}
  808. X
  809. #define SCAN_IDENTIFIER while (isident(expression[current + 1]))\
  810. X                APPEND_TOKEN
  811. X
  812. extern struct lexical_unit token[MAX_TOKENS];
  813. X
  814. static int t_num;    /* number of token I'm working on */
  815. X
  816. char *strcat(), *strcpy(), *strncpy();
  817. X
  818. /*
  819. X * scanner() breaks expression[] into lexical units, storing them in token[].
  820. X *   The total number of tokens found is returned as the function value.
  821. X *   Scanning will stop when '\0' is found in expression[], or when token[]
  822. X *     is full.
  823. X *
  824. X *     Scanning is performed by following rules:
  825. X *
  826. X *        Current char    token should contain
  827. X *     -------------    -----------------------
  828. X *        1.  alpha        all following alpha-numerics
  829. X *        2.  digit        0 or more following digits, 0 or 1 decimal point,
  830. X *                          0 or more digits, 0 or 1 'e' or 'E',
  831. X *                          0 or more digits.
  832. X *        3.  ^,+,-,/        only current char
  833. X *            %,~,(,)
  834. X *            [,],;,:,
  835. X *            ?,comma
  836. X *        4.  &,|,=,*        current char; also next if next is same
  837. X *        5.  !,<,>        current char; also next if next is =
  838. X *        6.  ", '        all chars up until matching quote
  839. X *        7.  #          this token cuts off scanning of the line (DFK).
  840. X *
  841. X *        white space between tokens is ignored
  842. X */
  843. scanner(expression)
  844. char expression[];
  845. {
  846. register int current;    /* index of current char in expression[] */
  847. register int quote;
  848. char brace;
  849. X
  850. X    for (current = t_num = 0;
  851. X        t_num < MAX_TOKENS && expression[current] != '\0';
  852. X        current++) {
  853. again:
  854. X        if (isspace(expression[current]))
  855. X            continue;                        /* skip the whitespace */
  856. X        token[t_num].start_index = current;
  857. X        token[t_num].length = 1;
  858. X        token[t_num].is_token = TRUE;    /* to start with...*/
  859. X
  860. X        if (expression[current] == '`') {
  861. X            substitute(&expression[current],MAX_LINE_LEN - current);
  862. X            goto again;
  863. X        }
  864. X        if (isalpha(expression[current])) {
  865. X            SCAN_IDENTIFIER;
  866. X        } else if (isdigit(expression[current]) || expression[current] == '.'){
  867. X            token[t_num].is_token = FALSE;
  868. X            token[t_num].length = get_num(&expression[current]);
  869. X            current += (token[t_num].length - 1);
  870. X        } else if (expression[current] == LBRACE) {
  871. X            token[t_num].is_token = FALSE;
  872. X            token[t_num].l_val.type = CMPLX;
  873. X            if ((sscanf(&expression[++current],"%lf , %lf %c",
  874. X                &token[t_num].l_val.v.cmplx_val.real,
  875. X                &token[t_num].l_val.v.cmplx_val.imag,
  876. X                &brace) != 3) || (brace != RBRACE))
  877. X                    int_error("invalid complex constant",t_num);
  878. X            token[t_num].length += 2;
  879. X            while (expression[++current] != RBRACE) {
  880. X                token[t_num].length++;
  881. X                if (expression[current] == '\0')            /* { for vi % */
  882. X                    int_error("no matching '}'", t_num);
  883. X            }
  884. X        } else if (expression[current] == '\'' || expression[current] == '\"'){
  885. X            token[t_num].length++;
  886. X            quote = expression[current];
  887. X            while (expression[++current] != quote) {
  888. X                if (!expression[current]) {
  889. X                    expression[current] = quote;
  890. X                    expression[current+1] = '\0';
  891. X                    break;
  892. X                } else
  893. X                    token[t_num].length++;
  894. X            }
  895. X        } else switch (expression[current]) {
  896. X             case '#':        /* DFK: add comments to gnuplot */
  897. X                  goto endline; /* ignore the rest of the line */
  898. X            case '^':
  899. X            case '+':
  900. X            case '-':
  901. X            case '/':
  902. X            case '%':
  903. X            case '~':
  904. X            case '(':
  905. X            case ')':
  906. X            case '[':
  907. X            case ']':
  908. X            case ';':
  909. X            case ':':
  910. X            case '?':
  911. X            case ',':
  912. X                break;
  913. X            case '&':
  914. X            case '|':
  915. X            case '=':
  916. X            case '*':
  917. X                if (expression[current] == expression[current + 1])
  918. X                    APPEND_TOKEN;
  919. X                break;
  920. X            case '!':
  921. X            case '<':
  922. X            case '>':
  923. X                if (expression[current + 1] == '=')
  924. X                    APPEND_TOKEN;
  925. X                break;
  926. X            default:
  927. X                int_error("invalid character",t_num);
  928. X            }
  929. X        ++t_num;    /* next token if not white space */
  930. X    }
  931. X
  932. endline:                    /* comments jump here to ignore line */
  933. X
  934. /* Now kludge an extra token which points to '\0' at end of expression[].
  935. X   This is useful so printerror() looks nice even if we've fallen off the
  936. X   line. */
  937. X
  938. X        token[t_num].start_index = current;
  939. X        token[t_num].length = 0;
  940. X    return(t_num);
  941. }
  942. X
  943. X
  944. get_num(str)
  945. char str[];
  946. {
  947. double atof();
  948. register int count = 0;
  949. long atol();
  950. register long lval;
  951. X
  952. X    token[t_num].is_token = FALSE;
  953. X    token[t_num].l_val.type = INT;        /* assume unless . or E found */
  954. X    while (isdigit(str[count]))
  955. X        count++;
  956. X    if (str[count] == '.') {
  957. X        token[t_num].l_val.type = CMPLX;
  958. X        while (isdigit(str[++count]))    /* swallow up digits until non-digit */
  959. X            ;
  960. X        /* now str[count] is other than a digit */
  961. X    }
  962. X    if (str[count] == 'e' || str[count] == 'E') {
  963. X        token[t_num].l_val.type = CMPLX;
  964. /* modified if statement to allow + sign in exponent
  965. X   rjl 26 July 1988 */
  966. X        count++;
  967. X        if (str[count] == '-' || str[count] == '+')
  968. X            count++;
  969. X        if (!isdigit(str[count])) {
  970. X            token[t_num].start_index += count;
  971. X            int_error("expecting exponent",t_num);
  972. X        }
  973. X        while (isdigit(str[++count]))
  974. X            ;
  975. X    }
  976. X    if (token[t_num].l_val.type == INT) {
  977. X         lval = atol(str);
  978. X        if ((token[t_num].l_val.v.int_val = lval) != lval)
  979. X            int_error("integer overflow; change to floating point",t_num);
  980. X    } else {
  981. X        token[t_num].l_val.v.cmplx_val.imag = 0.0;
  982. X        token[t_num].l_val.v.cmplx_val.real = atof(str);
  983. X    }
  984. X    return(count);
  985. }
  986. X
  987. X
  988. #ifdef MSDOS
  989. X
  990. #ifdef __ZTC__
  991. substitute(char *str,int max)
  992. #else
  993. substitute()
  994. #endif
  995. {
  996. X    int_error("substitution not supported by MS-DOS!",t_num);
  997. }
  998. X
  999. #else /* MSDOS */
  1000. #ifdef AMIGA_LC_5_1
  1001. substitute()
  1002. {
  1003. X    int_error("substitution not supported by AmigaDOS!",t_num);
  1004. }
  1005. X
  1006. #else /* AMIGA_LC_5_1 */
  1007. X
  1008. substitute(str,max)            /* substitute output from ` ` */
  1009. char *str;
  1010. int max;
  1011. {
  1012. register char *last;
  1013. register int i,c;
  1014. register FILE *f;
  1015. #ifdef AMIGA_AC_5
  1016. int fd;
  1017. #else
  1018. FILE *popen();
  1019. #endif
  1020. static char pgm[MAX_LINE_LEN+1],output[MAX_LINE_LEN+1];
  1021. X
  1022. #ifdef vms
  1023. int chan;
  1024. static $DESCRIPTOR(pgmdsc,pgm);
  1025. static $DESCRIPTOR(lognamedsc,MAILBOX);
  1026. #endif /* vms */
  1027. X
  1028. X    i = 0;
  1029. X    last = str;
  1030. X    while (*(++last) != '`') {
  1031. X        if (*last == '\0')
  1032. X            int_error("unmatched `",t_num);
  1033. X        pgm[i++] = *last;
  1034. X    }
  1035. X    pgm[i] = '\0';        /* end with null */
  1036. X    max -= strlen(last);    /* max is now the max length of output sub. */
  1037. X  
  1038. #ifdef vms
  1039. X      pgmdsc.dsc$w_length = i;
  1040. X       if (!((vaxc$errno = sys$crembx(0,&chan,0,0,0,0,&lognamedsc)) & 1))
  1041. X           os_error("sys$crembx failed",NO_CARET);
  1042. X   
  1043. X       if (!((vaxc$errno = lib$spawn(&pgmdsc,0,&lognamedsc,&1)) & 1))
  1044. X           os_error("lib$spawn failed",NO_CARET);
  1045. X   
  1046. X       if ((f = fopen(MAILBOX,"r")) == NULL)
  1047. X           os_error("mailbox open failed",NO_CARET);
  1048. #else /* vms */
  1049. #ifdef AMIGA_AC_5
  1050. X      if ((fd = open(pgm,"O_RDONLY")) == -1)
  1051. #else
  1052. X      if ((f = popen(pgm,"r")) == NULL)
  1053. #endif
  1054. X          os_error("popen failed",NO_CARET);
  1055. #endif /* vms */
  1056. X
  1057. X    i = 0;
  1058. X    while ((c = getc(f)) != EOF) {
  1059. X        output[i++] = ((c == '\n') ? ' ' : c);    /* newlines become blanks*/
  1060. X        if (i == max) {
  1061. #ifdef AMIGA_AC_5
  1062. X            (void) close(fd);
  1063. #else
  1064. X            (void) pclose(f);
  1065. #endif
  1066. X            int_error("substitution overflow", t_num);
  1067. X        }
  1068. X    }
  1069. #ifdef AMIGA_AC_5
  1070. X    (void) close(fd);
  1071. #else
  1072. X    (void) pclose(f);
  1073. #endif
  1074. X    if (i + strlen(last) > max)
  1075. X        int_error("substitution overflowed rest of line", t_num);
  1076. X    (void) strncpy(output+i,last+1,MAX_LINE_LEN-i);
  1077. X                                    /* tack on rest of line to output */
  1078. X    (void) strcpy(str,output);                /* now replace ` ` with output */
  1079. X    screen_ok = FALSE;
  1080. }
  1081. #endif /* AMIGA_LC_5_1 */
  1082. #endif /* MS-DOS */
  1083. SHAR_EOF
  1084. chmod 0644 gnuplot/scanner.c ||
  1085. echo 'restore of gnuplot/scanner.c failed'
  1086. Wc_c="`wc -c < 'gnuplot/scanner.c'`"
  1087. test 8676 -eq "$Wc_c" ||
  1088.     echo 'gnuplot/scanner.c: original size 8676, current size' "$Wc_c"
  1089. rm -f _shar_wnt_.tmp
  1090. fi
  1091. # ============= gnuplot/version.c ==============
  1092. if test -f 'gnuplot/version.c' -a X"$1" != X"-c"; then
  1093.     echo 'x - skipping gnuplot/version.c (File already exists)'
  1094.     rm -f _shar_wnt_.tmp
  1095. else
  1096. > _shar_wnt_.tmp
  1097. echo 'x - extracting gnuplot/version.c (Text)'
  1098. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/version.c' &&
  1099. /* GNUPLOT - version.c */
  1100. /*
  1101. X * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  1102. X *
  1103. X * Permission to use, copy, and distribute this software and its
  1104. X * documentation for any purpose with or without fee is hereby granted, 
  1105. X * provided that the above copyright notice appear in all copies and 
  1106. X * that both that copyright notice and this permission notice appear 
  1107. X * in supporting documentation.
  1108. X *
  1109. X * Permission to modify the software is granted, but not the right to
  1110. X * distribute the modified code.  Modifications are to be distributed 
  1111. X * as patches to released version.
  1112. X *  
  1113. X * This software is provided "as is" without express or implied warranty.
  1114. X * 
  1115. X *
  1116. X * AUTHORS
  1117. X * 
  1118. X *   Original Software:
  1119. X *     Thomas Williams,  Colin Kelley.
  1120. X * 
  1121. X *   Gnuplot 2.0 additions:
  1122. X *       Russell Lang, Dave Kotz, John Campbell.
  1123. X *
  1124. X *   Gnuplot 3.0 additions:
  1125. X *       Gershon Elber and many others.
  1126. X * 
  1127. X * Send your comments or suggestions to 
  1128. X *  pixar!info-gnuplot@sun.com.
  1129. X * This is a mailing list; to join it send a note to 
  1130. X *  pixar!info-gnuplot-request@sun.com.  
  1131. X * Send bug reports to
  1132. X *  pixar!bug-gnuplot@sun.com.
  1133. X */
  1134. X
  1135. char version[] = "3.0 ";
  1136. char patchlevel[] = "0, Sep 29 91";
  1137. char date[] = "Sun Sep 29 16:56:36 1991";
  1138. X
  1139. /* override in Makefile */
  1140. #ifndef CONTACT
  1141. # define CONTACT "pixar!bug-gnuplot@sun.com"
  1142. #endif
  1143. char bug_email[] = CONTACT;
  1144. SHAR_EOF
  1145. chmod 0644 gnuplot/version.c ||
  1146. echo 'restore of gnuplot/version.c failed'
  1147. Wc_c="`wc -c < 'gnuplot/version.c'`"
  1148. test 1368 -eq "$Wc_c" ||
  1149.     echo 'gnuplot/version.c: original size 1368, current size' "$Wc_c"
  1150. rm -f _shar_wnt_.tmp
  1151. fi
  1152. # ============= gnuplot/setshow.h ==============
  1153. if test -f 'gnuplot/setshow.h' -a X"$1" != X"-c"; then
  1154.     echo 'x - skipping gnuplot/setshow.h (File already exists)'
  1155.     rm -f _shar_wnt_.tmp
  1156. else
  1157. > _shar_wnt_.tmp
  1158. echo 'x - extracting gnuplot/setshow.h (Text)'
  1159. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/setshow.h' &&
  1160. /* GNUPLOT - setshow.h */
  1161. /*
  1162. X * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  1163. X *
  1164. X * Permission to use, copy, and distribute this software and its
  1165. X * documentation for any purpose with or without fee is hereby granted, 
  1166. X * provided that the above copyright notice appear in all copies and 
  1167. X * that both that copyright notice and this permission notice appear 
  1168. X * in supporting documentation.
  1169. X *
  1170. X * Permission to modify the software is granted, but not the right to
  1171. X * distribute the modified code.  Modifications are to be distributed 
  1172. X * as patches to released version.
  1173. X *  
  1174. X * This software is provided "as is" without express or implied warranty.
  1175. X * 
  1176. X *
  1177. X * AUTHORS
  1178. X * 
  1179. X *   Original Software:
  1180. X *     Thomas Williams,  Colin Kelley.
  1181. X * 
  1182. X *   Gnuplot 2.0 additions:
  1183. X *       Russell Lang, Dave Kotz, John Campbell.
  1184. X *
  1185. X *   Gnuplot 3.0 additions:
  1186. X *       Gershon Elber and many others.
  1187. X * 
  1188. X * Send your comments or suggestions to 
  1189. X *  pixar!info-gnuplot@sun.com.
  1190. X * This is a mailing list; to join it send a note to 
  1191. X *  pixar!info-gnuplot-request@sun.com.  
  1192. X * Send bug reports to
  1193. X *  pixar!bug-gnuplot@sun.com.
  1194. X */
  1195. X
  1196. /*
  1197. X * global variables to hold status of 'set' options
  1198. X *
  1199. X */
  1200. extern BOOLEAN            autoscale_r;
  1201. extern BOOLEAN            autoscale_t;
  1202. extern BOOLEAN            autoscale_u;
  1203. extern BOOLEAN            autoscale_v;
  1204. extern BOOLEAN            autoscale_x;
  1205. extern BOOLEAN            autoscale_y;
  1206. extern BOOLEAN            autoscale_z;
  1207. extern BOOLEAN            autoscale_lt;
  1208. extern BOOLEAN            autoscale_lu;
  1209. extern BOOLEAN            autoscale_lv;
  1210. extern BOOLEAN            autoscale_lx;
  1211. extern BOOLEAN            autoscale_ly;
  1212. extern BOOLEAN            autoscale_lz;
  1213. extern BOOLEAN            clip_points;
  1214. extern BOOLEAN            clip_lines1;
  1215. extern BOOLEAN            clip_lines2;
  1216. extern BOOLEAN            draw_border;
  1217. extern BOOLEAN            draw_surface;
  1218. extern BOOLEAN            timedate;
  1219. extern char            dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1];
  1220. extern char            xformat[];
  1221. extern char            yformat[];
  1222. extern char            zformat[];
  1223. extern enum PLOT_STYLE data_style, func_style;
  1224. extern BOOLEAN            grid;
  1225. extern int            key;
  1226. extern double            key_x, key_y, key_z; /* user specified position for key */
  1227. extern BOOLEAN            log_x, log_y, log_z;
  1228. extern FILE*            outfile;
  1229. extern char            outstr[];
  1230. extern BOOLEAN            parametric;
  1231. extern BOOLEAN            polar;
  1232. extern int            angles_format;
  1233. extern int            mapping3d;
  1234. extern int            samples;
  1235. extern int            iso_samples;
  1236. extern float            xsize; /* scale factor for size */
  1237. extern float            ysize; /* scale factor for size */
  1238. extern float            zsize; /* scale factor for size */
  1239. extern float            surface_rot_z;
  1240. extern float            surface_rot_x;
  1241. extern float            surface_scale;
  1242. extern float            surface_zscale;
  1243. extern int            term; /* unknown term is 0 */
  1244. extern char            term_options[];
  1245. extern char            title[];
  1246. extern char            xlabel[];
  1247. extern char            ylabel[];
  1248. extern char            zlabel[];
  1249. extern int            time_xoffset;
  1250. extern int            time_yoffset;
  1251. extern int            title_xoffset;
  1252. extern int            title_yoffset;
  1253. extern int            xlabel_xoffset;
  1254. extern int            xlabel_yoffset;
  1255. extern int            ylabel_xoffset;
  1256. extern int            ylabel_yoffset;
  1257. extern int            zlabel_xoffset;
  1258. extern int            zlabel_yoffset;
  1259. extern double            rmin, rmax;
  1260. extern double            tmin, tmax, umin, umax, vmin, vmax;
  1261. extern double            xmin, xmax, ymin, ymax, zmin, zmax;
  1262. extern double            loff, roff, toff, boff;
  1263. extern int            draw_contour;
  1264. extern int            contour_pts;
  1265. extern int            contour_kind;
  1266. extern int            contour_order;
  1267. extern int            contour_levels;
  1268. extern double            zero; /* zero threshold, not 0! */
  1269. X
  1270. extern BOOLEAN xzeroaxis;
  1271. extern BOOLEAN yzeroaxis;
  1272. X
  1273. extern BOOLEAN xtics;
  1274. extern BOOLEAN ytics;
  1275. extern BOOLEAN ztics;
  1276. X
  1277. extern float ticslevel;
  1278. X
  1279. extern struct ticdef xticdef;
  1280. extern struct ticdef yticdef;
  1281. extern struct ticdef zticdef;
  1282. X
  1283. extern BOOLEAN            tic_in;
  1284. X
  1285. extern struct text_label *first_label;
  1286. extern struct arrow_def *first_arrow;
  1287. X
  1288. /* The set and show commands, in setshow.c */
  1289. extern void set_command();
  1290. extern void show_command();
  1291. /* and some accessible support functions */
  1292. extern enum PLOT_STYLE get_style();
  1293. extern BOOLEAN load_range();
  1294. extern void show_version();
  1295. SHAR_EOF
  1296. chmod 0644 gnuplot/setshow.h ||
  1297. echo 'restore of gnuplot/setshow.h failed'
  1298. Wc_c="`wc -c < 'gnuplot/setshow.h'`"
  1299. test 3968 -eq "$Wc_c" ||
  1300.     echo 'gnuplot/setshow.h: original size 3968, current size' "$Wc_c"
  1301. rm -f _shar_wnt_.tmp
  1302. fi
  1303. # ============= gnuplot/standard.c ==============
  1304. if test -f 'gnuplot/standard.c' -a X"$1" != X"-c"; then
  1305.     echo 'x - skipping gnuplot/standard.c (File already exists)'
  1306.     rm -f _shar_wnt_.tmp
  1307. else
  1308. > _shar_wnt_.tmp
  1309. echo 'x - extracting gnuplot/standard.c (Text)'
  1310. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/standard.c' &&
  1311. /* GNUPLOT - standard.c */
  1312. /*
  1313. X * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  1314. X *
  1315. X * Permission to use, copy, and distribute this software and its
  1316. X * documentation for any purpose with or without fee is hereby granted, 
  1317. X * provided that the above copyright notice appear in all copies and 
  1318. X * that both that copyright notice and this permission notice appear 
  1319. X * in supporting documentation.
  1320. X *
  1321. X * Permission to modify the software is granted, but not the right to
  1322. X * distribute the modified code.  Modifications are to be distributed 
  1323. X * as patches to released version.
  1324. X *  
  1325. X * This software is provided "as is" without express or implied warranty.
  1326. X * 
  1327. X *
  1328. X * AUTHORS
  1329. X * 
  1330. X *   Original Software:
  1331. X *     Thomas Williams,  Colin Kelley.
  1332. X * 
  1333. X *   Gnuplot 2.0 additions:
  1334. X *       Russell Lang, Dave Kotz, John Campbell.
  1335. X *
  1336. X *   Gnuplot 3.0 additions:
  1337. X *       Gershon Elber and many others.
  1338. X * 
  1339. X * Send your comments or suggestions to 
  1340. X *  pixar!info-gnuplot@sun.com.
  1341. X * This is a mailing list; to join it send a note to 
  1342. X *  pixar!info-gnuplot-request@sun.com.  
  1343. X * Send bug reports to
  1344. X *  pixar!bug-gnuplot@sun.com.
  1345. X */
  1346. X
  1347. #include <math.h>
  1348. #include <stdio.h>
  1349. #include "plot.h"
  1350. X
  1351. #ifdef vms
  1352. #include <errno.h>
  1353. #else
  1354. extern int errno;
  1355. #endif /* vms */
  1356. X
  1357. X
  1358. extern struct value stack[STACK_DEPTH];
  1359. extern int s_p;
  1360. extern double zero;
  1361. X
  1362. struct value *pop(), *complex(), *integer();
  1363. X
  1364. double magnitude(), angle(), real(), imag();
  1365. X
  1366. /* The bessel function approximations here are from
  1367. X * "Computer Approximations"
  1368. X * by Hart, Cheney et al.
  1369. X * John Wiley & Sons, 1968
  1370. X */
  1371. X
  1372. /* There appears to be a mistake in Hart, Cheney et al. on page 149.
  1373. X * Where it list Qn(x)/x ~ P(z*z)/Q(z*z), z = 8/x, it should read
  1374. X *               Qn(x)/z ~ P(z*z)/Q(z*z), z = 8/x
  1375. X * In the functions below, Qn(x) is implementated using the later
  1376. X * equation.
  1377. X * These bessel functions are accurate to about 1e-13
  1378. X */
  1379. X
  1380. #define PI_ON_FOUR       0.78539816339744830961566084581987572
  1381. #define PI_ON_TWO        1.57079632679489661923131269163975144
  1382. #define THREE_PI_ON_FOUR 2.35619449019234492884698253745962716
  1383. #define TWO_ON_PI        0.63661977236758134307553505349005744
  1384. X
  1385. static double dzero = 0.0;
  1386. X
  1387. /* jzero for x in [0,8]
  1388. X * Index 5849, 19.22 digits precision
  1389. X */
  1390. static double pjzero[] = {
  1391. X     0.4933787251794133561816813446e+21,
  1392. X    -0.11791576291076105360384408e+21,
  1393. X     0.6382059341072356562289432465e+19,
  1394. X    -0.1367620353088171386865416609e+18,
  1395. X     0.1434354939140346111664316553e+16,
  1396. X    -0.8085222034853793871199468171e+13,
  1397. X     0.2507158285536881945555156435e+11,
  1398. X    -0.4050412371833132706360663322e+8,
  1399. X     0.2685786856980014981415848441e+5
  1400. };
  1401. X
  1402. static double qjzero[] = {
  1403. X    0.4933787251794133562113278438e+21,
  1404. X    0.5428918384092285160200195092e+19,
  1405. X    0.3024635616709462698627330784e+17,
  1406. X    0.1127756739679798507056031594e+15,
  1407. X    0.3123043114941213172572469442e+12,
  1408. X    0.669998767298223967181402866e+9,
  1409. X    0.1114636098462985378182402543e+7,
  1410. X    0.1363063652328970604442810507e+4,
  1411. X    0.1e+1
  1412. };
  1413. X
  1414. /* pzero for x in [8,inf]
  1415. X * Index 6548, 18.16 digits precision
  1416. X */
  1417. static double ppzero[] = {
  1418. X    0.2277909019730468430227002627e+5,
  1419. X    0.4134538663958076579678016384e+5,
  1420. X    0.2117052338086494432193395727e+5,
  1421. X    0.348064864432492703474453111e+4,
  1422. X    0.15376201909008354295771715e+3,
  1423. X    0.889615484242104552360748e+0
  1424. };
  1425. X
  1426. static double qpzero[] = {
  1427. X    0.2277909019730468431768423768e+5,
  1428. X    0.4137041249551041663989198384e+5,
  1429. X    0.2121535056188011573042256764e+5,
  1430. X    0.350287351382356082073561423e+4,
  1431. X    0.15711159858080893649068482e+3,
  1432. X    0.1e+1
  1433. };
  1434. X
  1435. /* qzero for x in [8,inf]
  1436. X * Index 6948, 18.33 digits precision
  1437. X */
  1438. static double pqzero[] = {
  1439. X    -0.8922660020080009409846916e+2,
  1440. X    -0.18591953644342993800252169e+3,
  1441. X    -0.11183429920482737611262123e+3,
  1442. X    -0.2230026166621419847169915e+2,
  1443. X    -0.124410267458356384591379e+1,
  1444. X    -0.8803330304868075181663e-2,
  1445. };
  1446. X
  1447. static double qqzero[] = {
  1448. X    0.571050241285120619052476459e+4,
  1449. X    0.1195113154343461364695265329e+5,
  1450. X    0.726427801692110188369134506e+4,
  1451. X    0.148872312322837565816134698e+4,
  1452. X    0.9059376959499312585881878e+2,
  1453. X    0.1e+1
  1454. };
  1455. X
  1456. X
  1457. /* yzero for x in [0,8]
  1458. X * Index 6245, 18.78 digits precision
  1459. X */
  1460. static double pyzero[] = {
  1461. X    -0.2750286678629109583701933175e+20,
  1462. X     0.6587473275719554925999402049e+20,
  1463. X    -0.5247065581112764941297350814e+19,
  1464. X     0.1375624316399344078571335453e+18,
  1465. X    -0.1648605817185729473122082537e+16,
  1466. X     0.1025520859686394284509167421e+14,
  1467. X    -0.3436371222979040378171030138e+11,
  1468. X     0.5915213465686889654273830069e+8,
  1469. X    -0.4137035497933148554125235152e+5
  1470. };
  1471. X
  1472. static double qyzero[] = {
  1473. X    0.3726458838986165881989980739e+21,
  1474. X    0.4192417043410839973904769661e+19,
  1475. X    0.2392883043499781857439356652e+17,
  1476. X    0.9162038034075185262489147968e+14,
  1477. X    0.2613065755041081249568482092e+12,
  1478. X    0.5795122640700729537380087915e+9,
  1479. X    0.1001702641288906265666651753e+7,
  1480. X    0.1282452772478993804176329391e+4,
  1481. X    0.1e+1
  1482. };
  1483. X
  1484. X
  1485. /* jone for x in [0,8]
  1486. X * Index 6050, 20.98 digits precision
  1487. X */
  1488. static double pjone[] = {
  1489. X     0.581199354001606143928050809e+21,
  1490. X    -0.6672106568924916298020941484e+20,
  1491. X     0.2316433580634002297931815435e+19,
  1492. X    -0.3588817569910106050743641413e+17,
  1493. X     0.2908795263834775409737601689e+15,
  1494. X    -0.1322983480332126453125473247e+13,
  1495. X     0.3413234182301700539091292655e+10,
  1496. X    -0.4695753530642995859767162166e+7,
  1497. X     0.270112271089232341485679099e+4
  1498. };
  1499. X
  1500. static double qjone[] = {
  1501. X    0.11623987080032122878585294e+22,
  1502. X    0.1185770712190320999837113348e+20,
  1503. X    0.6092061398917521746105196863e+17,
  1504. X    0.2081661221307607351240184229e+15,
  1505. X    0.5243710262167649715406728642e+12,
  1506. X    0.1013863514358673989967045588e+10,
  1507. X    0.1501793594998585505921097578e+7,
  1508. X    0.1606931573481487801970916749e+4,
  1509. X    0.1e+1
  1510. };
  1511. X
  1512. X
  1513. /* pone for x in [8,inf]
  1514. X * Index 6749, 18.11 digits precision
  1515. X */
  1516. static double ppone[] = {
  1517. X    0.352246649133679798341724373e+5,
  1518. X    0.62758845247161281269005675e+5,
  1519. X    0.313539631109159574238669888e+5,
  1520. X    0.49854832060594338434500455e+4,
  1521. X    0.2111529182853962382105718e+3,
  1522. X    0.12571716929145341558495e+1
  1523. };
  1524. X
  1525. static double qpone[] = {
  1526. X    0.352246649133679798068390431e+5,
  1527. X    0.626943469593560511888833731e+5,
  1528. X    0.312404063819041039923015703e+5,
  1529. X    0.4930396490181088979386097e+4,
  1530. X    0.2030775189134759322293574e+3,
  1531. X    0.1e+1
  1532. };
  1533. X
  1534. /* qone for x in [8,inf]
  1535. X * Index 7149, 18.28 digits precision
  1536. X */
  1537. static double pqone[] = {
  1538. X    0.3511751914303552822533318e+3,
  1539. X    0.7210391804904475039280863e+3,
  1540. X    0.4259873011654442389886993e+3,
  1541. X    0.831898957673850827325226e+2,
  1542. X    0.45681716295512267064405e+1,
  1543. X    0.3532840052740123642735e-1
  1544. };
  1545. X
  1546. static double qqone[] = {
  1547. X    0.74917374171809127714519505e+4,
  1548. X    0.154141773392650970499848051e+5,
  1549. X    0.91522317015169922705904727e+4,
  1550. X    0.18111867005523513506724158e+4,
  1551. X    0.1038187585462133728776636e+3,
  1552. X    0.1e+1
  1553. };
  1554. X
  1555. X
  1556. /* yone for x in [0,8]
  1557. X * Index 6444, 18.24 digits precision
  1558. X */
  1559. static double pyone[] = {
  1560. X    -0.2923821961532962543101048748e+20,
  1561. X     0.7748520682186839645088094202e+19,
  1562. X    -0.3441048063084114446185461344e+18,
  1563. X     0.5915160760490070618496315281e+16,
  1564. X    -0.4863316942567175074828129117e+14,
  1565. X     0.2049696673745662182619800495e+12,
  1566. X    -0.4289471968855248801821819588e+9,
  1567. X     0.3556924009830526056691325215e+6
  1568. };
  1569. X
  1570. static double qyone[] = {
  1571. X    0.1491311511302920350174081355e+21,
  1572. X    0.1818662841706134986885065935e+19,
  1573. X    0.113163938269888452690508283e+17,
  1574. X    0.4755173588888137713092774006e+14,
  1575. X    0.1500221699156708987166369115e+12,
  1576. X    0.3716660798621930285596927703e+9,
  1577. X    0.726914730719888456980191315e+6,
  1578. X    0.10726961437789255233221267e+4,
  1579. X    0.1e+1
  1580. };
  1581. X
  1582. X
  1583. f_real()
  1584. {
  1585. struct value a;
  1586. X    push( complex(&a,real(pop(&a)), 0.0) );
  1587. }
  1588. X
  1589. f_imag()
  1590. {
  1591. struct value a;
  1592. X    push( complex(&a,imag(pop(&a)), 0.0) );
  1593. }
  1594. X
  1595. f_arg()
  1596. {
  1597. struct value a;
  1598. X    push( complex(&a,angle(pop(&a)), 0.0) );
  1599. }
  1600. X
  1601. f_conjg()
  1602. {
  1603. struct value a;
  1604. X    (void) pop(&a);
  1605. X    push( complex(&a,real(&a),-imag(&a) ));
  1606. }
  1607. X
  1608. f_sin()
  1609. {
  1610. struct value a;
  1611. X    (void) pop(&a);
  1612. X    push( complex(&a,sin(real(&a))*cosh(imag(&a)), cos(real(&a))*sinh(imag(&a))) );
  1613. }
  1614. X
  1615. f_cos()
  1616. {
  1617. struct value a;
  1618. X    (void) pop(&a);
  1619. X    push( complex(&a,cos(real(&a))*cosh(imag(&a)), -sin(real(&a))*sinh(imag(&a))));
  1620. }
  1621. X
  1622. f_tan()
  1623. {
  1624. struct value a;
  1625. register double den;
  1626. X    (void) pop(&a);
  1627. X    if (imag(&a) == 0.0)
  1628. X        push( complex(&a,tan(real(&a)),0.0) );
  1629. X    else {
  1630. X        den = cos(2*real(&a))+cosh(2*imag(&a));
  1631. X        if (den == 0.0) {
  1632. X            undefined = TRUE;
  1633. X            push( &a );
  1634. X        }
  1635. X        else
  1636. X            push( complex(&a,sin(2*real(&a))/den, sinh(2*imag(&a))/den) );
  1637. X    }
  1638. }
  1639. X
  1640. f_asin()
  1641. {
  1642. struct value a;
  1643. register double alpha, beta, x, y;
  1644. X    (void) pop(&a);
  1645. X    x = real(&a); y = imag(&a);
  1646. X    if (y == 0.0) {
  1647. X        if (fabs(x) > 1.0) {
  1648. X            undefined = TRUE;
  1649. X            push(complex(&a,0.0, 0.0));
  1650. X        } else
  1651. X            push( complex(&a,asin(x),0.0) );
  1652. X    } else {
  1653. X        beta  = sqrt((x + 1)*(x + 1) + y*y)/2 - sqrt((x - 1)*(x - 1) + y*y)/2;
  1654. X        alpha = sqrt((x + 1)*(x + 1) + y*y)/2 + sqrt((x - 1)*(x - 1) + y*y)/2;
  1655. X        push( complex(&a,asin(beta), log(alpha + sqrt(alpha*alpha-1))) );
  1656. X    }
  1657. }
  1658. X
  1659. f_acos()
  1660. {
  1661. struct value a;
  1662. register double alpha, beta, x, y;
  1663. X    (void) pop(&a);
  1664. X    x = real(&a); y = imag(&a);
  1665. X    if (y == 0.0) {
  1666. X        if (fabs(x) > 1.0) {
  1667. X            undefined = TRUE;
  1668. X            push(complex(&a,0.0, 0.0));
  1669. X        } else
  1670. X            push( complex(&a,acos(x),0.0) );
  1671. X    } else {
  1672. X        alpha = sqrt((x + 1)*(x + 1) + y*y)/2 + sqrt((x - 1)*(x - 1) + y*y)/2;
  1673. X        beta  = sqrt((x + 1)*(x + 1) + y*y)/2 - sqrt((x - 1)*(x - 1) + y*y)/2;
  1674. X        push( complex(&a,acos(beta), log(alpha + sqrt(alpha*alpha-1))) );
  1675. X    }
  1676. }
  1677. X
  1678. f_atan()
  1679. {
  1680. struct value a;
  1681. register double x, y;
  1682. X    (void) pop(&a);
  1683. X    x = real(&a); y = imag(&a);
  1684. X    if (y == 0.0)
  1685. X        push( complex(&a,atan(x), 0.0) );
  1686. X    else if (x == 0.0 && fabs(y) == 1.0) {
  1687. X        undefined = TRUE;
  1688. X        push(complex(&a,0.0, 0.0));
  1689. X    } else
  1690. X        push( complex(&a,atan(2*x/(1-x*x-y*y)),
  1691. X                log((x*x+(y+1)*(y+1))/(x*x+(y-1)*(y-1)))/4) );
  1692. }
  1693. X
  1694. f_sinh()
  1695. {
  1696. struct value a;
  1697. X    (void) pop(&a);
  1698. X    push( complex(&a,sinh(real(&a))*cos(imag(&a)), cosh(real(&a))*sin(imag(&a))) );
  1699. }
  1700. X
  1701. f_cosh()
  1702. {
  1703. struct value a;
  1704. X    (void) pop(&a);
  1705. X    push( complex(&a,cosh(real(&a))*cos(imag(&a)), sinh(real(&a))*sin(imag(&a))) );
  1706. }
  1707. X
  1708. f_tanh()
  1709. {
  1710. struct value a;
  1711. register double den;
  1712. X    (void) pop(&a);
  1713. X    den = cosh(2*real(&a)) + cos(2*imag(&a));
  1714. X    push( complex(&a,sinh(2*real(&a))/den, sin(2*imag(&a))/den) );
  1715. }
  1716. X
  1717. f_int()
  1718. {
  1719. struct value a;
  1720. X    push( integer(&a,(int)real(pop(&a))) );
  1721. }
  1722. X
  1723. X
  1724. f_abs()
  1725. {
  1726. struct value a;
  1727. X    (void) pop(&a);
  1728. X    switch (a.type) {
  1729. X        case INT:
  1730. X            push( integer(&a,abs(a.v.int_val)) );            
  1731. X            break;
  1732. X        case CMPLX:
  1733. X            push( complex(&a,magnitude(&a), 0.0) );
  1734. X    }
  1735. }
  1736. X
  1737. f_sgn()
  1738. {
  1739. struct value a;
  1740. X    (void) pop(&a);
  1741. X    switch(a.type) {
  1742. X        case INT:
  1743. X            push( integer(&a,(a.v.int_val > 0) ? 1 : 
  1744. X                    (a.v.int_val < 0) ? -1 : 0) );
  1745. X            break;
  1746. X        case CMPLX:
  1747. X            push( integer(&a,(a.v.cmplx_val.real > 0.0) ? 1 : 
  1748. X                    (a.v.cmplx_val.real < 0.0) ? -1 : 0) );
  1749. X            break;
  1750. X    }
  1751. }
  1752. X
  1753. X
  1754. f_sqrt()
  1755. {
  1756. struct value a;
  1757. register double mag, ang;
  1758. X    (void) pop(&a);
  1759. X    mag = sqrt(magnitude(&a));
  1760. X    if (imag(&a) == 0.0 && real(&a) < 0.0)
  1761. X        push( complex(&a,0.0,mag) );
  1762. X    else
  1763. X    {
  1764. X        if ( (ang = angle(&a)) < 0.0)
  1765. X            ang += 2*Pi;
  1766. X        ang /= 2;
  1767. X        push( complex(&a,mag*cos(ang), mag*sin(ang)) );
  1768. X    }
  1769. }
  1770. X
  1771. X
  1772. f_exp()
  1773. {
  1774. struct value a;
  1775. register double mag, ang;
  1776. X    (void) pop(&a);
  1777. X    mag = exp(real(&a));
  1778. X    ang = imag(&a);
  1779. X    push( complex(&a,mag*cos(ang), mag*sin(ang)) );
  1780. }
  1781. X
  1782. X
  1783. f_log10()
  1784. {
  1785. struct value a;
  1786. register double l10;;
  1787. X    (void) pop(&a);
  1788. X    l10 = log(10.0);    /***** replace with a constant! ******/
  1789. X    push( complex(&a,log(magnitude(&a))/l10, angle(&a)/l10) );
  1790. }
  1791. X
  1792. X
  1793. f_log()
  1794. {
  1795. struct value a;
  1796. X    (void) pop(&a);
  1797. X    push( complex(&a,log(magnitude(&a)), angle(&a)) );
  1798. }
  1799. X
  1800. X
  1801. f_floor()
  1802. {
  1803. struct value a;
  1804. X
  1805. X    (void) pop(&a);
  1806. X    switch (a.type) {
  1807. X        case INT:
  1808. X            push( integer(&a,(int)floor((double)a.v.int_val)));            
  1809. X            break;
  1810. X        case CMPLX:
  1811. X            push( integer(&a,(int)floor(a.v.cmplx_val.real)));
  1812. X    }
  1813. }
  1814. X
  1815. X
  1816. f_ceil()
  1817. {
  1818. struct value a;
  1819. X
  1820. X    (void) pop(&a);
  1821. X    switch (a.type) {
  1822. X        case INT:
  1823. X            push( integer(&a,(int)ceil((double)a.v.int_val)));            
  1824. X            break;
  1825. X        case CMPLX:
  1826. X            push( integer(&a,(int)ceil(a.v.cmplx_val.real)));
  1827. X    }
  1828. }
  1829. X
  1830. #ifdef GAMMA
  1831. X
  1832. f_gamma()
  1833. {
  1834. extern int signgam;
  1835. register double y;
  1836. struct value a;
  1837. X
  1838. X    y = GAMMA(real(pop(&a)));
  1839. X    if (y > 88.0) {
  1840. X        undefined = TRUE;
  1841. X        push( integer(&a,0) );
  1842. X    }
  1843. X    else
  1844. X        push( complex(&a,signgam * exp(y),0.0) );
  1845. }
  1846. X
  1847. #endif /* GAMMA */
  1848. X
  1849. X
  1850. /* bessel function approximations */
  1851. double jzero(x)
  1852. double x;
  1853. {
  1854. double p, q, x2;
  1855. int n;
  1856. X
  1857. X    x2 = x * x;
  1858. X    p = pjzero[8];
  1859. X    q = qjzero[8];
  1860. X    for (n=7; n>=0; n--) {
  1861. X        p = p*x2 + pjzero[n];
  1862. X        q = q*x2 + qjzero[n];
  1863. X    }
  1864. X    return(p/q);
  1865. }
  1866. X
  1867. double pzero(x)
  1868. double x;
  1869. {
  1870. double p, q, z, z2;
  1871. int n;
  1872. X
  1873. X    z = 8.0 / x;
  1874. X    z2 = z * z;
  1875. X    p = ppzero[5];
  1876. X    q = qpzero[5];
  1877. X    for (n=4; n>=0; n--) {
  1878. X        p = p*z2 + ppzero[n];
  1879. SHAR_EOF
  1880. true || echo 'restore of gnuplot/standard.c failed'
  1881. fi
  1882. echo 'End of  part 23'
  1883. echo 'File gnuplot/standard.c is continued in part 24'
  1884. echo 24 > _shar_seq_.tmp
  1885. exit 0
  1886.  
  1887. exit 0 # Just in case...
  1888. -- 
  1889. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1890. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1891. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1892. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1893.