home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume24 / gnuplot3 / part22 < prev    next >
Encoding:
Text File  |  1991-10-28  |  48.3 KB  |  1,704 lines

  1. Newsgroups: comp.sources.misc
  2. From: gershon%gr@cs.utah.edu (Elber Gershon)
  3. Subject:  v24i044:  gnuplot3 - interactive function plotting utility, Part22/26
  4. Message-ID: <1991Oct29.031012.4118@sparky.imd.sterling.com>
  5. X-Md4-Signature: 7dfa54c568be48e0424cea0c0248a55d
  6. Date: Tue, 29 Oct 1991 03:10:12 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 44
  11. Archive-name: gnuplot3/part22
  12. Environment: UNIX, MS-DOS, VMS
  13. Supersedes: gnuplot2: Volume 11, Issue 65-79
  14.  
  15. #!/bin/sh
  16. # this is Part.22 (part 22 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file gnuplot/util.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" != 22; 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/util.c'
  34. else
  35. echo 'x - continuing file gnuplot/util.c'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/util.c' &&
  37. X            else {
  38. X                after = 1;
  39. X                start--;    /* back up token ptr */
  40. X                }
  41. X            }
  42. X        }
  43. X
  44. X    /* i now beyond end of token string */
  45. X
  46. X    return(after || str[i] == '$' || str[i] == '\0');
  47. }
  48. X
  49. X
  50. X
  51. isstring(t_num)
  52. int t_num;
  53. {
  54. X    
  55. X    return(token[t_num].is_token &&
  56. X           (input_line[token[t_num].start_index] == '\'' ||
  57. X           input_line[token[t_num].start_index] == '\"'));
  58. }
  59. X
  60. X
  61. isnumber(t_num)
  62. int t_num;
  63. {
  64. X    return(!token[t_num].is_token);
  65. }
  66. X
  67. X
  68. isletter(t_num)
  69. int t_num;
  70. {
  71. X    return(token[t_num].is_token &&
  72. X            (isalpha(input_line[token[t_num].start_index])));
  73. }
  74. X
  75. X
  76. /*
  77. X * is_definition() returns TRUE if the next tokens are of the form
  78. X *   identifier =
  79. X *        -or-
  80. X *   identifier ( identifer ) =
  81. X */
  82. is_definition(t_num)
  83. int t_num;
  84. {
  85. X    return (isletter(t_num) &&
  86. X            (equals(t_num+1,"=") ||            /* variable */
  87. X            (equals(t_num+1,"(") &&        /* function */
  88. X             isletter(t_num+2)   &&
  89. X             equals(t_num+3,")") &&
  90. X             equals(t_num+4,"=") ) ||
  91. X            (equals(t_num+1,"(") &&        /* function with */
  92. X             isletter(t_num+2)   &&        /* two variables */
  93. X             equals(t_num+3,",") &&
  94. X             isletter(t_num+4)   &&
  95. X             equals(t_num+5,")") &&
  96. X             equals(t_num+6,"=") )
  97. X        ));
  98. }
  99. X
  100. X
  101. X
  102. /*
  103. X * copy_str() copies the string in token number t_num into str, appending
  104. X *   a null.  No more than MAX_ID_LEN chars are copied.
  105. X */
  106. copy_str(str, t_num)
  107. char str[];
  108. int t_num;
  109. {
  110. register int i = 0;
  111. register int start = token[t_num].start_index;
  112. register int count;
  113. X
  114. X    if ((count = token[t_num].length) > MAX_ID_LEN)
  115. X        count = MAX_ID_LEN;
  116. X    do {
  117. X        str[i++] = input_line[start++];
  118. X        } while (i != count);
  119. X    str[i] = '\0';
  120. }
  121. X
  122. X
  123. /*
  124. X * quote_str() does the same thing as copy_str, except it ignores the
  125. X *   quotes at both ends.  This seems redundant, but is done for
  126. X *   efficency.
  127. X */
  128. quote_str(str, t_num)
  129. char str[];
  130. int t_num;
  131. {
  132. register int i = 0;
  133. register int start = token[t_num].start_index + 1;
  134. register int count;
  135. X
  136. X    if ((count = token[t_num].length - 2) > MAX_ID_LEN)
  137. X        count = MAX_ID_LEN;
  138. X    if (count>0) {
  139. X        do {
  140. X            str[i++] = input_line[start++];
  141. X            } while (i != count);
  142. X    }
  143. X    str[i] = '\0';
  144. }
  145. X
  146. X
  147. /*
  148. X * quotel_str() does the same thing as quote_str, except it uses
  149. X * MAX_LINE_LEN instead of MAX_ID_LEN. 
  150. X */ 
  151. quotel_str(str, t_num) 
  152. char str[]; 
  153. int t_num; 
  154. {
  155. register int i = 0;
  156. register int start = token[t_num].start_index + 1;
  157. register int count;
  158. X
  159. X    if ((count = token[t_num].length - 2) > MAX_LINE_LEN)
  160. X        count = MAX_LINE_LEN;
  161. X    if (count>0) {
  162. X        do {
  163. X            str[i++] = input_line[start++];
  164. X            } while (i != count);
  165. X    }
  166. X    str[i] = '\0';
  167. }
  168. X
  169. X
  170. /*
  171. X *    capture() copies into str[] the part of input_line[] which lies between
  172. X *    the begining of token[start] and end of token[end].
  173. X */
  174. capture(str,start,end)
  175. char str[];
  176. int start,end;
  177. {
  178. register int i,e;
  179. X
  180. X    e = token[end].start_index + token[end].length;
  181. X    for (i = token[start].start_index; i < e && input_line[i] != '\0'; i++)
  182. X        *str++ = input_line[i];
  183. X    *str = '\0';
  184. }
  185. X
  186. X
  187. /*
  188. X *    m_capture() is similar to capture(), but it mallocs storage for the
  189. X *  string.
  190. X */
  191. m_capture(str,start,end)
  192. char **str;
  193. int start,end;
  194. {
  195. register int i,e;
  196. register char *s;
  197. X
  198. X    if (*str)        /* previous pointer to malloc'd memory there */
  199. X        free(*str);
  200. X    e = token[end].start_index + token[end].length;
  201. X    *str = alloc((unsigned int)(e - token[start].start_index + 1), "string");
  202. X     s = *str;
  203. X     for (i = token[start].start_index; i < e && input_line[i] != '\0'; i++)
  204. X      *s++ = input_line[i];
  205. X     *s = '\0';
  206. }
  207. X
  208. X
  209. /*
  210. X *    m_quote_capture() is similar to m_capture(), but it removes
  211. X    quotes from either end if the string.
  212. X */
  213. m_quote_capture(str,start,end)
  214. char **str;
  215. int start,end;
  216. {
  217. register int i,e;
  218. register char *s;
  219. X
  220. X    if (*str)        /* previous pointer to malloc'd memory there */
  221. X        free(*str);
  222. X    e = token[end].start_index + token[end].length-1;
  223. X    *str = alloc((unsigned int)(e - token[start].start_index + 1), "string");
  224. X     s = *str;
  225. X    for (i = token[start].start_index + 1; i < e && input_line[i] != '\0'; i++)
  226. X     *s++ = input_line[i];
  227. X    *s = '\0';
  228. }
  229. X
  230. X
  231. convert(val_ptr, t_num)
  232. struct value *val_ptr;
  233. int t_num;
  234. {
  235. X    *val_ptr = token[t_num].l_val;
  236. }
  237. X
  238. static char *num_to_str(r)
  239. double r;
  240. {
  241. X    static i = 0;
  242. X    static char s[4][20];
  243. X    int j = i++;
  244. X
  245. X    if ( i > 3 ) i = 0;
  246. X
  247. X    sprintf( s[j], "%g", r );
  248. X    if ( strchr( s[j], '.' ) == NULL &&
  249. X         strchr( s[j], 'e' ) == NULL &&
  250. X         strchr( s[j], 'E' ) == NULL )
  251. X        strcat( s[j], ".0" );
  252. X
  253. X    return s[j];
  254. X
  255. disp_value(fp,val)
  256. FILE *fp;
  257. struct value *val;
  258. {
  259. X    switch(val->type) {
  260. X        case INT:
  261. X            fprintf(fp,"%d",val->v.int_val);
  262. X            break;
  263. X        case CMPLX:
  264. X            if (val->v.cmplx_val.imag != 0.0 )
  265. X                fprintf(fp,"{%s, %s}",
  266. X                    num_to_str(val->v.cmplx_val.real),
  267. X                    num_to_str(val->v.cmplx_val.imag));
  268. X            else
  269. X                fprintf(fp,"%s",
  270. X                    num_to_str(val->v.cmplx_val.real));
  271. X            break;
  272. X        default:
  273. X            int_error("unknown type in disp_value()",NO_CARET);
  274. X    }
  275. }
  276. X
  277. X
  278. double
  279. real(val)        /* returns the real part of val */
  280. struct value *val;
  281. {
  282. X    switch(val->type) {
  283. X        case INT:
  284. X            return((double) val->v.int_val);
  285. X        case CMPLX:
  286. X            return(val->v.cmplx_val.real);
  287. X    }
  288. X    int_error("unknown type in real()",NO_CARET);
  289. X    /* NOTREACHED */
  290. X    return((double)0.0);
  291. }
  292. X
  293. X
  294. double
  295. imag(val)        /* returns the imag part of val */
  296. struct value *val;
  297. {
  298. X    switch(val->type) {
  299. X        case INT:
  300. X            return(0.0);
  301. X        case CMPLX:
  302. X            return(val->v.cmplx_val.imag);
  303. X    }
  304. X    int_error("unknown type in imag()",NO_CARET);
  305. X    /* NOTREACHED */
  306. X    return((double)0.0);
  307. }
  308. X
  309. X
  310. X
  311. double
  312. magnitude(val)        /* returns the magnitude of val */
  313. struct value *val;
  314. {
  315. X    switch(val->type) {
  316. X        case INT:
  317. X            return((double) abs(val->v.int_val));
  318. X        case CMPLX:
  319. X            return(sqrt(val->v.cmplx_val.real*
  320. X                    val->v.cmplx_val.real +
  321. X                    val->v.cmplx_val.imag*
  322. X                    val->v.cmplx_val.imag));
  323. X    }
  324. X    int_error("unknown type in magnitude()",NO_CARET);
  325. X    /* NOTREACHED */
  326. X    return((double)0.0);
  327. }
  328. X
  329. X
  330. X
  331. double
  332. angle(val)        /* returns the angle of val */
  333. struct value *val;
  334. {
  335. X    switch(val->type) {
  336. X        case INT:
  337. X            return((val->v.int_val > 0) ? 0.0 : Pi);
  338. X        case CMPLX:
  339. X            if (val->v.cmplx_val.imag == 0.0) {
  340. X                if (val->v.cmplx_val.real >= 0.0)
  341. X                    return(0.0);
  342. X                else
  343. X                    return(Pi);
  344. X            }
  345. X            return(atan2(val->v.cmplx_val.imag,
  346. X                     val->v.cmplx_val.real));
  347. X    }
  348. X    int_error("unknown type in angle()",NO_CARET);
  349. X    /* NOTREACHED */
  350. X    return((double)0.0);
  351. }
  352. X
  353. X
  354. struct value *
  355. complex(a,realpart,imagpart)
  356. struct value *a;
  357. double realpart, imagpart;
  358. {
  359. X    a->type = CMPLX;
  360. X    a->v.cmplx_val.real = realpart;
  361. X    a->v.cmplx_val.imag = imagpart;
  362. X    return(a);
  363. }
  364. X
  365. X
  366. struct value *
  367. integer(a,i)
  368. struct value *a;
  369. int i;
  370. {
  371. X    a->type = INT;
  372. X    a->v.int_val = i;
  373. X    return(a);
  374. }
  375. X
  376. X
  377. X
  378. os_error(str,t_num)
  379. char str[];
  380. int t_num;
  381. {
  382. #ifdef vms
  383. static status[2] = {1, 0};        /* 1 is count of error msgs */
  384. #endif
  385. X
  386. register int i;
  387. X
  388. X    /* reprint line if screen has been written to */
  389. X
  390. X    if (t_num != NO_CARET) {        /* put caret under error */
  391. X        if (!screen_ok)
  392. X            fprintf(stderr,"\n%s%s\n", PROMPT, input_line);
  393. X
  394. X        for (i = 0; i < sizeof(PROMPT) - 1; i++)
  395. X            (void) putc(' ',stderr);
  396. X        for (i = 0; i < token[t_num].start_index; i++) {
  397. X            (void) putc((input_line[i] == '\t') ? '\t' : ' ',stderr);
  398. X            }
  399. X        (void) putc('^',stderr);
  400. X        (void) putc('\n',stderr);
  401. X    }
  402. X
  403. X    for (i = 0; i < sizeof(PROMPT) - 1; i++)
  404. X        (void) putc(' ',stderr);
  405. X    fprintf(stderr,"%s\n",str);
  406. X
  407. X    for (i = 0; i < sizeof(PROMPT) - 1; i++)
  408. X        (void) putc(' ',stderr);
  409. X     if (!interactive)
  410. X      if (infile_name != NULL)
  411. X        fprintf(stderr,"\"%s\", line %d: ", infile_name, inline_num);
  412. X      else
  413. X        fprintf(stderr,"line %d: ", inline_num);
  414. X
  415. X
  416. #ifdef vms
  417. X    status[1] = vaxc$errno;
  418. X    sys$putmsg(status);
  419. X    (void) putc('\n',stderr);
  420. #else
  421. #ifdef __ZTC__
  422. X    fprintf(stderr,"error number %d\n\n",errno);
  423. #else
  424. X    if (errno >= sys_nerr)
  425. X        fprintf(stderr, "unknown errno %d\n\n", errno);
  426. X    else
  427. X        fprintf(stderr,"(%s)\n\n",sys_errlist[errno]);
  428. #endif
  429. #endif
  430. X
  431. X    longjmp(env, TRUE);    /* bail out to command line */
  432. }
  433. X
  434. X
  435. int_error(str,t_num)
  436. char str[];
  437. int t_num;
  438. {
  439. register int i;
  440. X
  441. X    /* reprint line if screen has been written to */
  442. X
  443. X    if (t_num != NO_CARET) {        /* put caret under error */
  444. X        if (!screen_ok)
  445. X            fprintf(stderr,"\n%s%s\n", PROMPT, input_line);
  446. X
  447. X        for (i = 0; i < sizeof(PROMPT) - 1; i++)
  448. X            (void) putc(' ',stderr);
  449. X        for (i = 0; i < token[t_num].start_index; i++) {
  450. X            (void) putc((input_line[i] == '\t') ? '\t' : ' ',stderr);
  451. X            }
  452. X        (void) putc('^',stderr);
  453. X        (void) putc('\n',stderr);
  454. X    }
  455. X
  456. X    for (i = 0; i < sizeof(PROMPT) - 1; i++)
  457. X        (void) putc(' ',stderr);
  458. X     if (!interactive)
  459. X      if (infile_name != NULL)
  460. X        fprintf(stderr,"\"%s\", line %d: ", infile_name, inline_num);
  461. X      else
  462. X        fprintf(stderr,"line %d: ", inline_num);
  463. X     fprintf(stderr,"%s\n\n", str);
  464. X
  465. X    longjmp(env, TRUE);    /* bail out to command line */
  466. }
  467. X
  468. /* Lower-case the given string (DFK) */
  469. /* Done in place. */
  470. void
  471. lower_case(s)
  472. X     char *s;
  473. {
  474. X  register char *p = s;
  475. X
  476. X  while (*p != '\0') {
  477. X    if (isupper(*p))
  478. X     *p = tolower(*p);
  479. X    p++;
  480. X  }
  481. }
  482. X
  483. /* Squash spaces in the given string (DFK) */
  484. /* That is, reduce all multiple white-space chars to single spaces */
  485. /* Done in place. */
  486. void
  487. squash_spaces(s)
  488. X     char *s;
  489. {
  490. X  register char *r = s;        /* reading point */
  491. X  register char *w = s;        /* writing point */
  492. X  BOOLEAN space = FALSE;        /* TRUE if we've already copied a space */
  493. X
  494. X  for (w = r = s; *r != '\0'; r++) {
  495. X     if (isspace(*r)) {
  496. X        /* white space; only copy if we haven't just copied a space */
  497. X        if (!space) {
  498. X            space = TRUE;
  499. X            *w++ = ' ';
  500. X        }                /* else ignore multiple spaces */
  501. X     } else {
  502. X        /* non-space character; copy it and clear flag */
  503. X        *w++ = *r;
  504. X        space = FALSE;
  505. X     }
  506. X  }
  507. X  *w = '\0';                /* null terminate string */
  508. }
  509. X
  510. SHAR_EOF
  511. echo 'File gnuplot/util.c is complete' &&
  512. chmod 0644 gnuplot/util.c ||
  513. echo 'restore of gnuplot/util.c failed'
  514. Wc_c="`wc -c < 'gnuplot/util.c'`"
  515. test 12714 -eq "$Wc_c" ||
  516.     echo 'gnuplot/util.c: original size 12714, current size' "$Wc_c"
  517. rm -f _shar_wnt_.tmp
  518. fi
  519. # ============= gnuplot/makefile.unx ==============
  520. if test -f 'gnuplot/makefile.unx' -a X"$1" != X"-c"; then
  521.     echo 'x - skipping gnuplot/makefile.unx (File already exists)'
  522.     rm -f _shar_wnt_.tmp
  523. else
  524. > _shar_wnt_.tmp
  525. echo 'x - extracting gnuplot/makefile.unx (Text)'
  526. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.unx' &&
  527. ############################################################
  528. #
  529. # GNUPLOT 3.0 Makefile (Unix X11 Motif/Athena support) for
  530. #  Apollo/Sun/Dec5000/IBMrs6000/HP9000/SGI/3B1/386IX
  531. #
  532. # Original version by:
  533. #   oliveria@caen.engin.umich.edu (ROQUE DONIZETE DE OLIVEIRA)
  534. #   Wed, 3 Jul 91 14:31:37 -0400
  535. #
  536. #>>> Customizing: You must customize part of this makefile for your site.
  537. #>>> Then type 'make' for further instructions.
  538. #>>> Customization instructions look like these lines do (#>>>).
  539. #
  540. X
  541. TARGET = All # What to make by default
  542. X
  543. ############################################################
  544. #>>> Decide where the binaries and manuals will go. 
  545. # directory where to install executables on 'make install'
  546. DEST=/usr/local/bin
  547. # directory for installing man page on 'make man_install'.
  548. MANDEST=/usr/man/manl
  549. # where to install help file gnuplot.gih
  550. HELPDEST=/usr/local/lib/gnuplot.gih
  551. #HELPDEST=docs/gnuplot.gih
  552. # Where to send email about bugs and comments (locally)
  553. EMAIL=bug-gnuplot%pixar.uucp@sun.com
  554. X
  555. ############################################################
  556. #>>> Choose your C compiler and basic compiler flags.
  557. CC     = cc # the C compiler
  558. COPTS  = -O # -O if you trust your compiler's optimizer
  559. LD     =$(CC) $(CFLAGS)        # default loading command
  560. X
  561. ############################################################
  562. #>>> Choose some optional features. 
  563. #>>> At this point there are only two optional features:
  564. # READLINE:
  565. #   If READLINE is defined, then command-line editing is supported.
  566. #   Otherwise, your normal terminal editing is all you get.
  567. #   Some machines will not support this, and they will turn this
  568. #   option off (for example, apollos running SR10.2 or SR10.3 and
  569. #   loaded with BSD4.3 instead of SYS5). 
  570. # NOCWDRC:
  571. #   If NOCWDRC is defined, then any .gnuplot in the current directory
  572. #   is not read on startup. This is a security consideration
  573. #   especially for root users ( we recommend you define -DNOCWDRC ).
  574. OPTIONS = -DREADLINE -DNOCWDRC
  575. X
  576. #>>> Optionally install the lasergnu script.
  577. # Lasergnu is a handy shell script for creating a plot from the
  578. # command line and sending it directly to the printer. It currently
  579. # supports postscript and imagen printers, and probably would need
  580. # tailoring to your site.
  581. # Use lasergnu_install to install lasergnu.
  582. # Use lasergnu_noinstall to not install lasergnu (default).
  583. LASERGNU = lasergnu_noinstall
  584. X
  585. ############################################################
  586. # X11 support
  587. #
  588. X
  589. #>>> List your X11 libraries#
  590. # standard MIT X11 R4:                      -lXaw -lXmu -lXt -lXext -lX11
  591. # Apollo DomainOS 10.3 (R3/Athena):         -L/usr/lib/X11 -lXaw -lXmu -lXt -lX11
  592. # Apollo DomainOS 10.3 (R3/Motif):          -L/usr/lib/X11 -lXm -lXtm -lX11
  593. # IBM RS/6000 AIX 3.1 (R3/Athena):          -L/usr/lpp/X11/Xamples/lib/Xmu \
  594. #                                           -L/usr/lpp/X11/Xamples/lib/Xaw \
  595. #                                           -lXaw -lXmu -lXt -lXext -lX11
  596. # IBM RS/6000 AIX 3.1 (R3/Motif):           -lXm -lXt -lX11
  597. # HP 9000/375 HP-UX 6.5 and 7.0 (R3/Motif): -lXm -lXt -lX11
  598. # Interactive 386/ix with T.Roell X386 and network support:
  599. #                                           -lXaw -lXm -lXt -lXext -lX11 -linet -lpt
  600. XX11LIBS = -lXaw -lXmu -lXt -lXext -lX11
  601. X
  602. #>>> List your X11 include directories
  603. # standard MIT X11 R4: -I/usr/include/X11   -I/usr/include/X11/Xaw 
  604. # Apollo DomainOS 10.3 (R3/Athena):         -I/usr/include/X11
  605. # Apollo DomainOS 10.3 (R3/Motif):          -I/usr/include/Xm
  606. # IBM RS/6000 AIX 3.1 (R3/Athena):          -I/usr/include/X11 \
  607. #                                           -I/usr/lpp/X11/Xamples/lib/Xaw \
  608. #                                           -I/usr/lpp/X11/Xamples/lib/Xaw/X11
  609. # IBM RS/6000 AIX 3.1 (R3/Motif):           -I/usr/include/Xm
  610. # HP 9000/375 HP-UX 6.5 and 7.0 (R3/Motif): -I/usr/include/Xm
  611. # HP 9000/700 HP-UX 8.0 (R4):               -I/usr/include/X11R4 \
  612. #                                           -I/usr/include/X11R4/X11/Xaw
  613. XX11INCLUDES = -I/usr/include/X11 -I/usr/include/X11/Xaw
  614. X
  615. #>>> You shouldn't have to change these, since they are controlled by
  616. #>>> Machine dependent definitions below.
  617. #       Compile option for plot.c and TERMFLAGS, to include X11 support
  618. PLOTXFLAG = -DX11
  619. #          this can add to CFLAGS for X11 compilations. Probably needs no change.
  620. XX11FLAGS = 
  621. #       make gnuplot_x11 by default
  622. GNUPLOT_X11 = gnuplot_x11
  623. #       install gnuplot_x11 by default
  624. XX11INSTALL = x11_install
  625. X
  626. ############################################################
  627. #>>> Okay, you've changed enough. Now type 'make'.
  628. X
  629. ############################################################
  630. # This is used to pass many of the above definitions to make
  631. # subprocesses. Don't change this.
  632. MY_FLAGS  = CC="$(CC)"     COPTS="$(COPTS)" DEST="$(DEST)" \
  633. X        MANDEST="$(MANDEST)" HELPDEST="$(HELPDEST)" \
  634. X        EMAIL="$(EMAIL)" LASERGNU="$(LASERGNU)"
  635. X
  636. ############################################################
  637. # Explanations of CFLAGS definitions.
  638. #  These should not need to be changed by you.
  639. # They are set correctly for each machine below. If your machine
  640. # doesn't fit the one of the patterns, override on the make command
  641. # line or make a new target for it and a new _FLAGS definition. 
  642. #  -DNOVFORK if you're unix and you have don't have vfork()
  643. #  -DMEMSET if you need to use memset() instead of bzero() 
  644. #  -DMEMCPY if your bcopy() is called memcpy()
  645. #  -DNOCOPY if you don't have a memcpy() by any name
  646. #  -DGAMMA=foo if your gamma function is called foo(). Apollos have
  647. #    lgamma(3m). If you don't have gamma(), use -DNOGAMMA.
  648. #    The default is -DGAMMA=gamma.
  649. #  -DGETCWD if your unix uses getcwd() instead of getcd()
  650. #    this is needed by HP-UX and Cray Unicos systems.
  651. #  -DULTRIX_KLUDGE if you run X windows on Ultrix and experience the
  652. #    "every other plot" problem.
  653. #  -Dunix is required to explicitly define "unix" for SCO and IBM
  654. #          RS/6000 running AIX 3.1 
  655. #  -fswitch if you are compiling on a Sun3 (or even -f68881)
  656. #    (but -fswitch is buggy on some systems, so watch out)
  657. X
  658. # Defaults in case the user types 'make All' directly
  659. # Should match X11R4_FLAGS's CFLAGS definition
  660. CFLAGS = $(COPTS) $(OPTIONS)
  661. X
  662. ############################################################
  663. # Terminal (device) support
  664. #
  665. # All devices available to a given machine are compiled in by default.
  666. # This documents the flags available in TERMFLAGS, although TERMFLAGS
  667. # is usually controlled by the machine-dependent definitions below.
  668. # See other terminal defines in term.h.
  669. # Define ULTRIX_KLUDGE if you have the every-other plot problem in Ultrix X11.
  670. #
  671. # -DAPOLLO      Apollo Graphics Primitive Resource (window resize after replot)
  672. # -DGPR         Apollo Graphics Primitive Resource (fixed-size window)
  673. # -DCGI         SCO CGI
  674. # -DIRIS4D      IRIS4D series computer
  675. # -DSUN         Sun Microsystems Workstation
  676. # -DUNIXPC      unixpc (ATT 3b1 or ATT 7300)
  677. # -DUNIXPLOT    unixplot
  678. # -DX11         X11 Window System (This is $(PLOTXFLAG))
  679. TERMFLAGS = -Iterm -DUNIXPLOT $(PLOTXFLAG)
  680. X
  681. ############################################################
  682. # Library explanations. 
  683. #  You shouldn't need to adjust this; again, it is handled by the
  684. # machine-dependent definitions below.
  685. #
  686. #  -lplot if you have -DUNIXPLOT in TERMFLAGS
  687. #  -lsuntool -lsunwindow -lpixrect  if you have -DSUN in TERMFLAGS
  688. #  -lgl_s if -DIRIS4D in TERMFLAGS
  689. #  -lccgi if -DCGI in TERMFLAGS
  690. LIBS = -lm -lplot
  691. X
  692. ############################################################
  693. # Machine-dependent settings.
  694. #
  695. XX11R4_FLAGS = \
  696. X           CFLAGS="$(COPTS) $(OPTIONS)" \
  697. X           LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  698. X           X11LIBS="$(X11LIBS)" \
  699. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  700. X           X11INSTALL="$(X11INSTALL)" \
  701. X           TERMFLAGS="$(TERMFLAGS)"
  702. X
  703. XX11R4_M_FLAGS = \
  704. X           CFLAGS="$(COPTS) $(OPTIONS)" \
  705. X           LIBS="$(LIBS)" X11FLAGS="-DMOTIF -D_NO_PROTO" \
  706. X           X11INCLUDES="-I/usr/include/Xm" \
  707. X           X11LIBS="-lXm -lXt -lX11" \
  708. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  709. X           X11INSTALL="$(X11INSTALL)" \
  710. X           TERMFLAGS="$(TERMFLAGS)"
  711. X
  712. DEC_FLAGS = \
  713. X           CFLAGS="$(COPTS) $(OPTIONS) " \
  714. X           LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  715. X           X11LIBS="$(X11LIBS)" \
  716. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  717. X           X11INSTALL="$(X11INSTALL)" \
  718. X           TERMFLAGS="$(TERMFLAGS) -DULTRIX_KLUDGE"
  719. X
  720. DEC_M_FLAGS = \
  721. X           CFLAGS="$(COPTS) $(OPTIONS)" \
  722. X           LIBS="$(LIBS)" X11FLAGS="-DMOTIF -D_NO_PROTO" \
  723. X           X11INCLUDES="-I/usr/include/Xm" \
  724. X           X11LIBS="-lXm -lXt -lX11" \
  725. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  726. X           X11INSTALL="$(X11INSTALL)" \
  727. X           TERMFLAGS="$(TERMFLAGS)  -DULTRIX_KLUDGE"
  728. X
  729. APOLLO_FLAGS = \
  730. X           CFLAGS="$(COPTS) $(OPTIONS)  -DGAMMA=lgamma" \
  731. X           LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" \
  732. X           X11INCLUDES="-I/usr/include/X11" \
  733. X           X11LIBS="-L/usr/lib/X11 -lXaw -lXmu -lXt -lX11" \
  734. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  735. X           X11INSTALL="$(X11INSTALL)" \
  736. X           TERMFLAGS="$(TERMFLAGS) -DAPOLLO -DGPR"
  737. X
  738. APOLLO_M_FLAGS = \
  739. X           CFLAGS="$(COPTS) $(OPTIONS)  -DGAMMA=lgamma" \
  740. X           LIBS="$(LIBS)" X11FLAGS="-DMOTIF" X11INCLUDES="-I/usr/include/Xm" \
  741. X           X11LIBS="-L/usr/lib/X11 -lXm -lXt -lX11" \
  742. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  743. X           TERMFLAGS="$(TERMFLAGS) -DAPOLLO -DGPR"
  744. X
  745. HP_FLAGS = \
  746. X           CFLAGS="$(COPTS) $(OPTIONS) -DMEMSET -DMEMCPY  -DGETCWD" \
  747. X           LIBS="-lm" X11FLAGS="$(X11FLAGS)" \
  748. X           X11INCLUDES="-I/usr/include/X11R4 -I/usr/include/X11R4/X11/Xaw" \
  749. X           X11LIBS="-L/usr/lib/X11R4 -lXaw -lXmu -lXt -lXext -lX11" \
  750. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  751. X           X11INSTALL="$(X11INSTALL)" \
  752. X           TERMFLAGS="-Iterm -DX11"
  753. X
  754. SUN_FLAGS = \
  755. X           CFLAGS="$(COPTS) $(OPTIONS)" \
  756. X           LIBS="-lsuntool -lsunwindow -lpixrect $(LIBS)" \
  757. X           X11FLAGS=" " X11INCLUDES=" " \
  758. X           X11LIBS=" " \
  759. X           PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  760. X           TERMFLAGS="-Iterm -DUNIXPLOT -DSUN"
  761. X
  762. SUN_X11_FLAGS = \
  763. X           CFLAGS="$(COPTS) $(OPTIONS)" \
  764. X           LIBS="-lsuntool -lsunwindow -lpixrect $(LIBS)" \
  765. X           X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  766. X           X11LIBS="$(X11LIBS)" \
  767. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  768. X           X11INSTALL="$(X11INSTALL)" \
  769. X           TERMFLAGS="$(TERMFLAGS) -DSUN"
  770. X
  771. SGI_FLAGS = \
  772. X           CFLAGS="$(COPTS) $(OPTIONS)" \
  773. X           LIBS="-lgl_s -lm" X11FLAGS=" " X11INCLUDES=" " \
  774. X           X11LIBS=" " \
  775. X           PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  776. X           TERMFLAGS="-Iterm -DIRIS4D"
  777. X
  778. SGIX11_FLAGS = \
  779. X           CFLAGS="$(COPTS) $(OPTIONS)" \
  780. X           LIBS="-lm" X11FLAGS="$(X11FLAGS)" \
  781. X           X11INCLUDES="-I/usr/include/X11 -I/usr/include/X11/Xaw" \
  782. X           X11LIBS="-L/usr/lib/X11 -lXaw -lXmu -lXt -lXext -lX11" \
  783. X            PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  784. X            X11INSTALL="$(X11INSTALL)" \
  785. X           TERMFLAGS="-Iterm -DX11"
  786. X
  787. CGI_FLAGS = \
  788. X           CFLAGS="$(COPTS) $(OPTIONS) -Dunix" \
  789. X           LIBS="-lccgi $(LIBS)" X11FLAGS=" " X11INCLUDES=" " \
  790. X           X11LIBS=" " PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  791. X           TERMFLAGS="-Iterm -DUNIXPLOT -DCGI"
  792. X
  793. 3B1_FLAGS = \
  794. X           CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK" \
  795. X           LIBS="$(LIBS)" X11FLAGS=" " X11INCLUDES=" " \
  796. X           X11LIBS=" " \
  797. X           PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  798. X           LD="ld /lib/crt0s.o /lib/shlib.ifile" \
  799. X           TERMFLAGS="-Iterm -DUNIXPC"
  800. X
  801. 386IX_FLAGS = \
  802. X           CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK -DTCSETSW -DTCGETS" \
  803. X           LIBS="$(LIBS) -lcposix" X11FLAGS=" " X11INCLUDES=" " \
  804. X           X11LIBS=" " PLOTXFLAG=" " GNUPLOT_X11=" " \
  805. X           X11INSTALL=x11_noinstall \
  806. X           TERMFLAGS="-Iterm -DUNIXPLOT"
  807. 386IX_X11_FLAGS = \
  808. X           CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK -DTCSETSW -DTCGETS" \
  809. X           LIBS="$(LIBS) -lcposix" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  810. X           X11LIBS="$(X11LIBS)" PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11="$(GNUPLOT_X11)" \
  811. X           X11INSTALL= "$(X11INSTALL)" \
  812. X           TERMFLAGS="-Iterm -DUNIXPLOT -DX11"
  813. X     
  814. AIX_FLAGS = \
  815. X           CFLAGS="$(COPTS) $(OPTIONS) -Dunix -DNOVFORK" \
  816. X           LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" \
  817. X           X11INCLUDES="-I/usr/include/X11 -I/usr/lpp/X11/Xamples/lib/Xaw -I/usr/lpp/X11/Xamples/lib/Xaw/X11" \
  818. X           X11LIBS="-L/usr/lpp/X11/Xamples/lib/Xmu -L/usr/lpp/X11/Xamples/lib/Xaw -lXaw -lXmu -lXt -lXext -lX11" \
  819. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  820. X           X11INSTALL="$(X11INSTALL)" \
  821. X           TERMFLAGS="$(TERMFLAGS)"
  822. X
  823. AIX_M_FLAGS = \
  824. X           CFLAGS="$(COPTS) $(OPTIONS) -Dunix -DNOVFORK" \
  825. X           LIBS="$(LIBS)" X11FLAGS="-DMOTIF" X11INCLUDES="-I/usr/include/Xm" \
  826. X           X11LIBS="-lXm -lXt -lX11" \
  827. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  828. X           X11INSTALL="$(X11INSTALL)" \
  829. X           TERMFLAGS="$(TERMFLAGS)"
  830. X
  831. NEXT_FLAGS = \
  832. X           CFLAGS="$(COPTS) -DNOCWDRC -DGAMMA=lgamma -DNEXT" \
  833. X           LIBS="-lm" X11FLAGS="$(X11FLAGS)" \
  834. X           X11INCLUDES=" " X11LIBS=" " PLOTXFLAG=" " \
  835. X           GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  836. X           TERMFLAGS="-Iterm"
  837. X
  838. ####################################################################
  839. # List of object files except version.o
  840. OBJS = bitmap.o command.o contour.o eval.o graphics.o graph3d.o help.o \
  841. X       internal.o misc.o parse.o plot.o readline.o scanner.o \
  842. X       setshow.o standard.o term.o util.o  
  843. ####################################################################
  844. # List of source files
  845. # Used for makeing shar files, lint, and some dependencies.
  846. DIRS = term demo docs docs/latextut
  847. X
  848. CSOURCE1 = command.c setshow.c 
  849. CSOURCE2 = help.c graphics.c graph3d.c internal.c 
  850. CSOURCE3 = misc.c eval.c parse.c plot.c readline.c scanner.c standard.c 
  851. CSOURCE4 = bitmap.c term.c util.c version.c
  852. CSOURCE5 = term/amiga.trm term/aed.trm term/cgi.trm term/dumb.trm term/dxf.trm \
  853. X    term/dxy.trm term/eepic.trm term/epson.trm term/fig.trm \
  854. X    term/hp26.trm term/hp2648.trm term/hpgl.trm term/hpljii.trm \
  855. X    term/apollo.trm term/gpr.trm
  856. CSOURCE6 = term/impcodes.h term/imagen.trm term/object.h \
  857. X    term/iris4d.trm term/kyo.trm term/latex.trm term/pc.trm 
  858. CSOURCE7 = term/post.trm term/qms.trm term/regis.trm term/sun.trm \
  859. X    term/t410x.trm term/tek.trm term/unixpc.trm term/unixplot.trm \
  860. X    term/v384.trm term/x11.trm term/bigfig.trm term/vws.trm gnuplot_x11.c
  861. CSOURCE8 = contour.c
  862. # not C code, but still needed
  863. X
  864. DEMOS = demo/1.dat demo/2.dat demo/3.dat demo/contours.demo demo/controls.demo \
  865. X    demo/electron.demo demo/glass.dat demo/param.demo demo/polar.demo \
  866. X    demo/simple.demo demo/surface1.demo demo/surface2.demo demo/using.dat \
  867. X    demo/using.demo demo/world.cor demo/world.dat demo/world.demo \
  868. X    demo/err.dat demo/poldat.demo demo/polar.dat demo/errorbar.demo \
  869. X    demo/antenna.dat demo/all.demo demo/bivariat.demo
  870. X
  871. ETC = Copyright README README.gnutex README.amiga makefile.unx makefile.vms  \
  872. X    linkopt.amg makefile.amg makefile.ami linkopt.vms buildvms.com \
  873. X    plot.h help.h setshow.h bitmap.h term.h lasergnu \
  874. X    term/README History gnuplot.el Intergraph.x11 README.Install
  875. X
  876. #BETA files (not standard distribution files)
  877. BETA = BETA10
  878. # PC-specific files
  879. PC = corgraph.asm corplot.c header.mac hrcgraph.asm lineproc.mac \
  880. X    linkopt.msc linkopt.tc linkopt.tco makefile.msc makefile.tc \
  881. X    pcgraph.asm 
  882. X
  883. # Documentation and help files
  884. DOCS1 = docs/Makefile docs/README docs/checkdoc.c docs/doc2gih.c \
  885. X    docs/doc2hlp.c docs/doc2hlp.com docs/doc2ms.c docs/doc2tex.c \
  886. X    docs/gnuplot.1 docs/lasergnu.1 docs/toc_entry.sty \
  887. X    docs/titlepage.ms docs/titlepage.tex docs/Makefile.ami
  888. DOCS2 = docs/gnuplot.doc
  889. DOCS3 = docs/latextut/Makefile docs/latextut/eg1.plt \
  890. X    docs/latextut/eg2.plt docs/latextut/eg3.dat docs/latextut/eg3.plt \
  891. X    docs/latextut/eg4.plt docs/latextut/eg5.plt docs/latextut/eg6.plt \
  892. X    docs/latextut/header.tex docs/latextut/tutorial.tex \
  893. X    docs/latextut/linepoint.plt
  894. X
  895. #########################################################################
  896. # Default target (informational)
  897. info:
  898. X    @echo "Please do a 'make <MACHINE>' where <MACHINE> is one of the following:"
  899. X    @echo 
  900. X    @echo "apollo, apollo_motif       for Apollo running SR10.3 with Apollo's X11R3"
  901. X    @echo "dec, dec_motif             for Dec3100/5000 running Ultrix 3.1d with MIT's X11R4"
  902. X    @echo "hp                         for HP/9000 700 series running HP/UX 8.0 with MIT's X11R4"
  903. X    @echo "sun                        for Sun sparcstation running SunOS 4.1 with suntools (no X11R4) "
  904. X    @echo "sun_x11                    for Sun sparcstation running SunOS 4.1 with suntools and X11R4 "
  905. X    @echo "sgi                        for Silicon Graphics IRIS4D machines (no X11R4) "
  906. X    @echo "sgix11                     for Silicon Graphics IRIS4D machines (X11R4) "
  907. X    @echo "next                       for NeXT Cube and Slab running NeXTOS 2.0+ (no X11R4) "
  908. X    @echo "3b1                        for ATT 3b1 machines (no X11R4) "
  909. X    @echo "386ix                      for 386 machines running 386/ix (no X11)"
  910. X    @echo "386ix_x11                  for 386 machines running 386/ix with T.Roell X386"
  911. X    @echo "ibmrs6000, ibmrs6000_motif for IBM RS/6000 running Aix 3.1 with IBM's X11R3"
  912. X    @echo "x11r4, x11r4_motif         for a generic machine (like a sun or dec) with MIT's X11R4"
  913. X    @echo 
  914. X    @echo "Examples:"
  915. X    @echo
  916. X    @echo "         make x11r4"
  917. X    @echo "         make x11r4_motif"
  918. X    @echo "         make apollo"
  919. X    @echo "         make apollo       OPTIONS='-DNOCWDRC' "
  920. X    @echo "         make apollo_motif DEST='/usr/um/misc/bin' "
  921. X    @echo "         make dec"
  922. X    @echo "         make hp"
  923. X    @echo "         make next"
  924. X    @echo "         make sun          HELPDEST='/usr/um/misc/lib/gnuplot.gih' "
  925. X    @echo "         make sun          X11INCLUDES='-I/usr/local/include -I/usr/local/include/X11 -I/usr/local/include/X11/Xaw' "
  926. X    @echo "         make sun_x11"
  927. X    @echo "         make sgi"
  928. X    @echo "         make 3b1"
  929. X    @echo "         make 386ix"
  930. X    @echo "         make ibmrs6000    MANDEST='/usr/usr/misc/man/man1' COPTS='-O' "
  931. X    @echo 
  932. X    @echo "If you just type 'make All' , it will build gnuplot for Unix X11R4/Athena"
  933. X    @echo "and the following variables will be used as default:"
  934. X    @echo 
  935. X    @echo " DEST                     " $(DEST)
  936. X    @echo " MANDEST                  " $(MANDEST)
  937. X    @echo " HELPDEST                 " $(HELPDEST)
  938. X    @echo " EMAIL                    " $(EMAIL)
  939. X    @echo " CC                       " $(CC)
  940. X    @echo " COPTS                    " $(COPTS)
  941. X    @echo " OPTIONS                  " $(OPTIONS)
  942. X    @echo " CFLAGS                   " $(CFLAGS)
  943. X    @echo " LIBS                     " $(LIBS)
  944. X    @echo " X11FLAGS                 " $(X11FLAGS)
  945. X    @echo " X11LIBS                  " $(X11LIBS)
  946. X    @echo " X11INCLUDES              " $(X11INCLUDES)
  947. X    @echo " TERMFLAGS                " $(TERMFLAGS)
  948. X    @echo " LASERGNU                 " $(LASERGNU)
  949. X    @echo 
  950. X    @echo "If you are not familiar with makefiles or just want to know what"
  951. X    @echo " 'make <MACHINE>' would  do without actually doing anything, then type"
  952. X    @echo " 'make <MACHINE> -n' "
  953. X    @echo 
  954. X
  955. ###############################################################
  956. # Targets for each machine
  957. X
  958. x11r4:
  959. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(X11R4_FLAGS)    $(TARGET)
  960. X
  961. x11r4_motif:
  962. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(X11R4_M_FLAGS)  $(TARGET)
  963. X
  964. dec:
  965. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(DEC_FLAGS)      $(TARGET)
  966. X
  967. dec_motif:
  968. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(DEC_M_FLAGS)    $(TARGET)
  969. X
  970. apollo:
  971. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(APOLLO_FLAGS)   $(TARGET)
  972. X
  973. apollo_motif:
  974. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(APOLLO_M_FLAGS) $(TARGET)
  975. X
  976. hp:
  977. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(HP_FLAGS)       $(TARGET)
  978. X
  979. next:
  980. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(NEXT_FLAGS)     $(TARGET)
  981. X
  982. sun:
  983. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SUN_FLAGS)      $(TARGET)
  984. X
  985. sun_x11:
  986. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SUN_X11_FLAGS)  $(TARGET)
  987. X
  988. sgi:
  989. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SGI_FLAGS)      $(TARGET)
  990. X
  991. sgix11:
  992. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SGIX11_FLAGS)   $(TARGET)
  993. X
  994. cgi:
  995. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(CGI_FLAGS)      $(TARGET)
  996. X
  997. 3b1:
  998. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(3B1_FLAGS)      $(TARGET)
  999. X
  1000. 386ix:
  1001. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(386IX_FLAGS)    $(TARGET)
  1002. X
  1003. 386ix_x11: 
  1004. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(386IX_X11_FLAGS) $(TARGET)
  1005. X
  1006. ibmrs6000:
  1007. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(AIX_FLAGS)      $(TARGET)
  1008. X
  1009. ibmrs6000_motif:
  1010. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(AIX_M_FLAGS)    $(TARGET)
  1011. X
  1012. #############################################################
  1013. # Targets that really do something
  1014. X
  1015. all:
  1016. X    @echo "Please just type  'make'  in order to get some information on "
  1017. X    @echo "how to build gnuplot under Unix and the X Window System."
  1018. X
  1019. All:    gnuplot $(GNUPLOT_X11) doc
  1020. X
  1021. gnuplot: $(OBJS) version.o
  1022. X    $(LD) $(OBJS) version.o $(LIBS) -o gnuplot
  1023. X
  1024. doc:
  1025. X    ( cd docs; make $(MFLAGS) gnuplot.gih )
  1026. X
  1027. gnuplot_x11: gnuplot_x11.c
  1028. X    $(CC) $(CFLAGS) $(X11FLAGS) $(X11INCLUDES) -o gnuplot_x11 gnuplot_x11.c $(X11LIBS)
  1029. X
  1030. ################################################################
  1031. # Installation instructions
  1032. X
  1033. install:
  1034. X    @echo 
  1035. X    @echo "Please do a 'make <MACHINE> TARGET=Install' where <MACHINE> is one of the following:"
  1036. X    @echo 
  1037. X    @echo "apollo, apollo_motif, dec, dec_motif, hp, sun, sun_x11, sgi, sgix11"
  1038. X    @echo "next, 3b1, 386ix, ibmrs6000, ibmrs6000_motif, x11r4, x11r4_motif"
  1039. X    @echo 
  1040. X    @echo "Examples:"
  1041. X    @echo
  1042. X    @echo "         make x11r4        TARGET=Install "
  1043. X    @echo "         make apollo       TARGET=Install "
  1044. X    @echo "         make apollo_motif TARGET=Install DEST='/usr/um/misc/bin' "
  1045. X    @echo "         make dec          TARGET=Install "
  1046. X    @echo "         make hp           TARGET=Install "
  1047. X    @echo "         make sun          TARGET=Install HELPDEST='/usr/um/misc/lib/gnuplot.gih' "
  1048. X    @echo "         make ibmrs6000    TARGET=Install MANDEST='/usr/um/misc/man/man1' COPTS='-O' "
  1049. X    @echo 
  1050. ################################################################
  1051. # Installation targets
  1052. X
  1053. Install: All man_install $(X11INSTALL) $(LASERGNU)
  1054. X    cp gnuplot     $(DEST)
  1055. X    strip $(DEST)/gnuplot
  1056. X    (cd docs; make $(MFLAGS) install-unix HELPDEST=$(HELPDEST))
  1057. X
  1058. x11_install: gnuplot_x11
  1059. X    cp gnuplot_x11 $(DEST)
  1060. X    strip $(DEST)/gnuplot_x11
  1061. X
  1062. x11_noinstall: 
  1063. X    @echo "X11 not requested, so gnuplot_x11 program not installed"
  1064. X
  1065. man_install: docs/gnuplot.1
  1066. X    cp docs/gnuplot.1 $(MANDEST)
  1067. X
  1068. lasergnu_install: lasergnu docs/lasergnu.1
  1069. X    cp lasergnu $(DEST)
  1070. X    chmod 755 $(DEST)/lasergnu
  1071. X    cp docs/lasergnu.1 $(MANDEST)
  1072. X
  1073. lasergnu_noinstall:
  1074. X    @echo 
  1075. X    @echo "Lasergnu will not be installed by default."
  1076. X    @echo "If you think you need the lasergnu script to print"
  1077. X    @echo " files on the imagen or postscript printers, then"
  1078. X    @echo " type"
  1079. X    @echo "      'make <MACHINE> TARGET=Install LASERGNU='lasergnu_install' "
  1080. X    @echo
  1081. X    @echo "Lasergnu is really not needed since within gnuplot you can"
  1082. X    @echo " can create files (in impress or postscript language) and"
  1083. X    @echo " print them through your favorite print command (lpr, lp, prf, ipr)."
  1084. X    @echo 
  1085. X
  1086. ################################################################
  1087. # Dependencies
  1088. X
  1089. plot.o: plot.c
  1090. X    $(CC) $(CFLAGS) $(PLOTXFLAG) -c plot.c
  1091. X
  1092. term.o: term.h term.c $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
  1093. X    $(CC) $(CFLAGS) $(TERMFLAGS) -c term.c
  1094. X
  1095. version.o:
  1096. X    $(CC) $(CFLAGS) -DCONTACT=\"$(EMAIL)\" -c version.c
  1097. X
  1098. $(OBJS): plot.h
  1099. X
  1100. command.o:
  1101. X    $(CC) $(CFLAGS) -c command.c -DHELPFILE=\"$(HELPDEST)\"
  1102. X
  1103. command.o help.o misc.o: help.h
  1104. X
  1105. command.o graphics.o graph3d.o misc.o plot.o setshow.o term.o: setshow.h
  1106. X
  1107. bitmap.o term.o: bitmap.h
  1108. X
  1109. ################################################################
  1110. # Miscellaneous targets
  1111. X
  1112. SOURCES=plot.h help.h setshow.h bitmap.h term.h $(CSOURCE1) $(CSOURCE2) \
  1113. X    $(CSOURCE3) $(CSOURCE4) $(CSOURCE5) $(CSOURCE6) $(CSOURCE7) $(CSOURCE8)
  1114. X
  1115. lint:
  1116. X    lint -hx $(SOURCES)
  1117. X
  1118. clean:
  1119. X    rm -f *.o *~ *.bak term/*~ term/*.bak
  1120. X    (cd docs; make $(MFLAGS) clean)
  1121. X    (cd docs/latextut; make $(MFLAGS) clean)
  1122. X
  1123. spotless:
  1124. X    rm -f *.o *~ *.bak term/*~ term/*.bak TAGS gnuplot gnuplot_x11
  1125. X    (cd docs; make $(MFLAGS) clean)
  1126. X    (cd docs/latextut; make $(MFLAGS) spotless)
  1127. X
  1128. ################################################################
  1129. # Making shar files for mailing gnuplot
  1130. X
  1131. shar: gnuplot.sh00 gnuplot.sh01 gnuplot.sh02 gnuplot.sh03 gnuplot.sh04 \
  1132. X    gnuplot.sh05 gnuplot.sh06 gnuplot.sh07 gnuplot.sh08 \
  1133. X    gnuplot.sh09 gnuplot.sh10 gnuplot.sh11 gnuplot.sh12 \
  1134. X    gnuplot.sh13 gnuplot.sh14 gnuplot.sh15 
  1135. X
  1136. gnuplot.sh00:
  1137. X    echo '#!/bin/sh' > gnuplot.sh00
  1138. X    echo '# This is a shell file to make directories' >> gnuplot.sh00
  1139. X    echo mkdir $(DIRS) >> gnuplot.sh00
  1140. X
  1141. gnuplot.sh01: $(ETC)
  1142. X    shar $(ETC) > gnuplot.sh01
  1143. X
  1144. gnuplot.sh02: $(DOCS1)
  1145. X    shar $(DOCS1) > gnuplot.sh02
  1146. X
  1147. gnuplot.sh03: $(DOCS2)
  1148. X    shar $(DOCS2) > gnuplot.sh03
  1149. X
  1150. gnuplot.sh04: $(DOCS3)
  1151. X    shar $(DOCS3) > gnuplot.sh04
  1152. X
  1153. gnuplot.sh05: $(CSOURCE1)
  1154. X    shar $(CSOURCE1) > gnuplot.sh05
  1155. X
  1156. gnuplot.sh06: $(CSOURCE2)
  1157. X    shar $(CSOURCE2) > gnuplot.sh06
  1158. X
  1159. gnuplot.sh07: $(CSOURCE3)
  1160. X    shar $(CSOURCE3) > gnuplot.sh07
  1161. X
  1162. gnuplot.sh08: $(CSOURCE4)
  1163. X    shar $(CSOURCE4) > gnuplot.sh08
  1164. X
  1165. gnuplot.sh09: $(CSOURCE5)
  1166. X    shar $(CSOURCE5) > gnuplot.sh09
  1167. X
  1168. gnuplot.sh10: $(CSOURCE6)
  1169. X    shar $(CSOURCE6) > gnuplot.sh10
  1170. X
  1171. gnuplot.sh11: $(CSOURCE7)
  1172. X    shar $(CSOURCE7) > gnuplot.sh11
  1173. X
  1174. gnuplot.sh12: $(PC)
  1175. X    shar $(PC) > gnuplot.sh12
  1176. X
  1177. gnuplot.sh13: $(CSOURCE8)
  1178. X    shar $(CSOURCE8) > gnuplot.sh13
  1179. X
  1180. gnuplot.sh14: $(DEMOS)
  1181. X    shar $(DEMOS) > gnuplot.sh14
  1182. X
  1183. gnuplot.sh15: $(BETA)
  1184. X    shar $(BETA) > gnuplot.sh15
  1185. X
  1186. SHAR_EOF
  1187. chmod 0644 gnuplot/makefile.unx ||
  1188. echo 'restore of gnuplot/makefile.unx failed'
  1189. Wc_c="`wc -c < 'gnuplot/makefile.unx'`"
  1190. test 25357 -eq "$Wc_c" ||
  1191.     echo 'gnuplot/makefile.unx: original size 25357, current size' "$Wc_c"
  1192. rm -f _shar_wnt_.tmp
  1193. fi
  1194. # ============= gnuplot/pcgraph.asm ==============
  1195. if test -f 'gnuplot/pcgraph.asm' -a X"$1" != X"-c"; then
  1196.     echo 'x - skipping gnuplot/pcgraph.asm (File already exists)'
  1197.     rm -f _shar_wnt_.tmp
  1198. else
  1199. > _shar_wnt_.tmp
  1200. echo 'x - extracting gnuplot/pcgraph.asm (Text)'
  1201. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/pcgraph.asm' &&
  1202. TITLE    PC graphics module
  1203. ;    uses LINEPROC.MAC
  1204. X
  1205. ;    Michael Gordon - 8-Dec-86
  1206. ;
  1207. ; Certain routines were taken from the Hercules BIOS of    Dave Tutelman - 8/86
  1208. ; Others came from pcgraph.asm included in GNUPLOT by Colin Kelley
  1209. ;
  1210. ; modified slightly by Colin Kelley - 22-Dec-86
  1211. ;    added header.mac, parameterized declarations
  1212. ; added dgroup: in HVmodem to reach HCh_Parms and HGr_Parms - 30-Jan-87
  1213. ;
  1214. ; modified and added to for use in plot(3) routines back end.
  1215. ; Gil Webster.
  1216. ;
  1217. ; Assemble with masm ver. 4.  
  1218. X
  1219. include header.mac
  1220. X
  1221. if1
  1222. include lineproc.mac
  1223. endif
  1224. X
  1225. GPg1_Base equ 0B800h    ; Graphics page 1 base address
  1226. X
  1227. X    extrn _inter:far
  1228. X
  1229. _text    segment
  1230. X
  1231. X    public _PC_line, _PC_color, _PC_mask, _PC_curloc, _PC_puts, _Vmode
  1232. X    public _erase, _save_stack, _ss_interrupt
  1233. X
  1234. pcpixel proc near
  1235. X    ror word ptr linemask,1
  1236. X    jc cont
  1237. X    ret
  1238. cont:
  1239. X    push ax
  1240. X    push bx
  1241. X    push cx
  1242. X    push dx
  1243. X    push bp
  1244. X    mov cx,ax        ; x
  1245. X    mov dx,bx        ; y
  1246. X    mov ah,0ch        ; ah = write pixel
  1247. X    mov al,byte ptr color
  1248. X
  1249. X    mov bh, 0        ; page 0
  1250. X    int 10h
  1251. X    pop bp
  1252. X    pop dx
  1253. X    pop cx
  1254. X    pop bx
  1255. X    pop ax
  1256. X    ret
  1257. pcpixel endp
  1258. X
  1259. lineproc _PC_line, pcpixel
  1260. X
  1261. ;
  1262. ; erase - clear page 1 of the screen buffer to zero (effectively, blank
  1263. ;    the screen)
  1264. ;
  1265. beginproc _erase
  1266. X    push es
  1267. X    push ax
  1268. X    push cx
  1269. X    push di
  1270. X    mov ax, GPg1_Base
  1271. X    mov es, ax
  1272. X    xor di, di
  1273. X    mov cx, 4000h
  1274. X    xor ax, ax
  1275. X    cld
  1276. X    rep stosw            ; zero out screen page
  1277. X    pop di
  1278. X    pop cx
  1279. X    pop ax
  1280. X    pop es
  1281. X    ret
  1282. _erase endp
  1283. X
  1284. beginproc _PC_color
  1285. X    push bp
  1286. X    mov bp,sp
  1287. X    mov al,[bp+X]            ; color
  1288. X    mov byte ptr color,al
  1289. X    pop bp
  1290. X    ret
  1291. _PC_color endp
  1292. X
  1293. beginproc _PC_mask
  1294. X    push bp
  1295. X    mov bp,sp
  1296. X    mov ax,[bp+X]            ; mask
  1297. X    mov word ptr linemask,ax
  1298. X    pop bp
  1299. X    ret
  1300. _PC_mask endp
  1301. X
  1302. beginproc _Vmode
  1303. X    push bp
  1304. X    mov bp,sp
  1305. X    push si
  1306. X    push di
  1307. X    mov ax,[bp+X]
  1308. X    int 10h
  1309. X    pop di
  1310. X    pop si
  1311. X    pop bp
  1312. X    ret
  1313. _Vmode    endp
  1314. X
  1315. beginproc _PC_curloc
  1316. X    push bp
  1317. X    mov bp,sp
  1318. X    mov dh, byte ptr [bp+X] ; row number
  1319. X    mov dl, byte ptr [bp+X+2] ; col number
  1320. X    mov bh, 0
  1321. X    mov ah, 2
  1322. X    int 10h
  1323. X    pop bp
  1324. X    ret
  1325. _PC_curloc endp
  1326. X
  1327. ;
  1328. ; thanks to watale!broehl for finding a bug here--I wasn't pushing BP
  1329. ;   and reloading AH before INT 10H, which is necessary on genuine IBM
  1330. ;   boards...
  1331. ;
  1332. beginproc _PC_puts
  1333. X    push bp
  1334. X    mov bp,sp
  1335. X    push si
  1336. X    mov bl,byte ptr color
  1337. X    mov si,[bp+X]        ; offset
  1338. X
  1339. ifdef LARGE_DATA
  1340. X    mov es,[bp+X+2]        ; segment if large or compact data model
  1341. endif
  1342. X
  1343. puts2:
  1344. X
  1345. ifdef LARGE_DATA
  1346. X    mov al,es:[si]
  1347. else
  1348. X    mov al,[si]
  1349. endif
  1350. X    or al,al
  1351. X    jz puts3
  1352. X    mov ah,0eh        ; write TTY char
  1353. X    int 10h
  1354. X    inc si
  1355. X    jmp short puts2
  1356. puts3:    pop si
  1357. X    pop bp
  1358. X    ret
  1359. _PC_puts endp
  1360. X
  1361. X
  1362. ; int kbhit();
  1363. ;   for those without MSC 4.0
  1364. ; Use BIOS interrupt 16h to determine if a key is waiting in the buffer.
  1365. ; Return nonzero if so.
  1366. ;
  1367. X
  1368. beginproc _kbhit
  1369. X    mov ah, 1        ; function code 1 is keyboard test
  1370. X    int 16h            ; keyboard functions
  1371. X    jnz kbfin        ; Exit if char available
  1372. X    xor ax, ax        ; No char:  return zero.
  1373. kbfin:    ret
  1374. _kbhit    endp
  1375. X
  1376. X
  1377. ; _save_stack and _ss_interrupt are needed due to a bug in the MSC 4.0
  1378. ; code when run under MS-DOS 3.x.  Starting with 3.0, MS-DOS automatically
  1379. ; switches to an internal stack during system calls.  This leaves SS:SP
  1380. ; pointing at MS-DOS's stack when the ^C interrupt (INT 23H) is triggered.
  1381. ; MSC should restore its own stack before calling the user signal() routine,
  1382. ; but it doesn't.
  1383. ;
  1384. ; Presumably this code will be unnecessary in later releases of the compiler.
  1385. ;
  1386. X
  1387. ; _save_stack saves the current SS:SP to be loaded later by _ss_interrupt.
  1388. ;
  1389. X
  1390. beginproc _save_stack
  1391. X    mov ax,ss
  1392. X    mov cs:save_ss,ax
  1393. X    mov ax,sp
  1394. X    mov cs:save_sp,ax
  1395. X    ret
  1396. _save_stack endp
  1397. X
  1398. X
  1399. ; _ss_interrupt is called on ^C (INT 23H).  It restores SS:SP as saved in
  1400. ; _save_stack and then jumps to the C routine interrupt().
  1401. ;
  1402. beginproc _ss_interrupt
  1403. X    cli            ; no interrupts while the stack is changed!
  1404. X    mov ax,-1        ; self-modifying code again
  1405. save_ss    equ this word - 2
  1406. X    mov ss,ax
  1407. X    mov sp,-1        ; here too
  1408. save_sp equ this word - 2
  1409. X    sti
  1410. X    jmp far ptr _inter; now it's safe to call the real routine
  1411. _ss_interrupt endp
  1412. X
  1413. X
  1414. _text    ends
  1415. X
  1416. X
  1417. const    segment
  1418. linemask dw -1
  1419. color     db 1
  1420. const    ends
  1421. X
  1422. X    end
  1423. SHAR_EOF
  1424. chmod 0666 gnuplot/pcgraph.asm ||
  1425. echo 'restore of gnuplot/pcgraph.asm failed'
  1426. Wc_c="`wc -c < 'gnuplot/pcgraph.asm'`"
  1427. test 3925 -eq "$Wc_c" ||
  1428.     echo 'gnuplot/pcgraph.asm: original size 3925, current size' "$Wc_c"
  1429. rm -f _shar_wnt_.tmp
  1430. fi
  1431. # ============= gnuplot/plot.c ==============
  1432. if test -f 'gnuplot/plot.c' -a X"$1" != X"-c"; then
  1433.     echo 'x - skipping gnuplot/plot.c (File already exists)'
  1434.     rm -f _shar_wnt_.tmp
  1435. else
  1436. > _shar_wnt_.tmp
  1437. echo 'x - extracting gnuplot/plot.c (Text)'
  1438. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/plot.c' &&
  1439. /* GNUPLOT - plot.c */
  1440. /*
  1441. X * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  1442. X *
  1443. X * Permission to use, copy, and distribute this software and its
  1444. X * documentation for any purpose with or without fee is hereby granted, 
  1445. X * provided that the above copyright notice appear in all copies and 
  1446. X * that both that copyright notice and this permission notice appear 
  1447. X * in supporting documentation.
  1448. X *
  1449. X * Permission to modify the software is granted, but not the right to
  1450. X * distribute the modified code.  Modifications are to be distributed 
  1451. X * as patches to released version.
  1452. X *  
  1453. X * This software is provided "as is" without express or implied warranty.
  1454. X * 
  1455. X *
  1456. X * AUTHORS
  1457. X * 
  1458. X *   Original Software:
  1459. X *     Thomas Williams,  Colin Kelley.
  1460. X * 
  1461. X *   Gnuplot 2.0 additions:
  1462. X *       Russell Lang, Dave Kotz, John Campbell.
  1463. X *
  1464. X *   Gnuplot 3.0 additions:
  1465. X *       Gershon Elber and many others.
  1466. X * 
  1467. X * Send your comments or suggestions to 
  1468. X *  pixar!info-gnuplot@sun.com.
  1469. X * This is a mailing list; to join it send a note to 
  1470. X *  pixar!info-gnuplot-request@sun.com.  
  1471. X * Send bug reports to
  1472. X *  pixar!bug-gnuplot@sun.com.
  1473. X */
  1474. X
  1475. #include <stdio.h>
  1476. #include <setjmp.h>
  1477. #include <signal.h>
  1478. #include "plot.h"
  1479. #include "setshow.h"
  1480. #ifdef MSDOS
  1481. #include <io.h>
  1482. #endif
  1483. #ifdef vms
  1484. #include <unixio.h>
  1485. #include <smgdef.h>
  1486. extern int vms_vkid;
  1487. extern smg$create_virtual_keyboard();
  1488. unsigned int status[2] = {1, 0};
  1489. #endif
  1490. #ifdef AMIGA_LC_5_1
  1491. #include <proto/dos.h>
  1492. #endif
  1493. X
  1494. #ifdef __TURBOC__
  1495. #include <graphics.h>
  1496. #endif
  1497. X
  1498. extern char *getenv(),*strcat(),*strcpy(),*strncpy();
  1499. X
  1500. extern char input_line[];
  1501. extern int c_token;
  1502. extern FILE *outfile;
  1503. extern int term;
  1504. X
  1505. BOOLEAN interactive = TRUE;    /* FALSE if stdin not a terminal */
  1506. char *infile_name = NULL;    /* name of command file; NULL if terminal */
  1507. X
  1508. #ifndef STDOUT
  1509. #define STDOUT 1
  1510. #endif
  1511. X
  1512. jmp_buf env;
  1513. X
  1514. struct value *integer(),*complex();
  1515. X
  1516. X
  1517. extern f_push(),f_pushc(),f_pushd1(),f_pushd2(),f_call(),f_call2(),f_lnot(),f_bnot(),f_uminus()
  1518. X    ,f_lor(),f_land(),f_bor(),f_xor(),f_band(),f_eq(),f_ne(),f_gt(),f_lt(),
  1519. X    f_ge(),f_le(),f_plus(),f_minus(),f_mult(),f_div(),f_mod(),f_power(),
  1520. X    f_factorial(),f_bool(),f_jump(),f_jumpz(),f_jumpnz(),f_jtern();
  1521. X
  1522. extern f_real(),f_imag(),f_arg(),f_conjg(),f_sin(),f_cos(),f_tan(),f_asin(),
  1523. X    f_acos(),f_atan(),f_sinh(),f_cosh(),f_tanh(),f_int(),f_abs(),f_sgn(),
  1524. X    f_sqrt(),f_exp(),f_log10(),f_log(),f_besj0(),f_besj1(),f_besy0(),f_besy1(),
  1525. #ifdef GAMMA
  1526. X    f_gamma(),
  1527. #endif
  1528. X    f_floor(),f_ceil();
  1529. X
  1530. X
  1531. struct ft_entry ft[] = {    /* built-in function table */
  1532. X
  1533. /* internal functions: */
  1534. X    {"push", f_push},    {"pushc", f_pushc},
  1535. X    {"pushd1", f_pushd1},    {"pushd2", f_pushd2},
  1536. X    {"call", f_call},    {"call2", f_call2},    {"lnot", f_lnot},
  1537. X    {"bnot", f_bnot},    {"uminus", f_uminus},    {"lor", f_lor},
  1538. X    {"land", f_land},    {"bor", f_bor},        {"xor", f_xor},
  1539. X    {"band", f_band},    {"eq", f_eq},        {"ne", f_ne},
  1540. X    {"gt", f_gt},        {"lt", f_lt},        {"ge", f_ge},
  1541. X    {"le", f_le},        {"plus", f_plus},    {"minus", f_minus},
  1542. X    {"mult", f_mult},    {"div", f_div},        {"mod", f_mod},
  1543. X    {"power", f_power}, {"factorial", f_factorial},
  1544. X    {"bool", f_bool},    {"jump", f_jump},    {"jumpz", f_jumpz},
  1545. X    {"jumpnz",f_jumpnz},{"jtern", f_jtern},
  1546. X
  1547. /* standard functions: */
  1548. X    {"real", f_real},    {"imag", f_imag},    {"arg", f_arg},
  1549. X    {"conjg", f_conjg}, {"sin", f_sin},        {"cos", f_cos},
  1550. X    {"tan", f_tan},        {"asin", f_asin},    {"acos", f_acos},
  1551. X    {"atan", f_atan},    {"sinh", f_sinh},    {"cosh", f_cosh},
  1552. X    {"tanh", f_tanh},    {"int", f_int},        {"abs", f_abs},
  1553. X    {"sgn", f_sgn},        {"sqrt", f_sqrt},    {"exp", f_exp},
  1554. X    {"log10", f_log10},    {"log", f_log},        {"besj0", f_besj0},
  1555. X    {"besj1", f_besj1},    {"besy0", f_besy0},    {"besy1", f_besy1},
  1556. #ifdef GAMMA
  1557. X     {"gamma", f_gamma},
  1558. #endif
  1559. X    {"floor", f_floor},    {"ceil", f_ceil},
  1560. X    {NULL, NULL}
  1561. };
  1562. X
  1563. static struct udvt_entry udv_pi = {NULL, "pi",FALSE};
  1564. X                                    /* first in linked list */
  1565. struct udvt_entry *first_udv = &udv_pi;
  1566. struct udft_entry *first_udf = NULL;
  1567. X
  1568. X
  1569. X
  1570. #ifdef vms
  1571. X
  1572. #define HOME "sys$login:"
  1573. X
  1574. #else /* vms */
  1575. #ifdef MSDOS
  1576. X
  1577. #define HOME "GNUPLOT"
  1578. X
  1579. #else /* MSDOS */
  1580. X
  1581. #if defined(AMIGA_AC_5) || defined(AMIGA_LC_5_1)
  1582. X
  1583. #define HOME "GNUPLOT"
  1584. #else /* AMIGA */
  1585. X
  1586. #define HOME "HOME"
  1587. X
  1588. #endif /* AMIGA */
  1589. #endif /* MSDOS */
  1590. #endif /* vms */
  1591. X
  1592. #ifdef unix
  1593. #define PLOTRC ".gnuplot"
  1594. #else /* unix */
  1595. #if defined(AMIGA_AC_5) || defined(AMIGA_LC_5_1)
  1596. #define PLOTRC ".gnuplot"
  1597. #else /* AMIGA */
  1598. #define PLOTRC "gnuplot.ini"
  1599. #endif /* AMIGA */
  1600. #endif /* unix */
  1601. X
  1602. #ifdef __TURBOC__
  1603. void tc_interrupt()
  1604. #else
  1605. #ifdef _CRAY
  1606. void inter(an_int)
  1607. int an_int;
  1608. #else
  1609. inter()
  1610. #endif
  1611. #endif
  1612. {
  1613. #ifdef MSDOS
  1614. #ifdef __TURBOC__
  1615. X    (void) signal(SIGINT, tc_interrupt);
  1616. #else
  1617. X    void ss_interrupt();
  1618. X    (void) signal(SIGINT, ss_interrupt);
  1619. #endif
  1620. #else  /* MSDOS */
  1621. X    (void) signal(SIGINT, inter);
  1622. #endif  /* MSDOS */
  1623. X    (void) signal(SIGFPE, SIG_DFL);    /* turn off FPE trapping */
  1624. X    if (term && term_init)
  1625. X        (*term_tbl[term].text)();    /* hopefully reset text mode */
  1626. X    (void) fflush(outfile);
  1627. X    (void) putc('\n',stderr);
  1628. X    longjmp(env, TRUE);        /* return to prompt */
  1629. }
  1630. X
  1631. X
  1632. main(argc, argv)
  1633. X    int argc;
  1634. X    char **argv;
  1635. {
  1636. /* Register the Borland Graphics Interface drivers. If they have been */
  1637. /* included by the linker.                                            */
  1638. X
  1639. #ifdef __TURBOC__
  1640. registerfarbgidriver(EGAVGA_driver_far);
  1641. registerfarbgidriver(CGA_driver_far);
  1642. registerfarbgidriver(Herc_driver_far);
  1643. registerfarbgidriver(ATT_driver_far);
  1644. #endif
  1645. #ifdef X11
  1646. X     { int n = X11_args(argc, argv); argv += n; argc -= n; }
  1647. #endif 
  1648. X
  1649. #ifdef apollo
  1650. X    apollo_pfm_catch();
  1651. #endif
  1652. X
  1653. X    setbuf(stderr,(char *)NULL);
  1654. X    outfile = stdout;
  1655. X    (void) complex(&udv_pi.udv_value, Pi, 0.0);
  1656. X
  1657. X     interactive = FALSE;
  1658. X     init_terminal();        /* can set term type if it likes */
  1659. X
  1660. #ifdef AMIGA_LC_5_1
  1661. X     if (IsInteractive(Input()) == DOSTRUE) interactive = TRUE;
  1662. X     else interactive = FALSE;
  1663. #else
  1664. X     interactive = isatty(fileno(stdin));
  1665. #endif
  1666. X     if (argc > 1)
  1667. X      interactive = FALSE;
  1668. X
  1669. X     if (interactive)
  1670. X      show_version();
  1671. #ifdef vms   /* initialise screen management routines for command recall */
  1672. X          if (status[1] = smg$create_virtual_keyboard(&vms_vkid) != SS$_NORMAL)
  1673. X               done(status[1]);
  1674. #endif
  1675. X
  1676. X    if (!setjmp(env)) {
  1677. X        /* first time */
  1678. X        interrupt_setup();
  1679. X        load_rcfile();
  1680. X
  1681. X        if (interactive && term != 0)    /* not unknown */
  1682. X         fprintf(stderr, "\nTerminal type set to '%s'\n", 
  1683. X                term_tbl[term].name);
  1684. X    } else {    
  1685. X        /* come back here from int_error() */
  1686. X        load_file_error();    /* if we were in load_file(), cleanup */
  1687. #ifdef vms
  1688. X        /* after catching interrupt */
  1689. SHAR_EOF
  1690. true || echo 'restore of gnuplot/plot.c failed'
  1691. fi
  1692. echo 'End of  part 22'
  1693. echo 'File gnuplot/plot.c is continued in part 23'
  1694. echo 23 > _shar_seq_.tmp
  1695. exit 0
  1696.  
  1697. exit 0 # Just in case...
  1698. -- 
  1699. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1700. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1701. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1702. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1703.