home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / crc_plot / part02 < prev    next >
Encoding:
Text File  |  1987-07-07  |  49.6 KB  |  2,905 lines

  1. Path: uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v10i046:  CRC Plotting Package, Part02/06
  5. Message-ID: <605@uunet.UU.NET>
  6. Date: 9 Jul 87 01:14:19 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 2894
  9. Approved: rs@uunet.UU.NET
  10.  
  11. Submitted-by: "Wombat" <rsk@j.cc.purdue.edu>
  12. Posting-Number: Volume 10, Issue 46
  13. Archive-name: crc_plot/Part02
  14.  
  15.  
  16.  
  17. #    This is a shell archive.
  18. #    Remove everything above and including the cut line.
  19. #    Then run the rest of the file through sh.
  20. #----cut here-----cut here-----cut here-----cut here----#
  21. #!/bin/sh
  22. # shar:    Shell Archiver
  23. #    Run the following text with /bin/sh to create:
  24. #    lib
  25. mkdir lib
  26. chdir lib
  27. cat << \SHAR_EOF > crc.h
  28. #
  29. /*
  30.     crc.h - include file for the CRC graphics package
  31.  
  32.     Carl Crawford
  33.     Purdue University
  34.     W. Lafayette, IN 47907
  35.  
  36.     Jan. 1981
  37. */
  38.  
  39. #include <stdio.h>
  40. #include <math.h>
  41. #include <signal.h>
  42.  
  43. unsigned short *_pic;   /* pointer to bit plane */
  44. int     _xp,_yp;        /* integer position */
  45. float   _axp,_ayp;      /* real position */
  46. float   _xo,_yo;        /* current origin */
  47. int     _ud;            /* indicates up/down for pen */
  48. int     _error;         /* indicates error in plotting */
  49. float    _fac;        /* scale factor */
  50. float    _ipsz;        /* size of the internal file - 1 */
  51. float    _ipsz10;    /* ipsize / 10.0 */
  52. int     DEV;            /* major device number */
  53. char    DEVN;           /* minor device number */
  54. int    BLANK;        /* 1 = don't blank device before plotting */
  55. char    *STORE;        /* default storage file */
  56. char    *PLOTFILT;    /* Plot Filter Name */
  57. float    TICDIS;        /* distance between tic marks on the axis */
  58. float    HEIGHT;        /* char height in axis routines */
  59. int    DIGITS;        /* number of dec. digits + 1 in axis annotation */
  60. unsigned _bufsize;    /* size of point buffer */
  61. char    _abuf[100];    /* char buffer for anyone */
  62. char    *SITE;        /* site for gplp */ 
  63. FILE    *_pipe_fd;    /* file descriptor for pipes and pseudo pipes */
  64. int    (*_isig)();    /* save SIGINT signal */
  65. int    (*_qsig)();    /* save SIGQUIT signal */
  66. int    (*_hsig)();    /* save SIGHUP signal */
  67. int    _intty[3];    /* save current tty modes in here */
  68.  
  69. /*    control characters */
  70.  
  71. #define    NUL 0        /* <nul> */
  72. #define    SOH 1        /* <soh> */
  73. #define    STX 2        /* <stx> */
  74. #define    ETC 3        /* <etc> */
  75. #define ETX 3           /* <etx> */
  76. #define EOT 4           /* <eot> */
  77. #define ENQ 5           /* <enq> */
  78. #define ACK 6        /* <ack> */
  79. #define BEL 7        /* <bel> */
  80. #define BS 8            /* <bs> */
  81. #define HT 9        /* <ht> */
  82. #define LF 10           /* <lf> */
  83. #define VT 11           /* <vt> */
  84. #define FF 12           /* <ff> */
  85. #define CR 13           /* <cr> */
  86. #define SO 14           /* <so> */
  87. #define SI 15           /* <si> */
  88. #define DLE 16        /* <dle> */
  89. #define DC1 17        /* <dc1> */
  90. #define DC2 18        /* <dc2> */
  91. #define DC3 19        /* <dc3> */
  92. #define DC4 20        /* <dc4> */
  93. #define NAK 21        /* <nak> */
  94. #define    SYN 22        /* <syn> */
  95. #define ETB 23          /* <etb> */
  96. #define CAN 24        /* <can> */
  97. #define EM 25        /* <em> */
  98. #define SUB 26          /* <sub> */
  99. #define ESC 27          /* <esc> */
  100. #define    FS 28        /* <fs> */
  101. #define GS 29           /* <gs> */
  102. #define RS 30           /* <rs> */
  103. #define US 31           /* <us> */
  104.  
  105.  
  106.  
  107. /*      variables for HP and TEK */
  108.  
  109. int _CM;    /* current mode */
  110. int _X;        /* x position */
  111. int _Y;        /* y position */
  112. int _FILL;    /* number of fill characters */
  113.  
  114. #define    BINARY_FONT_FILE    "/usr/unsup/lib/crc/font.5x7"
  115. #define    PLOTBIN            "/usr/bin/plot"
  116.  
  117. #define    BIT    0    /* major device table */
  118. #define GOV    1
  119. #define IMAGE    2
  120. #define    GGOV    3
  121. #define    GIMAGE    4
  122. #define    PLOT    5
  123. #define    TEK    6
  124. #define HP    7
  125.  
  126. #define MBIT    4
  127. /* maximum device in bit plane mode */
  128.  
  129. /*
  130.     Major and minor device tables
  131.  
  132.     DEV     DEVN    dev     OUTPUT
  133.     0       0       0       file or standard output
  134.         1       8       Versatec through gp (I)
  135.         2       16      Printronix through gplp (I) and opr (I)
  136.  
  137.     1       0       1       Comtal graphics overlay 0(*)
  138.         1       9       Comtal graphics overlay 1(*)
  139.         2       17      Comtal graphics overlay 2(*)
  140.  
  141.  
  142.     2       0       2       Comtal image image displayed(*)
  143.         1       10      Comtal image 0(*)
  144.         2       18      Comtal image 1(*)
  145.         3       26      Comtal image 2(*)
  146.  
  147.     3       0       3       Grinnell graphics overlay 0(*)
  148.         1       11      Grinnell graphics overlay 1(*)
  149.         2       19      Grinnell graphics overlay 2(*)
  150.         3       27      Grinnell graphics overlay 3(*)
  151.  
  152.     4       0       4       Grinnell Image being Displayed (*)
  153.         1       12      Grinnell Image Plane 0(*)
  154.         2       20      Grinnell Image Plane 1(*)
  155.         3       28      Grinnell Image Plane 2(*)
  156.         4       36      Grinnell Image Plane 3(*)
  157.         5       44      Grinnell Image Plane 4(*)
  158.  
  159.     5    0    5    Plot Subroutines
  160.  
  161.     6       0       6       Tektronix through standard output
  162.         1    14    Retro-Graphics through standard output
  163.         2    22    Tektronix 4113
  164.  
  165.     7       0       7       HP through /u/lib/graphics/hpd
  166.  
  167. (*) - through /u/lib/graphics/gd
  168.  
  169. */
  170. SHAR_EOF
  171. cat << \SHAR_EOF > Makefile
  172. # crc/lib Makefile
  173. #
  174. # $Header: /usr/src/unsup/bin/crc/lib/RCS/Makefile,v 1.7 87/05/06 23:27:49 rsk Local $
  175. #
  176. #    Richard S. Kulawiec, Purdue University Computing Center
  177. #    9/26/86
  178. #
  179.  
  180. BIN=    ${DESTDIR}/usr/unsup/bin
  181. LIB=    ${DESTDIR}/usr/unsup/lib/crc
  182.  
  183. OWNER= binary
  184. GROUP= system
  185. MODE= 751
  186. SHMODE= 755
  187. SUMODE= 4751
  188. SGMODE= 2751
  189. TXTMODE= 644
  190.  
  191. INCLUDE=
  192. CDEFS=
  193. CFLAGS= -O ${CDEFS} ${INCLUDE}
  194.  
  195. HDR=    crc.h
  196. SRC=    _clean.c _err.c _plotend.c _schk.c _ssize.c alpha.c alpha_.c axis.c \
  197.     axis_.c draxis.c draxis_.c axisv.c axisv_.c dline.c dline_.c factor.c \
  198.     factor_.c fname.c fname_.c laxis.c laxis_.c line.c line_.c newpen.c \
  199.     newpen_.c number.c number_.c plot.c plot_.c plotp.c plots.c plots_.c \
  200.     plotsubs.c scale.c scale_.c site.c site_.c sline.c sline_.c speed.c \
  201.     speed_.c symbol.c symbol_.c where.c where_.c
  202. OBJ=    _clean.o _err.o _plotend.o _schk.o _ssize.o alpha.o alpha_.o axis.o \
  203.     axis_.o draxis.o draxis_.o axisv.o axisv_.o dline.o dline_.o factor.o \
  204.     factor_.o fname.o fname_.o laxis.o laxis_.o line.o line_.o newpen.o \
  205.     newpen_.o number.o number_.o plot.o plot_.o plotp.o plots.o plots_.o \
  206.     plotsubs.o scale.o scale_.o site.o site_.o sline.o sline_.o speed.o \
  207.     speed_.o symbol.o symbol_.o where.o where_.o
  208. SOURCE=    Makefile ${SRC} ${HDR}
  209.  
  210.  
  211. all:        libG.a
  212.  
  213. libG.a:        $(OBJ) crc.h
  214.         ar r libG.a $(OBJ); ranlib libG.a
  215.  
  216. clean:    FRC
  217.     rm -f Makefile.bak libG.a *.o a.out core errs lint.errs tags
  218.  
  219. depend:    ${HDR} ${SRC}
  220.     maketd -a ${CDEFS} ${INCLUDE} ${SRC}
  221.  
  222. install: all FRC
  223.     -install -c -m ${TXTMODE} -o ${OWNER} -g ${GROUP} libG.a ${LIB}
  224.     -ranlib ${LIB}/libG.a
  225.  
  226. lint: ${HDR} ${SRC} FRC
  227.     lint ${CDEFS} ${INCLUDE} ${SRC}
  228.  
  229. print: source FRC
  230.     lpr -J"crc/lib source" ${SOURCE}
  231.  
  232. source: ${SOURCE}
  233.  
  234. spotless: clean 
  235.     rcsclean ${SOURCE}
  236.  
  237. tags: ${HDR} ${SRC}
  238.     ctags -t ${HDR} ${SRC}
  239.  
  240. ${SOURCE}:
  241.     co $@
  242.  
  243. FRC:
  244.  
  245. # DO NOT DELETE THIS LINE - make depend DEPENDS ON IT
  246. I=/usr/include
  247. S=/usr/include/sys
  248.  
  249. _clean.o: $I/math.h $I/signal.h $I/stdio.h _clean.c crc.h
  250.  
  251. _err.o: $I/math.h $I/signal.h $I/stdio.h _err.c crc.h
  252.  
  253. _plotend.o: $I/math.h $I/signal.h $I/stdio.h _plotend.c crc.h
  254.  
  255. _schk.o: $I/math.h $I/signal.h $I/stdio.h _schk.c crc.h
  256.  
  257. _ssize.o: $I/math.h $I/signal.h $I/stdio.h _ssize.c crc.h
  258.  
  259. alpha.o: $I/math.h $I/signal.h $I/stdio.h alpha.c crc.h
  260.  
  261. alpha_.o: $I/math.h $I/signal.h $I/stdio.h alpha_.c crc.h
  262.  
  263. axis.o: $I/math.h $I/signal.h $I/stdio.h axis.c crc.h
  264.  
  265. axis_.o: $I/math.h $I/signal.h $I/stdio.h axis_.c crc.h
  266.  
  267. draxis.o: $I/math.h $I/signal.h $I/stdio.h crc.h draxis.c
  268.  
  269. draxis_.o: $I/math.h $I/signal.h $I/stdio.h crc.h draxis_.c
  270.  
  271. axisv.o: $I/math.h $I/signal.h $I/stdio.h axisv.c crc.h
  272.  
  273. axisv_.o: $I/math.h $I/signal.h $I/stdio.h axisv_.c crc.h
  274.  
  275. dline.o: $I/math.h $I/signal.h $I/stdio.h crc.h dline.c
  276.  
  277. dline_.o: $I/math.h $I/signal.h $I/stdio.h crc.h dline_.c
  278.  
  279. factor.o: $I/math.h $I/signal.h $I/stdio.h crc.h factor.c
  280.  
  281. factor_.o: $I/math.h $I/signal.h $I/stdio.h crc.h factor_.c
  282.  
  283. fname.o: $I/math.h $I/signal.h $I/stdio.h crc.h fname.c
  284.  
  285. fname_.o: $I/math.h $I/signal.h $I/stdio.h crc.h fname_.c
  286.  
  287. laxis.o: $I/math.h $I/signal.h $I/stdio.h crc.h laxis.c
  288.  
  289. laxis_.o: $I/math.h $I/signal.h $I/stdio.h crc.h laxis_.c
  290.  
  291. line.o: $I/math.h $I/signal.h $I/stdio.h crc.h line.c
  292.  
  293. line_.o: $I/math.h $I/signal.h $I/stdio.h crc.h line_.c
  294.  
  295. newpen.o: $I/math.h $I/signal.h $I/stdio.h crc.h newpen.c
  296.  
  297. newpen_.o: $I/math.h $I/signal.h $I/stdio.h crc.h newpen_.c
  298.  
  299. number.o: $I/math.h $I/signal.h $I/stdio.h crc.h number.c
  300.  
  301. number_.o: $I/math.h $I/signal.h $I/stdio.h crc.h number_.c
  302.  
  303. plot.o: $I/math.h $I/signal.h $I/stdio.h crc.h plot.c
  304.  
  305. plot_.o: $I/math.h $I/signal.h $I/stdio.h crc.h plot_.c
  306.  
  307. plotp.o: $I/math.h $I/signal.h $I/stdio.h crc.h plotp.c
  308.  
  309. plots.o: $I/math.h $I/signal.h $I/stdio.h crc.h plots.c
  310.  
  311. plots_.o: $I/math.h $I/signal.h $I/stdio.h crc.h plots_.c
  312.  
  313. plotsubs.o: $I/math.h $I/signal.h $I/stdio.h crc.h plotsubs.c
  314.  
  315. scale.o: $I/math.h $I/signal.h $I/stdio.h crc.h scale.c
  316.  
  317. scale_.o: $I/math.h $I/signal.h $I/stdio.h crc.h scale_.c
  318.  
  319. site.o: $I/math.h $I/signal.h $I/stdio.h crc.h site.c
  320.  
  321. site_.o: $I/math.h $I/signal.h $I/stdio.h crc.h site_.c
  322.  
  323. sline.o: $I/math.h $I/signal.h $I/stdio.h crc.h sline.c
  324.  
  325. sline_.o: $I/math.h $I/signal.h $I/stdio.h crc.h sline_.c
  326.  
  327. speed.o: $I/math.h $I/signal.h $I/stdio.h crc.h speed.c
  328.  
  329. speed_.o: $I/math.h $I/signal.h $I/stdio.h crc.h speed_.c
  330.  
  331. symbol.o: $I/math.h $I/signal.h $I/stdio.h crc.h symbol.c
  332.  
  333. symbol_.o: $I/math.h $I/signal.h $I/stdio.h crc.h symbol_.c
  334.  
  335. where.o: $I/math.h $I/signal.h $I/stdio.h crc.h where.c
  336.  
  337. where_.o: $I/math.h $I/signal.h $I/stdio.h crc.h where_.c
  338.  
  339. # *** Do not add anything here - It will go away. ***
  340. SHAR_EOF
  341. cat << \SHAR_EOF > _clean.c
  342. /*
  343.     _clean - clean up after interrupts
  344.  
  345.     The CRC graphics package
  346.  
  347.     Carl Crawford
  348.     Purdue University
  349.     W. Lafayette, IN 47907
  350.  
  351.     Spetember 1981
  352. */
  353.  
  354. #include "crc.h"
  355.  
  356. _clean()
  357. {
  358.     if(DEV > MBIT)_plotend();
  359.     exit(1);
  360. }
  361. SHAR_EOF
  362. cat << \SHAR_EOF > _err.c
  363. #include    "crc.h"
  364.  
  365. /*
  366.     _err - clean up after error
  367.  
  368.     The CRC graphics package
  369.  
  370.     Carl Crawford 
  371.     Purdue University
  372.     West Lafayette, IN 47901
  373.  
  374.     October 1981
  375. */
  376.  
  377. _err(s1,s2)
  378. char    *s1,*s2;
  379. {
  380.     if(DEV > MBIT)_plotend();
  381.  
  382.     fputs(s1,stderr);
  383.     fputs(s2,stderr);
  384.     fputc('\n',stderr);
  385.     exit(1);
  386. }
  387. SHAR_EOF
  388. cat << \SHAR_EOF > _plotend.c
  389. /*
  390.     _plotend - clean up HP and Tektronix
  391.  
  392.     The CRC graphics package
  393.  
  394.     Carl Crawford
  395.     Purdue University
  396.     W. Lafayette, IN 47907
  397.  
  398.     September 1981
  399. */
  400.  
  401. #include "crc.h"
  402.  
  403. _plotend()
  404. {
  405.     if(DEV == HP){
  406.         newpen(0);
  407.         plotp(3);
  408.         pclose(_pipe_fd);
  409.     }
  410.     if(DEV == TEK){
  411.         alpha();
  412.         fclose(_pipe_fd);
  413.         stty(0,_intty);
  414.     }
  415.     if(DEV == HP || DEV == TEK){
  416.         signal(SIGHUP,_hsig);
  417.         signal(SIGINT,_isig);
  418.         signal(SIGQUIT,_qsig);
  419.     }
  420.     if(DEV == PLOT && PLOTFILT)
  421.         pclose(_pipe_fd);
  422. }
  423. SHAR_EOF
  424. cat << \SHAR_EOF > _schk.c
  425. /*
  426.     _schk - check for idenitcal scale values
  427.  
  428.     The CRC graphics package
  429.  
  430.     Carl Crawford 
  431.     Purdue University
  432.     West Lafayette, IN 47901
  433.  
  434.     October 1981
  435. */
  436.  
  437. #include    "crc.h"
  438.  
  439. _schk(x,y)
  440. float    x,y;
  441. {
  442.     if(x == y)_err("scale values identical","");
  443. }
  444. SHAR_EOF
  445. cat << \SHAR_EOF > _ssize.c
  446. /*
  447.     _ssize - calculate the length of a string
  448.  
  449.     The CRC graphics package
  450.  
  451.     Carl Crawford
  452.     Purdue University
  453.     W. Lafayette, IN 47907
  454.  
  455.     September 1981
  456. */
  457.  
  458. #include    "crc.h"
  459.  
  460. int _ssize(label)
  461. char label[];
  462. {
  463.     float ns;
  464.     int nns,i;
  465.     ns= .5;
  466.     for(i=0;label[i] != '\0';i++){
  467.         if(label[i] == '$'){
  468.             i++;
  469.             switch (label[i]){
  470.             case '~': /* infinity */
  471.                 ns=ns+1.33;
  472.                 break;
  473.             case ':': /* super score */
  474.             case ';': /* under score */
  475.             case '[': /* open subscript */
  476.             case ']': /* close subscript */
  477.             case '{': /* open superscript */
  478.             case '}': /* close superscript */
  479.                 break;
  480.             case '_': /* back space */
  481.                 ns=ns-1.0;
  482.                 break;
  483.             case ' ':
  484.                 ns=ns+0.5;
  485.                 break;
  486.             default:
  487.                 ns=ns+1.0;
  488.                 break;
  489.             }
  490.         }
  491.         else ns=ns+1.0;
  492.     }
  493.     nns=(int)ns;
  494.     return(nns);
  495. }
  496. SHAR_EOF
  497. cat << \SHAR_EOF > alpha.c
  498. #include "crc.h"
  499.  
  500. /*
  501.     alpha - put tektronix in alpha numermic mode
  502.  
  503.     The CRC graphics package
  504.  
  505.     Carl Crawford
  506.     Purdue University
  507.     W. Lafayette, IN 47907
  508.  
  509.     April 15, 1981
  510. */
  511.  
  512. alpha()
  513. {
  514.     if(DEV == TEK){
  515.         _CM &= 0177774;
  516.         plotp(US);
  517.         if(DEVN)plotp(CAN);
  518.         fflush(_pipe_fd);
  519.     }
  520.     if(DEV == HP){
  521.         if((_CM & 1)== 0)return;
  522.         plotp('}');
  523.         plotp('~');
  524.         plotp('\'');
  525.         _CM &= 0177774;
  526.     }
  527. }
  528. SHAR_EOF
  529. cat << \SHAR_EOF > alpha_.c
  530. #include    "crc.h"
  531.  
  532. /*
  533.     alpha_ - f77 callable alpha
  534.  
  535.     The CRC graphics package
  536.  
  537.     carl crawford
  538.     purdue university
  539.     july 1980
  540. */
  541.  
  542.  
  543. alpha_()
  544. {
  545.     alpha();
  546. }
  547. SHAR_EOF
  548. cat << \SHAR_EOF > axis.c
  549. #include    "crc.h"
  550. /*
  551.     axis - interface to 'draxis'
  552.  
  553.     The CRC graphics package
  554.  
  555. */
  556.  
  557. axis(x,y,label,xy,size,xmin,xmax,idata)
  558. float    x,y,size,xmin,xmax;
  559. int    xy,idata;
  560. char    *label;
  561. {
  562.     float angle;
  563.     int xydum;
  564.     angle = 0.0;
  565.     xydum = 1;
  566.     switch(xy){
  567.         case 0:
  568.             break;
  569.         case 1:
  570.             angle = 90.0;
  571.             xydum = -1;
  572.             break;
  573.         case 2:
  574.             xydum = -1;
  575.             break;
  576.         case 3:
  577.             angle = 90.0;
  578.             break;
  579.     }    
  580.     draxis(x,y,label,angle,xydum,size,xmin,xmax,idata);
  581. }
  582. SHAR_EOF
  583. cat << \SHAR_EOF > axis_.c
  584. /*
  585.     axis_ - F77 interface to 'axis'
  586.  
  587.     The CRC graphics package
  588.  
  589.     Carl Crawford 
  590.     Purdue University
  591.     West Lafayette, IN 47901
  592.  
  593.     October 1981
  594. */
  595.  
  596. #include    "crc.h"
  597.  
  598. axis_(x,y,label,xy,size,min,max,flag,labell)
  599. float    *x;
  600. float    *y;
  601. char    *label;
  602. long int    *xy;
  603. float    *size;
  604. float    *min;
  605. float    *max;
  606. long    int    *flag;
  607. long    int    labell;
  608. {
  609.     axis(*x,*y,label,(int)*xy,*size,*min,*max,(int)*flag);
  610. }
  611. SHAR_EOF
  612. cat << \SHAR_EOF > axisv.c
  613. #include    "crc.h"
  614.  
  615. /*
  616.     axisv - set variables for 'axis' subroutine
  617.  
  618.     The CRC graphics package
  619.  
  620.     carl crawford
  621.     purdue university
  622.     west lafayette, indiana 47907
  623.  
  624.     april 1980
  625. */
  626.  
  627. axisv(ticdis,digits)
  628. float    ticdis;
  629. int    digits;
  630. {
  631.     TICDIS = ticdis;
  632.     DIGITS = digits;
  633. }
  634. SHAR_EOF
  635. cat << \SHAR_EOF > axisv_.c
  636. #include    "crc.h"
  637.  
  638. /*
  639.     axisv_ - f77 callable version of 'axisv'
  640.  
  641.     The CRC graphics package
  642.  
  643.     carl crawford
  644.     purdue university
  645.     west lafayette, indiana 47907
  646.  
  647.     april 1980
  648. */
  649.  
  650. axisv_(ticdis,digits)
  651. float    *ticdis;
  652. long    int    *digits;
  653. {
  654.     axisv(*ticdis,(int) *digits);
  655. }
  656. SHAR_EOF
  657. cat << \SHAR_EOF > dline.c
  658. /*
  659.     dline - draw dashed line
  660.  
  661.     The CRC graphics package
  662.  
  663.     Carl Crawford 
  664.     Purdue University
  665.     West Lafayette, IN 47901
  666.  
  667.     October 1981
  668. */
  669.  
  670. #include    "crc.h"
  671.  
  672. dline(x,y,n,dsh,gap,m,lx,ly)
  673. float     *x,*y,*dsh,*gap,lx,ly;
  674. int    n,m;
  675. {
  676.     float    xn,yn,xn1,yn1,dx,dy,len,lenl;
  677.     float    at,nx,ny,xs,ys;
  678.     int    i,lp,dshgap,sp;
  679.  
  680.     if(m == 0){
  681.         line(x,y,n,0,lx,ly); 
  682.         return;
  683.     }
  684.     lenl = dsh[0];    
  685.     dshgap = 0;
  686.     sp = 0;
  687.     lp = 0;
  688.     xn = x[n];    
  689.     xn1 = x[n+1];
  690.     yn = y[n];    
  691.     yn1 = y[n+1];
  692.     _schk(xn,xn1);
  693.     _schk(yn,yn1);
  694.     xn1 = lx / (xn1 - xn);
  695.     yn1 = ly / (yn1 - yn);
  696.  
  697.     plot((x[0]-xn)*xn1,(y[0]-yn)*yn1,3);
  698.     for(i=1;i<n;i++){
  699.         dx = (x[i] - x[i-1]) * xn1;
  700.         dy = (y[i] - y[i-1]) * yn1;
  701.         len = sqrt( (dx*dx) + (dy*dy));
  702.         if(len <= lenl){
  703.             plot((x[i]-xn)*xn1,(y[i]-yn)*yn1,2+dshgap);
  704.             if(sp){
  705.                 x[i-1] = xs;
  706.                 y[i-1] = ys;
  707.                 sp = 0;
  708.             }
  709.             if((lenl -= len) == 0.)
  710.                 if(++dshgap == 1){
  711.                     lenl = gap[lp];
  712.                 }
  713.             else{
  714.                 dshgap = 0;
  715.                 if(++lp == m)lp =0;
  716.                 lenl = dsh[lp];
  717.             }
  718.         }
  719.         else{
  720.             at = atan2(dy,dx);
  721.             nx = cos(at)*lenl;
  722.             ny = sin(at)*lenl;
  723.             plot((x[i-1]-xn)*xn1+nx,(y[i-1]-yn)*yn1+ny,2+dshgap);
  724.             if(++dshgap  == 1){
  725.                 lenl = gap[lp];
  726.             }
  727.             else{
  728.                 dshgap = 0;
  729.                 if(++lp == m) lp = 0;
  730.                 lenl = dsh[lp];
  731.             }
  732.             if(sp == 0){
  733.                 xs = x[i-1];
  734.                 ys = y[i-1];
  735.                 sp = 1;
  736.             }
  737.             x[i-1] += (nx/xn1);
  738.             y[i-1] += (ny/yn1);
  739.             i--;
  740.         }
  741.     }
  742. }
  743. SHAR_EOF
  744. cat << \SHAR_EOF > dline_.c
  745. /*
  746.     dline_ - F77 interface to 'dline'
  747.  
  748.     The CRC graphics package
  749.  
  750.     Carl Crawford 
  751.     Purdue University
  752.     West Lafayette, IN 47901
  753.  
  754.     October 1981
  755. */
  756.  
  757. #include    "crc.h"
  758.  
  759. dline_(x,y,n,dsh,gap,m,lx,ly)
  760. float    *x;
  761. float    *y;
  762. long    int    *n;
  763. float    *dsh;
  764. float    *gap;
  765. long    int    *m;
  766. float    *lx;
  767. float    *ly;
  768. {
  769.     dline(x,y,(int)*n,dsh,gap,(int)*m,*lx,*ly);
  770. }
  771. SHAR_EOF
  772. cat << \SHAR_EOF > draxis.c
  773. #include    "crc.h"
  774.  
  775. /*
  776.     draxis - draw numerically annotated axes for slant axes
  777.  
  778.     The CRC graphics package
  779.  
  780.     carl crawford
  781.     purdue univeristy
  782.     w. lafayette, in 47907
  783.  
  784.     may 1980
  785. */
  786. #define    PI    3.141592
  787. #define SMALL    0.000001
  788.  
  789. draxis(x,y,label,angle,xy,size,xmin,xmax,idata)
  790. /*        xy    =    1    clockwise
  791.             =    -1    counter clockwise */
  792. float    x,y,angle,size,xmin,xmax;
  793. int    xy,idata;
  794. char    *label;
  795. {
  796.     float    xt,yt,half,dumang,sang,cang;
  797.     float    height,del,delx,dely,dticx,dticy;
  798.     int    numt,i,j;
  799.     int     n1,n2,fl,atic;
  800.     char    *b,*c;
  801.  
  802.     angle = angle*PI/180.0;
  803.     sang = sin(angle);
  804.     cang = cos(angle);
  805.     atic = 1;
  806.     plot(x,y,3);
  807.     height = HEIGHT;
  808.     plot(x+size*cang,y+size*sang,2);
  809.     if(TICDIS == 0.0)_err("axis error: ","ticdis zero");
  810.     numt = floor(size/TICDIS+.5); 
  811.     if(!numt) 
  812.         numt = -1;
  813.     plot(x,y,3);
  814.     xt = x;    
  815.     yt = y;
  816.     dticx = 0.075*atic*cos(angle-xy*PI/2.0);
  817.     dticy = 0.075*atic*sin(angle-xy*PI/2.0);
  818.     del =  ( xmax - xmin ) / numt;
  819.     delx = size*cang/numt;
  820.     dely = size*sang/numt;
  821.     numt++;
  822.     for(i = 0;i<numt;i++){
  823.         plot(xt+dticx,yt+dticy,2);
  824.         xt += delx;
  825.         yt += dely;
  826.         plot(xt,yt,3);
  827.     }
  828.     if(idata >= 0)n1 = _axisl(xmin,xmax,idata,1);
  829.  
  830.     c = label;
  831.     b = _abuf;
  832.     while(*b++ = *c++);
  833.     if(n1 && idata >= 0){
  834.         --b;
  835.         *b++ = ' ';
  836.         *b++ = '(';
  837.         *b++ = 'X';
  838.         *b++ = '1';
  839.         *b++ = '0';
  840.         *b++ = '$';
  841.         *b++ = '{';
  842.         if(n1 < 0){
  843.             *b++ = '-';
  844.             n1 = -n1;
  845.         }
  846.         if(n1 > 9){
  847.             *b++ = '0' + (n1/10);
  848.             n2 = n1/10;
  849.             n1 -= n2*10;
  850.         }
  851.         *b++ = '0' + n1;
  852.         *b++ = '$';
  853.         *b++ = '}';
  854.         *b++ = ')';
  855.         *b = 0;
  856.     }
  857.     half = 6.0/7.0 * _ssize(_abuf) / 2.0 * height;
  858.     dticx = 1.1*atic*cos(angle-xy*PI/2.0) + ( size/2.0-half ) * cang;
  859.     dticy = 1.1*atic*sin(angle-xy*PI/2.0) + ( size/2.0-half ) * sang;
  860.     if( fabs(angle-PI/2) < SMALL )
  861.         symbol(x+(xy*atic * 1.2),y+(size/2.0) - half,height,_abuf,90.0);
  862.     else if( fabs(angle) < SMALL ) 
  863.         symbol(x+(size/2.0)-half,y-(xy*atic * .75),height,_abuf,0.0);
  864.     else if( fabs(angle) <= PI/2.0 ){ 
  865.       symbol(x+dticx,y+dticy,height,_abuf,angle*180.0/PI);
  866.     }
  867.     else{ 
  868.       dumang = angle - PI;
  869.       if( dumang < -PI)
  870.         dumang += 2.0*PI;
  871.       dticx += 2.0 * half * cang;
  872.       dticy += 2.0 * half * sang;
  873.       symbol(x+dticx,y+dticy,height,_abuf,dumang*180.0/PI);
  874.     }
  875.     if( idata < 0)return;
  876.     height *= 2.8/4.0;
  877.     plot(x,y,3);
  878.     xt = x;    
  879.     yt = y;
  880.     for(i = 0; i <numt; i++){
  881.         half = height * (6.0/7.0) * _axisl(xmin,del,idata,0);
  882.         if( fabs(angle-PI/2) < SMALL )
  883.         symbol(xt+xy*atic*(((xy<0)*half)+0.145),yt -(height/2.0),height,_abuf,0.0);
  884.         else if( fabs(angle) < SMALL ) 
  885.         symbol(xt-(half/2.0),yt-(xy*atic*(0.145 + height)),height,_abuf,0.0);
  886.         else if( xy*angle > SMALL ) 
  887.         symbol(xt+0.6*height+height*fabs(cang),yt-1.5*xy*height*cang,height,_abuf,0.0);
  888.         else 
  889.         symbol(xt-0.6*height-height*fabs(cang)-half,yt-xy*height*cang,height,_abuf,0.0);
  890.         xmin += del;
  891.         xt += delx;
  892.         yt += dely;
  893.     }
  894. }
  895.  
  896. _axisl(a,b,iflag,opt)
  897. float    a,b;
  898. int    iflag,opt;
  899. {
  900.     double    d;
  901.     double c;
  902.     int    minus,dc,si,i;
  903.     static    int    n,efl;
  904.     int    n1,n2,n3;
  905.     char    *ecvt(),*bu,*bb;
  906.  
  907.     if(opt){
  908.         c = b - a;
  909.         ecvt(fabs(a),DIGITS,&n1,&si);
  910.         ecvt(fabs(b),DIGITS,&n2,&si);
  911.         ecvt(fabs(c),DIGITS,&n3,&si);
  912.         if(iabs(n1-n2) <= 1) n = (n1 > n2)? n1 : n2;
  913.         else    if(iabs(n1-n3) <= 1) n = n3;
  914.         else    if(iabs(n2-n3) <= 1) n = n2;
  915.         efl = 0;
  916.         if(n <= -2 || n >= (DIGITS + iflag)){
  917.             efl = 1;
  918.         }
  919.         return(efl ? n-1 : 0);
  920.     }
  921.     else{
  922.         if(iflag)d = floor(a + 0.5);
  923.         else    d = a;
  924.         minus = 0;
  925.         if(d < 0){
  926.             d = -d;
  927.             minus = 1;
  928.         }
  929.         bu = ecvt(d,DIGITS,&dc,&si);
  930.         if(d == 0.0)dc++;
  931.         if(efl)dc -= n - 1;
  932.         if(iflag && efl == 0){
  933.             bu[dc] = 0;
  934.             bb = _abuf;
  935.             if(minus)*bb++ = '-';
  936.             while( *bb++ = *bu++);
  937.         }
  938.         else{
  939.             bb = _abuf;
  940.             if(minus)*bb++ = '-';
  941.             if(dc <= 0){
  942.                 *bb++ = '.';
  943.                 while(dc++)*bb++ = '0';
  944.                 while(*bb++ = *bu++);
  945.                 _abuf[DIGITS+1+minus] = 0;
  946.             }
  947.             else{
  948.                 while(dc--)*bb++ = *bu++;
  949.                 *bb++ = '.';
  950.                 while(*bb++ = *bu++);
  951.             }
  952.         }
  953.         return(_ssize(_abuf));
  954.     }
  955. }
  956.  
  957. iabs(i)
  958. int    i;
  959. {
  960.     return((i>0)? i : -i);
  961. }
  962. SHAR_EOF
  963. cat << \SHAR_EOF > draxis_.c
  964. /*
  965.     draxis_ - F77 interface to 'draxis'
  966.  
  967.     The CRC graphics package
  968.  
  969. */
  970.  
  971. #include    "crc.h"
  972.  
  973. draxis_(x,y,label,angle,xy,size,min,max,flag)
  974. float    *x;
  975. float    *y;
  976. float    *angle;
  977. char    *label;
  978. long int    *xy;
  979. float    *size;
  980. float    *min;
  981. float    *max;
  982. long    int    *flag;
  983. {
  984.     draxis(*x,*y,label,*angle,(int)*xy,*size,*min,*max,(int)*flag);
  985. }
  986. SHAR_EOF
  987. cat << \SHAR_EOF > factor.c
  988. /*
  989.     factor - change scale factor
  990.  
  991.     The CRC graphics package
  992.  
  993.     Carl Crawford 
  994.     Purdue University
  995.     West Lafayette, IN 47901
  996.  
  997.     October 1981
  998. */
  999.  
  1000. #include    "crc.h"
  1001.  
  1002. factor(sf)
  1003. float    sf;
  1004. {
  1005.     _fac = sf;
  1006. }
  1007. SHAR_EOF
  1008. cat << \SHAR_EOF > factor_.c
  1009. /*
  1010.     factor_ - F77 interface to 'factor'
  1011.  
  1012.     The CRC graphics package
  1013.  
  1014.     Carl Crawford 
  1015.     Purdue University
  1016.     West Lafayette, IN 47901
  1017.  
  1018.     October 1981
  1019. */
  1020.  
  1021. #include    "crc.h"
  1022.  
  1023. factor_(sf)
  1024. float    *sf;
  1025. {
  1026.     factor(*sf);
  1027. }
  1028. SHAR_EOF
  1029. cat << \SHAR_EOF > fname.c
  1030. /*
  1031.     fname - change file name when DEV=0
  1032.  
  1033.     The CRC graphics package
  1034.  
  1035.     Carl Crawford 
  1036.     Purdue University
  1037.     West Lafayette, IN 47907
  1038.  
  1039.     October 1981
  1040. */
  1041.  
  1042. #include    "crc.h"
  1043.  
  1044. fname(s)
  1045. char *s;
  1046. {
  1047.     extern    char    *malloc();
  1048.  
  1049.     STORE = malloc(strlen(s)+1);
  1050.     strcpy(STORE,s);
  1051. }
  1052. SHAR_EOF
  1053. cat << \SHAR_EOF > fname_.c
  1054. /*
  1055.     fname_ - F77 interface to 'fname'
  1056.  
  1057.     The CRC graphics package
  1058.  
  1059.     Carl Crawford 
  1060.     Purdue University
  1061.     West Lafayette, IN 47901
  1062.  
  1063.     October 1981
  1064. */
  1065.  
  1066. #include    "crc.h"
  1067.  
  1068. fname_(s)
  1069. char    *s;
  1070. {
  1071.     fname(s);
  1072. }
  1073. SHAR_EOF
  1074. cat << \SHAR_EOF > laxis.c
  1075. /*
  1076.     laxis - draw logarithmic axes
  1077.  
  1078.     The CRC graphics package
  1079.  
  1080.     Carl Crawford 
  1081.     Purdue University
  1082.     West Lafayette, IN 47901
  1083.  
  1084.     October 1981
  1085. */
  1086.  
  1087. #include    "crc.h"
  1088.  
  1089. laxis(x,y,label,xy,size,logmin,logmax,flag)
  1090. float x,y,size;
  1091. char *label;
  1092. int xy,logmin,logmax,flag;
  1093.  
  1094. {
  1095.  
  1096.  
  1097.     int ns,k,iexp,flg,i,test;
  1098.     float t[10],a,b,angle,height,ttt,tt,ht,ipd,length;
  1099.     char exp[5];
  1100.  
  1101.     _schk((float)logmax,(float)logmin);
  1102.     ipd = size/((float)(logmax-logmin));
  1103.  
  1104.     if(size <= 0. || ipd <= 0.)_err("parameter error in 'laxis'","");
  1105.  
  1106.     height = .7*HEIGHT;
  1107.  
  1108.     length=4.*height;
  1109.     if(xy == 1 || xy ==3)length=HEIGHT;
  1110.  
  1111.     test = (int)(length/ipd) + 1;
  1112.  
  1113.     tt=.1;
  1114.     ttt=.075;
  1115.     ht=.0375;
  1116.  
  1117.     t[1]=.301; 
  1118.     t[2]=.477; 
  1119.     t[3]=.602; 
  1120.     t[4]=.699;
  1121.     t[5]=.778; 
  1122.     t[6]=.845; 
  1123.     t[7]=.903; 
  1124.     t[8]=.954;
  1125.  
  1126.     iexp= logmin-1;
  1127.  
  1128.     plot(x,y,-3);
  1129.  
  1130.     flg=flag;
  1131.     if(flag < 0)flg= -flag;
  1132.  
  1133.     ns = _ssize(label);
  1134.  
  1135.     switch(xy){
  1136.     case 0:
  1137.         plot(size,0.,2);
  1138.         i=0;
  1139.         a= 0.;
  1140.         while(a < .01+ size){
  1141.             iexp=iexp+1;
  1142.             plot(a,0.,3);
  1143.             plot(a,-ttt,2);
  1144.             if(flag >= 0 && i%test == 0){
  1145.                 plot(a,0.,3);
  1146.                 plot(a,-tt,2);
  1147.                 symbol(a-.714*height,-(tt+1.93*height),height,"10",0.);
  1148.                 sprintf(exp,"%d",iexp);
  1149.                 symbol(a+height,-(tt+1.36*height),.8*height,exp,0.);
  1150.             }
  1151.             k=1;
  1152.             b=a+t[1]*ipd;
  1153.             while(k < 9 && b < size && flg != 1){
  1154.                 if((flg == 2 && (k == 1 || k == 4)) || flg != 2){
  1155.                     plot(b,0.,3);
  1156.                     plot(b,-ht,2);
  1157.                 }
  1158.                 k=k+1;
  1159.                 b=a+t[k]*ipd;
  1160.             }
  1161.             i=i+1;
  1162.             a=a+ipd;
  1163.         }
  1164.         a=.5*(size-.857*HEIGHT*ns);
  1165.         b= -tt-2.95*HEIGHT-.6*HEIGHT;
  1166.         angle=0.;
  1167.         break;
  1168.     case 1:
  1169.         plot(0.,size,2);
  1170.         i=0;
  1171.         a=0.;
  1172.         while(a < .01+ size){
  1173.             iexp=iexp+1;
  1174.             plot(0.,a,3);
  1175.             plot(-ttt,a,2);
  1176.             if(flag >= 0 && i%test == 0){
  1177.                 plot(0.,a,3);
  1178.                 plot(-tt,a,2);
  1179.                 symbol(-(tt+4.23*height),a-.5*height,height,"10",0.);
  1180.                 sprintf(exp,"%d",iexp);
  1181.                 symbol(-(tt+2.516*height),a+.07*height,.8*height,exp,0.);
  1182.             }
  1183.             k=1;
  1184.             b=a+t[1]*ipd;
  1185.             while(k < 9 && b < size && flg != 1){
  1186.                 if((flg == 2 && (k == 1 || k == 4)) || flg != 2){
  1187.                     plot(0.,b,3);
  1188.                     plot(-ht,b,2);
  1189.                 }
  1190.                 k=k+1;
  1191.                 b=a+t[k]*ipd;
  1192.             }
  1193.             i=i+1;
  1194.             a=a+ipd;
  1195.         }
  1196.         b=.5*(size-.857*HEIGHT*ns);
  1197.         a= -tt-3.75*HEIGHT-.6*HEIGHT;
  1198.         angle=90.;
  1199.         break;
  1200.     case 2:
  1201.         plot(size,0.,2);
  1202.         i=0;
  1203.         a=0.;
  1204.         while(a < .01+size){
  1205.             iexp=iexp+1;
  1206.             plot(a,0.,3);
  1207.             plot(a,ttt,2);
  1208.             if(flag >= 0 && i%test == 0){
  1209.                 plot(a,0.,3);
  1210.                 plot(a,tt,2);
  1211.                 symbol(a-.714*height,tt+.43*height,height,"10",0.);
  1212.                 sprintf(exp,"%d",iexp);
  1213.                 symbol(a+height,tt+.86*height,.8*height,exp,0.);
  1214.             }
  1215.             k=1;
  1216.             b=a+t[1]*ipd;
  1217.             while(k < 9 && b < size && flg != 1){
  1218.                 if((flg == 2 && (k == 1 || k == 4)) || flg != 2){
  1219.                     plot(b,0.,3);
  1220.                     plot(b,ht,2);
  1221.                 }
  1222.                 k=k+1;
  1223.                 b=a+t[k]*ipd;
  1224.             }
  1225.             i=i+1;
  1226.             a=a+ipd;
  1227.         }
  1228.         a=.5*(size-.857*HEIGHT*ns);
  1229.         b= tt+2.*HEIGHT+.6*HEIGHT;
  1230.         angle=0.;
  1231.         break;
  1232.     case 3:
  1233.         plot(0.,size,2);
  1234.         i=0;
  1235.         a=0.;
  1236.         while(a < .01+size){
  1237.             iexp=iexp+1;
  1238.             plot(0.,a,3);
  1239.             plot(ttt,a,2);
  1240.             if(flag >= 0 && i%test == 0){
  1241.                 plot(0.,a,3);
  1242.                 plot(tt,a,2);
  1243.                 symbol(tt+.43*height,a-.5*height,height,"10",0.);
  1244.                 sprintf(exp,"%d",iexp);
  1245.                 symbol(tt+2.14*height,a+.07*height,.8*height,exp,0.);
  1246.             }
  1247.             k=1;
  1248.             b=a+t[1]*ipd;
  1249.             while(k < 9 && b < size && flg != 1){
  1250.                 if((flg == 2 && (k == 1 || k == 4)) || flg != 2){
  1251.                     plot(0.,b,3);
  1252.                     plot(ht,b,2);
  1253.                 }
  1254.                 k=k+1;
  1255.                 b=a+t[k]*ipd;
  1256.             }
  1257.             i=i+1;
  1258.             a=a+ipd;
  1259.         }
  1260.         b=.5*(size-.857*HEIGHT*ns);
  1261.         a= tt+4.76*HEIGHT+.6*HEIGHT;
  1262.         angle=90.;
  1263.         break;
  1264.     default:
  1265.         plot(-x,-y,-3);
  1266.         return;
  1267.     }
  1268.  
  1269.     symbol(a,b,HEIGHT,label,angle);
  1270.     plot(-x,-y,-3);
  1271.     return;
  1272. }
  1273. SHAR_EOF
  1274. cat << \SHAR_EOF > laxis_.c
  1275. /*
  1276.     laxis_ - F77 interface to 'laxis'
  1277.  
  1278.     The CRC graphics package
  1279.  
  1280.     Carl Crawford 
  1281.     Purdue University
  1282.     West Lafayette, IN 47901
  1283.  
  1284.     October 1981
  1285. */
  1286.  
  1287. #include    "crc.h"
  1288.  
  1289. laxis_(x,y,label,xy,size,logmin,logmax,flag,labell)
  1290. float    *x;
  1291. float    *y;
  1292. char    *label;
  1293. long    int    *xy;
  1294. float    *size;
  1295. long    int    *logmin;
  1296. long    int    *logmax;
  1297. long    int    *flag;
  1298. long    int    labell;
  1299. {
  1300.     laxis(*x,*y,label,(int)*xy,*size,(int)*logmin,(int)*logmax,(int)*flag);
  1301. }
  1302. SHAR_EOF
  1303. cat << \SHAR_EOF > line.c
  1304. /*
  1305.     line - draw lines
  1306.  
  1307.     The CRC graphics package
  1308.  
  1309.     Carl Crawford 
  1310.     Purdue University
  1311.     West Lafayette, IN 47901
  1312.  
  1313.     October 1981
  1314. */
  1315.  
  1316. #include    "crc.h"
  1317.  
  1318. line(x,y,n,bar,lx,ly)
  1319. float *x,*y,lx,ly;
  1320. int n,bar;
  1321. {
  1322.     float xn,yn,yn1,xn1;
  1323.     register    int i;
  1324.  
  1325.     xn = x[n];    
  1326.     xn1 = x[n+1];
  1327.     yn = y[n];    
  1328.     yn1 = y[n+1];
  1329.     _schk(xn,xn1);
  1330.     _schk(yn,yn1);
  1331.     xn1 = lx / (xn1 - xn);
  1332.     yn1 = ly / (yn1 - yn);
  1333.     plot((x[0]-xn)*xn1,(y[0]-yn)*yn1,3);
  1334.     for(i=1;i<n;i++){
  1335.         if(bar)plot((x[i]-xn)*xn1,(y[i-1]-yn)*yn1,2);
  1336.         plot((x[i]-xn)*xn1,(y[i]-yn)*yn1,2);
  1337.     }
  1338.     if(bar){
  1339.         plot((x[n-1]+x[n-1]-x[n-2]-xn)*xn1,(y[n-1]-yn)*yn1,2);
  1340.     }
  1341. }
  1342. SHAR_EOF
  1343. cat << \SHAR_EOF > line_.c
  1344. /*
  1345.     line_ F77 interface to 'line'
  1346.  
  1347.     The CRC graphics package
  1348.  
  1349.     Carl Crawford 
  1350.     Purdue University
  1351.     West Lafayette, IN 47901
  1352.  
  1353.     October 1981
  1354. */
  1355.  
  1356. #include    "crc.h"
  1357.  
  1358. line_(x,y,n,bar,lx,ly)
  1359. float    *x;
  1360. float    *y;
  1361. long    int    *n;
  1362. long    int    *bar;
  1363. float    *lx;
  1364. float    *ly;
  1365. {
  1366.     line(x,y,(int)*n,(int)*bar,*lx,*ly);
  1367. }
  1368. SHAR_EOF
  1369. cat << \SHAR_EOF > newpen.c
  1370. /*
  1371.     newpen - change pens on HP plotter
  1372.  
  1373.     The CRC graphics package
  1374.  
  1375.     Carl Crawford 
  1376.     Purdue University
  1377.     West Lafayette, IN 47901
  1378.  
  1379.     October 1981
  1380. */
  1381.  
  1382. #include    "crc.h"
  1383.  
  1384. newpen(n)
  1385. int    n;
  1386. {
  1387.     _ud = 1;
  1388.     switch(DEV) {
  1389.         case HP:
  1390.         if((_CM & 1) == 0){
  1391.             plotp(ETX);
  1392.             _CM &= 0177774;
  1393.             _CM += 1;
  1394.         }
  1395.         if((n < 0)||(n > 4))return;
  1396.         if(_CM & 2){
  1397.             plotp('}');
  1398.             _CM &= 0177774;    
  1399.             _CM += 1;
  1400.         }
  1401.         plotp('v');
  1402.         plotp(0100 + n);
  1403.         break;
  1404.     case TEK:
  1405.         if(DEVN == 2) {        /* Tek 4113 only    */
  1406.             plotp(ESC);
  1407.             plotp('M');        /* Set line index    */
  1408.             plotp('L');
  1409.             tint(n);
  1410.             plotp(ESC);
  1411.             plotp('M');        /* Set text index    */
  1412.             plotp('T');
  1413.             tint(n);
  1414.             }
  1415.     }
  1416. }
  1417. SHAR_EOF
  1418. cat << \SHAR_EOF > plot.c
  1419. #include    "crc.h"
  1420.  
  1421. /*
  1422.     plot - draw vectors
  1423.  
  1424.     The CRC graphics package
  1425.  
  1426.     Carl Crawford
  1427.     Purdue University
  1428.     West Lafayette, IN 47907
  1429.  
  1430.     September 1980
  1431.  
  1432. */
  1433.  
  1434.  
  1435. #define MASK    0100000
  1436.  
  1437. plot(x,y,i)
  1438. float x,y;
  1439. int i;
  1440. {
  1441.     int l,m;
  1442.  
  1443.     switch((i>0)? i : -i){
  1444.     case 1:
  1445.         break;
  1446.     case 2:
  1447.         _ud = 0;
  1448.         break;
  1449.     case 3:
  1450.         _ud = 1;
  1451.         break;
  1452.     case 999:
  1453.         if(DEV > MBIT)_plotend();
  1454.         else{
  1455.             dsply();
  1456.             free(_pic);
  1457.         }
  1458.         return;
  1459.     default:
  1460.         return;
  1461.     }
  1462.  
  1463.     if( _fac != 1.0){
  1464.         x *= _fac;    
  1465.         y *= _fac;
  1466.     }
  1467.     l = floor( ( x + _xo )*_ipsz10 + 0.5) - _xp;
  1468.     m = floor( ( y + _yo )*_ipsz10 + 0.5) - _yp;
  1469.  
  1470. #ifdef    OLD
  1471.     l = floor( ( x + _xo - _xp/_ipsz10)/10.0 * _ipsz + 0.5 );
  1472.     m = floor( ( y + _yo - _yp/_ipsz10)/10.0 * _ipsz + 0.5 );
  1473. #endif    OLD
  1474.  
  1475.     if(_ud == 0){
  1476.         if(DEV <= MBIT)_bresen(l,m);
  1477.         else{
  1478.             drawr(l, m);
  1479.             _xp += l;
  1480.             _yp += m;
  1481.         }
  1482.     }
  1483.     else{
  1484.         _xp += l;
  1485.         _yp += m;
  1486.         if(DEV > MBIT)_mover( l,m);
  1487.     }
  1488.     _axp = _xo + x;
  1489.     _ayp = _yo + y;
  1490.     if(i<0){
  1491.         _xo = _axp;
  1492.         _yo = _ayp;
  1493.     }
  1494. }
  1495.  
  1496. _bresen(dx,dy)
  1497. int dx,dy;
  1498. {
  1499.     int ix,iy,major[2],minor[2],nb;
  1500.     int    zerozero[2];
  1501.     register int na,nc,nctr;
  1502.  
  1503. #ifdef    OLD
  1504.     if(dx == 0 && dy == 0)return;
  1505. #endif    OLD
  1506.     /* Resolve to first quadrant */
  1507.     ix=1;
  1508.     if(dx<0){
  1509.         ix = -1;
  1510.         dx = -dx;
  1511.     }
  1512.     iy=1;
  1513.     if(dy<0){
  1514.         iy = -1;
  1515.         dy = -dy;
  1516.     }
  1517.  
  1518.     /* Resolve to proper octant */
  1519.     major[1] = iy;
  1520.     major[0] = ix;
  1521.     if(dx<dy){
  1522.         minor[0] = 0;
  1523.         minor[1] = iy;
  1524.         na = dy;
  1525.         nb = dx + dx;
  1526.     }
  1527.     else{
  1528.         minor[1] = 0;
  1529.         minor[0] = ix;
  1530.         na = dx;
  1531.         nb = dy + dy;
  1532.     }
  1533.     nc = na + na;
  1534.     nctr = na;
  1535.  
  1536.     zerozero[0] = zerozero[1] = 0;
  1537.     step(zerozero);
  1538.     /* Loop through all the steps */
  1539.     while(nctr>0){
  1540.         na = na + nb;
  1541.         if(na>=nc){
  1542.             na -= nc;
  1543.             step(major);
  1544.         }
  1545.         else{
  1546.             step(minor);
  1547.         }
  1548.         nctr -= 1;
  1549.     }
  1550. }
  1551.  
  1552. step(a)
  1553. int a[];
  1554. {
  1555.     register int pos,c;
  1556.     register unsigned short bit;
  1557.  
  1558.     _xp += a[0];
  1559.     _yp += a[1];
  1560.     if(_xp<0 || _xp>511 || _yp<0 || _yp>511){
  1561.         if(_error == 0){
  1562.             fprintf(stderr,"attempt to plot outside of picture\n");
  1563.         }
  1564.         _error = 1;
  1565.         return;
  1566.     }
  1567.  
  1568.     pos = (16352 - (_yp<<5))+(_xp>>4);
  1569.     bit = 1<<(15-(_xp&017));
  1570.     _pic[pos] |= bit;
  1571. }
  1572.  
  1573. dsply()
  1574. {
  1575.                         /*
  1576.                          * Check to see if output is
  1577.                          * to a bit mapped device that
  1578.                          * needs an output filter.  
  1579.                          * Write the bit map and then
  1580.                          * do a pclose to wait for the
  1581.                          * end of the proc.
  1582.                          */
  1583.     if((DEVN && DEV == BIT) || DEV == GOV || DEV == IMAGE
  1584.         || DEV == GGOV || DEV == GIMAGE){
  1585.         write(fileno(_pipe_fd), _pic, _bufsize);
  1586.         pclose(_pipe_fd);
  1587.         return;
  1588.     }
  1589.     if(STORE[0] == '-' && STORE[1] == '\0'){
  1590.         _pipe_fd = stdout;
  1591.     }else{
  1592.         if((_pipe_fd=fopen(STORE,"w")) == NULL)_err("can't create: ",STORE);
  1593.     }
  1594.     write(fileno(_pipe_fd), _pic, _bufsize);
  1595.     fclose(_pipe_fd);
  1596. }
  1597.  
  1598. drawr(deltax,deltay)
  1599. int deltax,deltay;
  1600. /*
  1601.  *    Draw to relative postion given by delta-x and delta-y.
  1602.  */
  1603. {
  1604.     register x,y;
  1605.  
  1606.     x = deltax + _X;
  1607.     while(x < 0)x += 10230;
  1608.     if(x > 10230)x %= 10230;
  1609.     y = deltay + _Y;
  1610.     while(y < 0)y += 7790;
  1611.     if(y > 7790)y %= 7790;
  1612.     draw(x,y);
  1613. }
  1614.  
  1615. draw(x,y)
  1616. int x,y;
  1617. /*
  1618.  *    Draw a vector from current co-ordinate to (x,y).
  1619.  */
  1620. {
  1621.     register i;
  1622.  
  1623.     x &= 037777;    
  1624.     y &= 037777;
  1625.     if(DEV == TEK){
  1626.         if((_CM & 1) == 0){
  1627.             _CM++;
  1628.             plotp(GS);
  1629.             _CM &= 0177775;
  1630.             _CM += 2;
  1631.             plotty(_Y);    
  1632.             plottx(_X);
  1633.             plotfil(x,y);
  1634.             plotty(y);
  1635.             plottx(x);
  1636.             _X = x;    
  1637.             _Y = y;
  1638.             return;
  1639.         }
  1640.         if((_CM & 2) == 0){
  1641.             plotty(_Y);    
  1642.             plottx(_X);
  1643.             _CM &= 0177775;    
  1644.             _CM += 2;
  1645.         }
  1646.         plotfil(x,y);
  1647.         plotty(y);    
  1648.         plottx(x);
  1649.         _X = x;    
  1650.         _Y = y;
  1651.         return;
  1652.     }
  1653.  
  1654.     if(DEV == HP){
  1655.         if((_CM & 1)== 0){
  1656.             plotp(ETX);
  1657.             _CM&= 0177774;
  1658.             _CM += 1;
  1659.         }
  1660.         if(_CM & 2){        /* next will draw    */
  1661.             pmbpo(x,y);
  1662.         }
  1663.         else{
  1664.             plotp('p');
  1665.             pmbpo(_X,_Y);
  1666.             pmbpo(x,y);
  1667.             _CM &= 0177774;    
  1668.             _CM += 3;
  1669.         }
  1670.         _X = x;    
  1671.         _Y = y;
  1672.     }
  1673.  
  1674.     if (DEV == PLOT){
  1675.         p_cont(_X=x,_Y=y);
  1676.         _X = x;    
  1677.         _Y = y;
  1678.     }
  1679.  
  1680. }
  1681.  
  1682. plotfil(x,y)
  1683. int x,y;
  1684. /*
  1685.  *    Look at magnitude of change in current X andY and
  1686.  *    new x and y.  Set correct number of fill charctors.
  1687.  */
  1688. {
  1689.  
  1690.     x -= _X;    
  1691.     if(x < 0) x = -x;
  1692.     y -= _Y;    
  1693.     if(y < 0) y = -y;
  1694.     x &= 070000;    
  1695.     y &= 070000;
  1696.     x >>= 12;    
  1697.     y >>= 12;
  1698.     _FILL = x;    
  1699.     _FILL += y;
  1700.     _FILL++;    /* for good measure */
  1701. }
  1702.  
  1703. _mover(deltax,deltay)
  1704. int deltax,deltay;
  1705. /*
  1706.  *    Routine to move by +- delta-x and +- delta-y
  1707.  */
  1708. {
  1709.     register x,y;
  1710.  
  1711.     x = deltax + _X;
  1712.     while(x < 0)x += 10230;
  1713.     if(x > 10230)x %= 10230;
  1714.     y = deltay + _Y;
  1715.     while(y < 0)y += 7790;
  1716.     if(y > 7790)y %= 7790;
  1717.     move(x,y);
  1718. }
  1719.  
  1720. move(x,y)
  1721. int x,y;
  1722. /*    
  1723.  *    Move to an x,y co-ordinate.  Leave in graphic mode.
  1724.  */
  1725. {
  1726.  
  1727.     x &= 037777;    
  1728.     y &= 037777;
  1729.     if(DEV == TEK){
  1730.         if((_CM & 1) == 0){
  1731.             plotp(GS);
  1732.             _CM++;
  1733.             _CM &= 0177775;    
  1734.             _CM += 2;
  1735.             plotty(y);    
  1736.             plottx(x);
  1737.             _X = x;    
  1738.             _Y = y;
  1739.             return;
  1740.         }
  1741.         if((_CM & 2) == 2){
  1742.             plotp(GS);
  1743.         }
  1744.         plotty(y);    
  1745.         plottx(x);
  1746.         _CM &= 0177775;    
  1747.         _CM += 2;
  1748.         _X = x;    
  1749.         _Y = y;
  1750.         return;
  1751.     }
  1752.  
  1753.     if(DEV == HP){
  1754.         if((_CM & 1) == 0){
  1755.             plotp(ETX);    /* end alpha mode    */
  1756.             _CM &= 0177774;
  1757.         }
  1758.         if(_CM & 2){
  1759.             plotp('}');
  1760.         }
  1761.         plotp('p');
  1762.         pmbpo(x,y);
  1763.         _CM |= 3;
  1764.         _X = x;    
  1765.         _Y = y;
  1766.     }
  1767.  
  1768.     if (DEV == PLOT)
  1769.         p_move(_X=x, _Y=y);
  1770.  
  1771. }
  1772.  
  1773. plotty(n)
  1774. int n;
  1775. /*    Prints out a 10-bit Tektronics number supplied in n.
  1776.  */
  1777. {
  1778.     register char c;
  1779.     register i,j;
  1780.  
  1781.     i = n/10;
  1782.     if((n % 10) > 4)i++;
  1783.     j = i >> 5;
  1784.     plotp((j & 037) + 040);
  1785.     plotp((i & 037) + '`');
  1786. }
  1787.  
  1788. plottx(n)
  1789. int n;
  1790. /*    Prints out a 10-bit Tektronics number supplied in n.
  1791.  */
  1792. {
  1793.     register char c;
  1794.     register i,j;
  1795.  
  1796.     i = n/10;
  1797.     if((n % 10) > 4)i++;
  1798.     j = i >> 5;
  1799.     plotp((j & 037) + 040);
  1800.     plotp((i & 037) + 0100);
  1801.     while(_FILL--)plotp(1);
  1802.     _FILL = 0;
  1803. }
  1804.  
  1805. pmbpo(x,y)
  1806. int x,y;
  1807. {
  1808.     /*    Puts out x and y in HP MBP format.    */
  1809.     register max;
  1810.     register char c;
  1811.  
  1812.     x &= 037777;    
  1813.     y &= 037777;
  1814.     max = x;
  1815.     if(y > x)max = y;
  1816.     if(max < 4){
  1817.         plotp(0140 + (x << 2) + y);
  1818.         return;
  1819.     }
  1820.     if(max < 32){
  1821.         plotp(0140 + (x >> 1));
  1822.         c = ((x <<5) & 040) + y;
  1823.         if(!(c & 040))c += 0100;
  1824.         plotp(c);
  1825.         return;
  1826.     }
  1827.     if(max < 256){
  1828.         plotp(0140 + (x >> 4));
  1829.         c = ((x << 2) & 074) + ((y >> 6) & 3);
  1830.         if(!(c & 040))c += 0100;
  1831.         plotp(c);
  1832.         c = y & 077;
  1833.         if(!(c & 040))c += 0100;
  1834.         plotp(c);
  1835.         return;
  1836.     }
  1837.     if(max < 2048){
  1838.         c = 0140 + ((x >> 7) & 017);
  1839.         plotp(c);
  1840.         c = (x >> 1) & 077;
  1841.         if(!(c & 040))c += 0100;
  1842.         plotp(c);
  1843.         c = ((x << 5) & 040) + ((y >> 6)& 037);
  1844.         if(!(c & 040))c += 0100;
  1845.         plotp(c);
  1846.         c = y & 077;
  1847.         if(!(c & 040))c += 0100;
  1848.         plotp(c);
  1849.         return;
  1850.     }
  1851.     c = (x >> 10) & 017;
  1852.     plotp(c + 0140);
  1853.     c = (x >> 4) & 077;
  1854.     if(!(c & 040))c += 0100;
  1855.     plotp(c);
  1856.     c = ((x << 2) & 074) + ((y >> 12) & 3);
  1857.     if(!(c & 040))c += 0100;
  1858.     plotp(c);
  1859.     c = (y >> 6) & 077;
  1860.     if(!(c & 040))c += 0100;
  1861.     plotp(c);
  1862.     c = y & 077;
  1863.     if(!(c & 040))c += 0100;
  1864.     plotp(c);
  1865. }
  1866.  
  1867. pmbno(n)
  1868. int n;
  1869. {
  1870.     /*    print out n in HP MBN format    */
  1871.     register char c;
  1872.  
  1873.     n &= 0177777;
  1874.     if(n < 16){
  1875.         plotp(n + '`');
  1876.         return;
  1877.     }
  1878.     if(n < 1024){
  1879.         c = '`' + ((n >> 6)& 017);
  1880.         plotp(c);
  1881.         c = n & 077;
  1882.         if(!(c & 040))c += 0100;
  1883.         plotp(c);
  1884.         return;
  1885.     }
  1886.     c = (n >> 12) & 07;
  1887.     plotp(c + 0140);
  1888.     c = (n >> 6) & 077;
  1889.     if(!(c & 040))c += 0100;
  1890.     plotp(c);
  1891.     c = n & 077;
  1892.     if(!(c & 040))c += 0100;
  1893.     plotp(c);
  1894. }
  1895. SHAR_EOF
  1896. cat << \SHAR_EOF > newpen_.c
  1897. /*
  1898.     newpen_ - F77 interface to 'newpen'
  1899.  
  1900.     The CRC graphics package
  1901.  
  1902.     Carl Crawford 
  1903.     Purdue University
  1904.     West Lafayette, IN 47901
  1905.  
  1906.     October 1981
  1907. */
  1908.  
  1909. #include    "crc.h"
  1910.  
  1911. newpen_(n)
  1912. long    int    *n;
  1913. {
  1914.     newpen((int)*n);
  1915. }
  1916. SHAR_EOF
  1917. cat << \SHAR_EOF > number.c
  1918. /*
  1919.     number - provide formatted numeric labelling
  1920.  
  1921.     The CRC graphics package
  1922.  
  1923.     Carl Crawford
  1924.     Purdue University
  1925.     W. Lafayette, IN 47907
  1926.  
  1927.     September 1981
  1928. */
  1929.  
  1930. #include    "crc.h"
  1931.  
  1932. number(x,y,height,angle,fmt,args)
  1933. float x,y,height,angle;
  1934. int args;
  1935. char *fmt;
  1936.  
  1937. {
  1938.     struct _iobuf _strbuf;
  1939.  
  1940.     _strbuf._flag = _IOWRT+_IOSTRG;
  1941.     _strbuf._ptr = _abuf;
  1942.     _strbuf._cnt = 32767;
  1943.     _doprnt(fmt, &args, &_strbuf);
  1944.     putc('\0', &_strbuf);
  1945.     symbol(x,y,height,_abuf,angle);
  1946. }
  1947. SHAR_EOF
  1948. cat << \SHAR_EOF > number_.c
  1949. /*
  1950.     number_ - F77 interface to 'number'
  1951.  
  1952.     The CRC graphics package
  1953.  
  1954.     Carl Crawford 
  1955.     Purdue University
  1956.     West Lafayette, IN 47901
  1957.  
  1958.     October 1981
  1959. */
  1960.  
  1961. #include    "crc.h"
  1962. #ifndef vax
  1963. #  include    <ctype.h>
  1964. #endif /* vax */
  1965.  
  1966. number_(x,y,height,angle,format,num,formatl)
  1967. float    *x,*y,*height,*angle;
  1968. char    *format;
  1969. union {
  1970.     short    s;
  1971.     int    i;
  1972.     long    l;
  1973.     float    f;
  1974.     double    d;
  1975. }    *num;
  1976. long    int    formatl;
  1977. {
  1978. #ifdef vax
  1979.     number(*x,*y,*height,*angle,format,*num);
  1980. #else  /* vax */
  1981. /*
  1982.  * On machines with big endian byte order we need to know how many bytes
  1983.  * num is pointing to, so we scan the format string to figure to this
  1984.  * out as best possible.  N.B. This is a kludge!!!
  1985.  */
  1986.     register char *p;
  1987.     int longint;
  1988.  
  1989.     longint = 0;
  1990.     for (p = format; p < format + formatl; p++) {
  1991.         if (*p != '%') {
  1992.             continue;
  1993.         }
  1994.         p++;
  1995.         while (*p == '#' || *p == '-' || *p == '+' || *p == ' ') {
  1996.             p++;
  1997.         }
  1998.         while (isdigit(*p)) {
  1999.             p++;
  2000.         }
  2001.         if (*p == '.') {
  2002.             p++;
  2003.             while (isdigit(*p)) {
  2004.                 p++;
  2005.             }
  2006.         }
  2007.         if (*p == 'l' || *p == 'L') {
  2008.             longint = 1;
  2009.             p++;
  2010.         }
  2011.         if (*p == 'd' || *p == 'D' || *p == 'o' || *p =='O' ||
  2012.             *p == 'x' || *p == 'X' || *p == 'u' || *p =='U' ) {
  2013.             if (longint) {
  2014.                 /* We were passed a FORTRAN INTEGER*4 value */
  2015.                 number(*x, *y, *height, *angle, format, num->l);
  2016.             } else {
  2017.                 /* We were passed a FORTRAN INTEGER value */
  2018.                 number(*x, *y, *height, *angle, format, num->i);
  2019.             }
  2020.             return;
  2021.         }
  2022.         if (*p == 'f' || *p == 'F' || *p == 'e' || *p =='E' ||
  2023.             *p == 'g' || *p == 'G' ) {
  2024.             /* We were passed a FORTRAN REAL or DOUBLE PRECISION
  2025.              * value */
  2026.             number(*x, *y, *height, *angle, format, *num);
  2027.             return;
  2028.         }
  2029.     }
  2030.     /* scan of format string failed so we'll assume we were passed
  2031.      * a FORTRAN REAL or DOUBLE PRECISION value. */
  2032.     number(*x, *y, *height, *angle, format, *num);
  2033. #endif /* vax */
  2034. }
  2035. SHAR_EOF
  2036. cat << \SHAR_EOF > plot_.c
  2037. /*
  2038.     plot_ - F77 interface to 'plot'
  2039.  
  2040.     The CRC graphics package
  2041.  
  2042.     Carl Crawford 
  2043.     Purdue University
  2044.     West Lafayette, IN 47901
  2045.  
  2046.     October 1981
  2047. */
  2048.  
  2049. #include    "crc.h"
  2050.  
  2051. plot_(x,y,i)
  2052. float    *x;
  2053. float    *y;
  2054. long int    *i;
  2055. {
  2056.     plot(*x,*y,(int)*i);
  2057. }
  2058. SHAR_EOF
  2059. cat << \SHAR_EOF > plotp.c
  2060. /*
  2061.     plotp - send char to the TEK or the HP
  2062.  
  2063.     The CRC graphics package
  2064.  
  2065.     Carl Crawford
  2066.     Purdue University
  2067.     W. Lafayette, IN
  2068.  
  2069.     September 1981
  2070. */
  2071.  
  2072. #include    "crc.h"
  2073.  
  2074. plotp(data)
  2075. char data;    
  2076. {
  2077.     fputc(data,_pipe_fd);
  2078. }
  2079. SHAR_EOF
  2080. cat << \SHAR_EOF > plots.c
  2081. /*
  2082.     plots - initialize graphics system
  2083.  
  2084.     The CRC graphics package
  2085.  
  2086.     Carl Crawford
  2087.     Purdue University
  2088.     W. Lafayette, IN 47907
  2089.  
  2090. */
  2091.  
  2092. #include    "crc.h"
  2093.  
  2094. plots(dev,blank,str)
  2095. int    dev;
  2096. int    blank;
  2097. char    *str;
  2098. {
  2099.     char    *malloc();
  2100.     unsigned int    q;
  2101.     FILE    *fd,*popen();
  2102.     char    *DeviceSpec;
  2103.     int    ustr;    /* 1=used str */
  2104.     int    _clean();    /* clean up routine after interrupts */
  2105.  
  2106.     _pic = 0;           /* pointer to bit plane */
  2107.     _xp = 0;_yp = 0;        /* integer position */
  2108.     _X = 0; _Y = 0;        /* Tek (?) Position */
  2109.     _axp = 0;_ayp = 0;      /* real position */
  2110.     _xo = 0;_yo = 0;        /* current origin */
  2111.     _ud = 0;                /* indicates up/down for pen */
  2112.     _error = 0;             /* indicates error in plotting */
  2113.     _fac = 0;        /* scale factor */
  2114.     _ipsz10 = 0;        /* ipsize / 10.0 */
  2115.  
  2116.     BLANK = blank;
  2117.     DEV = dev & 07;
  2118.     DEVN = ((dev&070)>>3);
  2119.     if(dev & 0100){
  2120.         ustr = 1;
  2121.     }else{
  2122.         ustr = 0;
  2123.     }
  2124.     _bufsize = 32768;
  2125.     _ipsz = 511.;
  2126.     TICDIS = 1.0;
  2127.     if(!STORE)STORE = "graph";
  2128.     if(!SITE)SITE = "-pl";
  2129.     HEIGHT = .2;
  2130.     DIGITS = 6;
  2131.     PLOTFILT = NULL;
  2132.     switch(DEV){
  2133.  
  2134.     case BIT:         /* output file mode */
  2135.         switch(DEVN){
  2136.  
  2137.         case 0:         /* file */
  2138.             _pipe_fd = stdout;      /* override error message */
  2139.             break;
  2140.         case 1:         /* gp */
  2141.             strcpy(_abuf,"exec gp -i ");
  2142.             if(ustr)strcat(_abuf,str);
  2143.             _pipe_fd = popen(_abuf,"w");
  2144.             break;
  2145.         case 2:        /* gplp */
  2146.             strcpy(_abuf,"exec gplp ");
  2147.             strcat(_abuf,SITE);
  2148.             strcat(_abuf," -i ");
  2149.             if(ustr)strcat(_abuf,str);
  2150.             _pipe_fd = popen(_abuf,"w");
  2151.             break;
  2152.         }
  2153.         break;
  2154.     case GOV:        /* graphics overlay */
  2155.     case IMAGE:        /* comtal image */
  2156.     case GGOV:        /* Grinnell Graphics Overlay */
  2157.     case GIMAGE:        /* Grinnell Image Plane */
  2158.         DeviceSpec = "0";
  2159.         if (DEV == IMAGE || DEV == GIMAGE){
  2160.             if (DEVN == 0)
  2161.                 *DeviceSpec = NULL;
  2162.             else
  2163.                 *DeviceSpec += DEVN - 1;
  2164.         } else {
  2165.             *DeviceSpec += DEVN;
  2166.         }
  2167.         sprintf(_abuf,"exec /usr/lib/graphics/gd -%c%c%s%c ",
  2168.             (DEV == GOV || DEV == IMAGE) ? 'C' : 'G',
  2169.             (DEV == GOV || DEV == GGOV) ? 'o' : 'i',
  2170.             DeviceSpec,
  2171.             BLANK ? 'b' : ' ');
  2172.         if(ustr)strcat(_abuf,str);
  2173.         _pipe_fd = popen(_abuf,"w");
  2174.         break;
  2175.     case PLOT:
  2176.         if (ustr && str){
  2177.             char    buffer[BUFSIZ];
  2178.  
  2179.             sprintf(buffer,"%s -T%s\n",PLOTBIN,str);
  2180.             PLOTFILT = str;
  2181.             _pipe_fd = popen(buffer,"w");
  2182.         } else {
  2183.             _pipe_fd = fdopen(dup(1),"w");
  2184.         }
  2185.         p_space(0,0,7800,7800);
  2186.         if (!BLANK)
  2187.             p_erase();
  2188.         break;
  2189.     case TEK:         /* tektronix */
  2190.         _pipe_fd = fdopen(dup(1),"w"); /* buffer Tek info */
  2191.         break;
  2192.     case HP:        /* HP */
  2193.         strcpy(_abuf,"exec /usr/lib/graphics/hpd ");
  2194.         if(ustr)strcat(_abuf,str);
  2195.         _pipe_fd = popen(_abuf,"w");
  2196.         break;
  2197.     default:
  2198.         fprintf(stderr,"plots: bad device number\n");
  2199.         exit(1);
  2200.     }
  2201.     if(_pipe_fd == NULL){
  2202.         fprintf(stderr,"can't execute pipe\n");
  2203.         exit(1);
  2204.     }
  2205.     if(DEV <= MBIT){
  2206.         if( (_pic = (unsigned short *) malloc(_bufsize)) == NULL){
  2207.             _err("plots: can't allocate space","");
  2208.         }
  2209.         if(BLANK&&DEV==0&&DEVN==0&&((fd=fopen(STORE,"r"))!=NULL)){
  2210.             fread(_pic,sizeof(*_pic),16384,fd);
  2211.             fclose(fd);
  2212.         }else{
  2213.             for(q=0;q<16384;_pic[q++] = 0);
  2214.         }
  2215.     }
  2216.     else{
  2217.         plotinit();
  2218.         _hsig = signal(SIGHUP,_clean);
  2219.         _isig = signal(SIGINT,_clean);
  2220.         _qsig = signal(SIGQUIT,_clean);
  2221.         _ipsz = 7790.;
  2222.     }
  2223.     _ipsz10 = _ipsz / 10.0;
  2224.     _xo = _yo = _axp = _ayp = 0.0;
  2225.     _xp = _yp = _error= 0;
  2226.     _ud = 1;
  2227.     _fac = 1.0;
  2228. }
  2229.  
  2230. plotinit()
  2231. {
  2232.     register i,j;
  2233.     int    tty[3];
  2234.     register char *p;
  2235.  
  2236.  
  2237.     if(DEV == TEK){
  2238.         _CM = 0;
  2239.  
  2240.         /* set to 'bs0' and 'lcase' */
  2241.  
  2242.         gtty(0,_intty);
  2243.         tty[0] = _intty[0];
  2244.         tty[1] = _intty[1];
  2245.         tty[2] = _intty[2] & ~000004 & ~0100000;
  2246.         stty(0,tty);
  2247.  
  2248.         if(!BLANK){    /* blank sreen if necessary */
  2249.             switch(DEVN) {
  2250.                 case 0:
  2251.                 case 2:
  2252.                 plotp(ESC);    
  2253.                 plotp(FF);
  2254.                 fflush(_pipe_fd);
  2255.                 sleep(2);
  2256.                 break;
  2257.                 case 1:    /* extra stuff for Retrographics */
  2258.                 plotp(GS);
  2259.                 plotp(SUB);
  2260.                 plotp(EM);
  2261.                 plotp(ESC);    
  2262.                 plotp(FF);
  2263.                 plotp(US);
  2264.                 fflush(_pipe_fd);
  2265.                 }
  2266.         }
  2267.         _FILL = 0;
  2268.         plotp(ESC);    /* set proper vector type */
  2269.         plotp('`');
  2270.         return;
  2271.     }
  2272.  
  2273.     if(DEV == HP){
  2274.         _CM = 0;
  2275.         plotp(ESC);    
  2276.         plotp('.');    
  2277.         plotp('(');
  2278.         plotp(ESC);  
  2279.         plotp('.'); 
  2280.         plotp('M');
  2281.         plotp(':');  
  2282.         plotp(ESC);
  2283.         p = ".I513;5;71;10:";
  2284.         while(*p)plotp(*p++);
  2285.         /*  Set handshake mode 2, buff size 513 bytes, enquire  = ^E,
  2286.             GO string singal = "G\n" */
  2287.         plotp('~');    
  2288.         plotp('W');
  2289.         pmbpo(380,366);
  2290.         pmbpo(13903,10668);
  2291.         plotp('~');    
  2292.         plotp('S');
  2293.         pmbpo(10244,7804);
  2294.         plotp('}');
  2295.         _CM = 1;
  2296.         plotp(ETX); /* set proper vector type */
  2297.         plotp('}');
  2298.         plotp('~');
  2299.         plotp('R');
  2300.         plotp('}');
  2301.         alpha();
  2302.         newpen(1);
  2303.     }
  2304. }
  2305. SHAR_EOF
  2306. cat << \SHAR_EOF > plots_.c
  2307. /*
  2308.     plots_ - F77 interface to 'plot'
  2309.  
  2310.     The CRC graphics package
  2311.  
  2312.     Carl Crawford
  2313.     Purdue University
  2314.     W. Lafayette, IN. 47907
  2315.  
  2316.     September 1981: <crc> added 'str' to call
  2317. */
  2318.  
  2319. #include    "crc.h"
  2320.  
  2321. plots_(dev,blank,str)
  2322. long int    *dev;
  2323. long int    *blank;
  2324. char    *str;
  2325. {
  2326.     plots((int)*dev,(int)*blank,str);
  2327. }
  2328. SHAR_EOF
  2329. cat << \SHAR_EOF > plotsubs.c
  2330. #include <stdio.h>
  2331. #include "crc.h"
  2332.  
  2333. p_cont(xi,yi){
  2334.     putc('n',_pipe_fd);
  2335.     p_putsi(xi);
  2336.     p_putsi(yi);
  2337. }
  2338. p_erase(){
  2339.     putc('e',_pipe_fd);
  2340. }
  2341. p_move(xi,yi){
  2342.     putc('m',_pipe_fd);
  2343.     p_putsi(xi);
  2344.     p_putsi(yi);
  2345. }
  2346.  
  2347. p_putsi(a){
  2348.     putc((char)a,_pipe_fd);
  2349.     putc((char)(a>>8),_pipe_fd);
  2350. }
  2351.  
  2352. p_space(x0,y0,x1,y1){
  2353.     putc('s',_pipe_fd);
  2354.     p_putsi(x0);
  2355.     p_putsi(y0);
  2356.     p_putsi(x1);
  2357.     p_putsi(y1);
  2358. }
  2359. SHAR_EOF
  2360. cat << \SHAR_EOF > scale.c
  2361. /*
  2362.     scale - find minimum and maximum of vector
  2363.  
  2364.     The CRC graphics package
  2365.  
  2366.     Carl Crawford 
  2367.     Purdue University
  2368.     West Lafayette, IN 47901
  2369.  
  2370.     October 1981
  2371. */
  2372.  
  2373. #include    "crc.h"
  2374.  
  2375. scale(a,n)
  2376. float *a;
  2377. int n;
  2378. {
  2379.     float ai,fmax,fmin;
  2380.     register    int i;
  2381.  
  2382.     fmax = fmin = *a;
  2383.     for(i=0;i<n;i++){
  2384.         ai=a[i];
  2385.         if(ai > fmax) fmax = ai;
  2386.         if(ai < fmin) fmin = ai;
  2387.     }
  2388.     a[n] = fmin;
  2389.     a[n+1] = fmax;
  2390. }
  2391. SHAR_EOF
  2392. cat << \SHAR_EOF > scale_.c
  2393. /*
  2394.     scale_ - F77 version of 'scale'
  2395.  
  2396.     The CRC graphics package
  2397.  
  2398.     Carl Crawford 
  2399.     Purdue University
  2400.     West Lafayette, IN 47901
  2401.  
  2402.     October 1981
  2403.  
  2404.     Didn't call 'scale' because of name conflicts in
  2405.     F77's libraries.
  2406. */
  2407.  
  2408. #include    "crc.h"
  2409.  
  2410. scale_(a,n)
  2411. float    *a;
  2412. long    int    *n;
  2413. {
  2414.     float ai,fmax,fmin;
  2415.     register int i;
  2416.  
  2417.     fmax = fmin = *a;
  2418.     for(i=0;i<*n;i++){
  2419.         ai=a[i];
  2420.         if(ai > fmax) fmax = ai;
  2421.         if(ai < fmin) fmin = ai;
  2422.     }
  2423.     a[*n] = fmin;
  2424.     a[1 + *n] = fmax;
  2425. }
  2426. SHAR_EOF
  2427. cat << \SHAR_EOF > site.c
  2428. #include    "crc.h"
  2429.  
  2430. /*
  2431.     site - change default site for gplp linkage
  2432.  
  2433.     The CRC graphics package
  2434.  
  2435.     carl crawford
  2436.     purdue university
  2437.     w. lafayette. in 47907
  2438.  
  2439.     jan. 5, 1981
  2440. */
  2441.  
  2442. site(s)
  2443. char *s;
  2444. {
  2445.     SITE = s;
  2446. }
  2447. SHAR_EOF
  2448. cat << \SHAR_EOF > site_.c
  2449. #include    "crc.h"
  2450. /*
  2451.     site_ - interface to site from F77
  2452.  
  2453.     The CRC graphics package
  2454.  
  2455.     Carl Crawford
  2456.     Purdue University
  2457.     W. Lafayette, IN 47907
  2458.  
  2459.     Jan. 6, 1981
  2460. */
  2461.  
  2462. site_(s)
  2463. char    *s;
  2464. {
  2465.     site(s);
  2466. }
  2467. SHAR_EOF
  2468. cat << \SHAR_EOF > sline.c
  2469. /*
  2470.     sline - draw lines with on center symbols
  2471.  
  2472.     The CRC graphics package
  2473.  
  2474.     Carl Crawford 
  2475.     Purdue University
  2476.     West Lafayette, IN 47901
  2477.  
  2478.     October 1981
  2479. */
  2480.  
  2481. #include    "crc.h"
  2482.  
  2483. sline(x,y,n,lx,ly,j,sym)
  2484. float *x,*y,lx,ly;
  2485. int n,j,sym;
  2486. {
  2487.     float xn,yn,yn1,xn1;
  2488.     register    int i;
  2489.     int code;
  2490.     char t[2];
  2491.  
  2492.     xn = x[n];    
  2493.     xn1 = x[n+1];
  2494.     yn = y[n];    
  2495.     yn1 = y[n+1];
  2496.     _schk(xn,xn1);
  2497.     _schk(yn,yn1);
  2498.     xn1 = lx / (xn1 - xn);
  2499.     yn1 = ly / (yn1 - yn);
  2500.  
  2501.     if(j == 0)j = 1;
  2502.     code=2;
  2503.     if(j < 0){
  2504.         code=3;
  2505.         j= -j;
  2506.     }
  2507.     t[0]= 0;
  2508.     t[1]= 0;
  2509.     if(sym <= 0 )t[0]= ' ';
  2510.     else    if(sym < 11)t[0]=t[0]+sym+175;
  2511.     else    if(sym <14)t[0]=t[0]+sym+159;
  2512.     else t[0]= ' ';
  2513.     if(sym == 0)j=4096;
  2514.     plot((x[0]-xn)*xn1,(y[0]-yn)*yn1,3);
  2515.     symbol((x[0]-xn)*xn1,(y[0]-yn)*yn1,.65*HEIGHT,t,0.);
  2516.     plot((x[0]-xn)*xn1,(y[0]-yn)*yn1,3);
  2517.     for(i=1;i<n;i++){
  2518.         plot((x[i]-xn)*xn1,(y[i]-yn)*yn1,code);
  2519.         if(i%j == 0){
  2520.             symbol((x[i]-xn)*xn1,(y[i]-yn)*yn1,.65*HEIGHT,t,0.);
  2521.             plot((x[i]-xn)*xn1,(y[i]-yn)*yn1,3);
  2522.         }
  2523.     }
  2524. }
  2525. SHAR_EOF
  2526. cat << \SHAR_EOF > sline_.c
  2527. /*
  2528.     sline_ - F77 interface to 'sline'
  2529.  
  2530.     The CRC graphics package
  2531.  
  2532.     Carl Crawford 
  2533.     Purdue University
  2534.     West Lafayette, IN 47901
  2535.  
  2536.     October 1981
  2537. */
  2538.  
  2539. #include    "crc.h"
  2540.  
  2541. sline_(x,y,n,lx,ly,j,sym)
  2542. float *x,*y,*lx,*ly;
  2543. long int *n,*j,*sym;
  2544. {
  2545.     sline(x,y,(int)*n,*lx,*ly,(int)*j,(int)*sym);
  2546. }
  2547. SHAR_EOF
  2548. cat << \SHAR_EOF > speed.c
  2549. /*
  2550.     speed - change speed of HP plotter 
  2551.  
  2552.     The CRC graphics package
  2553.  
  2554.     Carl Crawford 
  2555.     Purdue University
  2556.     West Lafayette, IN 47901
  2557.  
  2558.     October 1981
  2559. */
  2560.  
  2561. #include "crc.h"
  2562.  
  2563. speed(vel)
  2564. int vel;
  2565. {
  2566.     if(DEV == HP){
  2567.         plotp('~');
  2568.         plotp('V');
  2569.         plotp(vel<32 ? 0100+vel : vel);
  2570.     }
  2571. }
  2572. SHAR_EOF
  2573. cat << \SHAR_EOF > speed_.c
  2574. #include    "crc.h"
  2575.  
  2576. /*
  2577.     speed_ - f77 interface to 'speed'
  2578.  
  2579.     The CRC graphics package
  2580.  
  2581.     Carl Crawford
  2582.     Purdue University
  2583.     W. Lafayette, IN 47907
  2584.  
  2585.     March 11, 1981
  2586. */
  2587.  
  2588. speed_(vel)
  2589. long    int    *vel;
  2590. {
  2591.     speed((int)*vel);
  2592. }
  2593. SHAR_EOF
  2594. cat << \SHAR_EOF > symbol.c
  2595. /*
  2596.     symbol - plot strings
  2597.  
  2598.     The CRC graphics package
  2599.  
  2600.     Carl Crawford
  2601.     Purdue University
  2602.     W. Lafayette, IN 47907
  2603.  
  2604. */
  2605.  
  2606. #include    "crc.h"
  2607.  
  2608. symbol(x,y,height,str,angle)
  2609.     float x,y,angle;
  2610.     float height;
  2611.     char *str;
  2612. {
  2613.     int f,vis;
  2614.     int charfont();
  2615.     float xx,yy,t1,t2,ca,sa,d2r;
  2616.     static    float    oangle,oheight;
  2617.     static    int    first    = 1;    /* ==1 if first call    */
  2618.     int    dollar;
  2619.     char    cc;
  2620.  
  2621.     if(DEV == TEK && DEVN == 2 && index(str,'$') == 0) {
  2622.         register    int    i;
  2623.         plot(x,y,3);
  2624.         if(oangle != angle || first) {
  2625.         plotp(ESC);    /* Graphic text rotation    */
  2626.         plotp('M');
  2627.         plotp('R');
  2628.         tint((int) angle); tint(0);
  2629.         oangle = angle;
  2630.         }
  2631.         if(oheight != height || first) {
  2632.         plotp(ESC);    /* Graphic test size        */
  2633.         plotp('M');
  2634.         plotp('C');
  2635.         tint((int)(190*height));
  2636.         tint((int)(265*height));
  2637.         tint((int)( 75*height));
  2638.         oheight = height;
  2639.         }
  2640.         first = 0;
  2641.         plotp(ESC);    /* Output graphic string    */
  2642.         plotp('L');
  2643.         plotp('T');
  2644.         tint(strlen(str));
  2645.         for(i=0; str[i]; i++)
  2646.         plotp(str[i]);
  2647.         return;
  2648.         }
  2649.  
  2650.     d2r = 4.0 * atan(1.0) / 180.0;
  2651.     dollar = 0;
  2652.     angle *= d2r;
  2653.     sa = sin(angle);
  2654.     ca = cos(angle);
  2655.     plot(x,y,3);
  2656.  
  2657.     while(cc = *str){
  2658.         if(cc == '$' && dollar == 0){
  2659.             dollar = 1;
  2660.             str++;
  2661.         }
  2662.         else{
  2663.             if(dollar == 1){
  2664.                 dollar = 0;
  2665.                 cc += 0200;
  2666.             }
  2667.  
  2668. /*                /* kludge bad font defintition for '.' */
  2669. /*            if(cc == '.' && DEV <= MBIT)
  2670. /*                cc = ',';
  2671.  */
  2672.             do{
  2673.                 f = charfont(cc,height,&xx,&yy,&vis);
  2674.                 t1 = ca * xx - sa * yy;
  2675.                 t2 = sa * xx + ca *yy;
  2676.                 plot(t1+x,t2+y,3-vis);
  2677.             }
  2678.             while(f);
  2679.             x += t1;
  2680.             y += t2;
  2681.             str++;
  2682.         }
  2683.     }
  2684. }
  2685.  
  2686. /*   Charfont is a program that looks up the end points  of  line
  2687. segments  for  plotting  characters.   Each  time  'charfont'  is
  2688. called, it returns the relative coordinates, which when added  to
  2689. the  current  location yields the final end point for a line seg-
  2690. ment.  The initial point of the line segment is the current loca-
  2691. tion.   Whether the line segment is to be visible or not is indi-
  2692. cated by the returned value in "visflg". */
  2693.  
  2694. short  *pntcoord;    /* pointer to coordinates */
  2695. int    initflg;    /* 1=open font file */
  2696. struct  {        /* header structure */
  2697.     short  height;
  2698.     short  coordsz;
  2699.     short  pntr1st[256];
  2700. }fontcom;
  2701.  
  2702. charfont(symbol,height,x,y,visflg)
  2703.     char  symbol;
  2704.     float  height, *x, *y;
  2705.     int  *visflg;
  2706. {
  2707.     int  i;
  2708.     static short *pntr;
  2709.     static float  scale;
  2710.     register int  temp;
  2711.  
  2712.     if(initflg == 0)
  2713.         fontinit(BINARY_FONT_FILE);
  2714.  
  2715.     /* find coordinate of first point */
  2716.  
  2717.     if (pntr == 0) {
  2718.         if ( (i=fontcom.pntr1st[symbol&0377]) == -1) {
  2719.  
  2720.             /* assume space if can't find it */
  2721.  
  2722.             if ( (i=fontcom.pntr1st[' ']) == -1) {
  2723.  
  2724.                 /* set if no space */
  2725.  
  2726.                 *x = 0.0;
  2727.                 *y = 0.0;
  2728.                 *visflg = 0;
  2729.                 return(0);
  2730.             }
  2731.         }
  2732.         pntr = pntcoord+i;
  2733.         scale = height/fontcom.height;
  2734.     }
  2735.     temp = *pntr++;
  2736.     
  2737.     /* get X coordiante */
  2738.  
  2739.     *x = ((temp>>7)&077)*scale;
  2740.     if (temp&0020000)*x = (-(*x));
  2741.  
  2742.     /* get Y coordinate */
  2743.  
  2744.     *y = (temp&077)*scale;
  2745.     if (temp&0100)*y = (-(*y));
  2746.  
  2747.     /* get visib flag */
  2748.  
  2749.     *visflg = (temp&040000)&&01;
  2750.  
  2751.     /* check for last coordinate */
  2752.  
  2753.     if (temp < 0) {
  2754.         pntr = 0;
  2755.         return(0);
  2756.     }
  2757.     return(1);
  2758. }
  2759.  
  2760. /*  The font file used by 'fontinit' to read  in  the  data  for
  2761.     'charfont' has the following format:
  2762.  
  2763. short  height     Default character height.
  2764. short  size       Bytes of core required to hold coordinates.
  2765. short  pnt[256]   Indexes to 1st coordinate of each symbol.
  2766. short  crd[size]  Coordinates of symbols
  2767.  
  2768. Where each crd[i] has the following format:
  2769.  
  2770.   EVSXXXXXXSYYYYYY
  2771.   III     IIIIIIII
  2772.   III     I   I----- Y coordinate (sign magnitude format)
  2773.   IIIIIIIII
  2774.   II   I----- X coordinate (sign magnitude format)
  2775.   II----- Line segment visible flag (0=invisible, 1=visible)
  2776.   I----- 1=more coordinates; 0=last coordinate
  2777.  
  2778. */
  2779.  
  2780. fontinit(file)
  2781. char  *file;
  2782. {
  2783.     FILE  *fd;    /* input file desciptor */
  2784.     char  *malloc();
  2785.  
  2786.     if((fd = fopen(file,"r")) == NULL)
  2787.         _err ("unable to open character font file ", file);
  2788.  
  2789.     /* assume that structure of font file is correct */
  2790.     fread(&fontcom,sizeof(fontcom),1,fd);
  2791.     if((pntcoord=(short *) malloc(fontcom.coordsz)) == NULL)
  2792.         _err ("can't allocate space for fonts","");
  2793.     fread(pntcoord,fontcom.coordsz,1,fd);
  2794.     initflg = 1;
  2795.     fclose(fd);
  2796. }
  2797.  
  2798. tint(i)
  2799.     int i;
  2800. {
  2801.     int negative,lo,hi1,hi2;
  2802.     negative = 1;
  2803.     if(i < 0){
  2804.         i = -i;
  2805.         negative = 0;
  2806.         }
  2807.     lo = (i % 16) + 32;
  2808.     if(negative)lo += 16;
  2809.     i /= 16;
  2810.     hi1 = (i % 64) + 64;
  2811.     i /= 64;
  2812.     hi2 = (i % 64) + 64;
  2813.     if(hi2 == 64){
  2814.         if(hi1 == 64){
  2815.             plotp(lo);
  2816.             return;
  2817.             }
  2818.         plotp(hi1); plotp(lo);
  2819.         return;
  2820.         }
  2821.     plotp(hi2); plotp(hi1); plotp(lo);
  2822. }
  2823. SHAR_EOF
  2824. cat << \SHAR_EOF > symbol_.c
  2825. /*
  2826.     symbol_ - F77 interface to 'symbol'
  2827.  
  2828.     The CRC graphics package
  2829.  
  2830.     Carl Crawford 
  2831.     Purdue University
  2832.     West Lafayette, IN 47901
  2833.  
  2834.     October 1981
  2835. */
  2836.  
  2837. #include    "crc.h"
  2838.  
  2839. symbol_(x,y,height,string,angle,stringl)
  2840. float    *x;
  2841. float    *y;
  2842. float    *height;
  2843. char    *string;
  2844. float    *angle;
  2845. long    int    stringl;
  2846. {
  2847.     symbol(*x,*y,*height,string,*angle);
  2848. }
  2849. SHAR_EOF
  2850. cat << \SHAR_EOF > where.c
  2851. /*
  2852.     where - return plot status
  2853.  
  2854.     The CRC graphics package
  2855.  
  2856.     Carl Crawford 
  2857.     Purdue University
  2858.     West Lafayette, IN 47901
  2859.  
  2860.     October 1981
  2861. */
  2862.  
  2863. #include    "crc.h"
  2864.  
  2865. where(x,y,sf)
  2866. float    *x,*y,*sf;
  2867. {
  2868.     *x = _axp - _xo;
  2869.     *y = _ayp - _yo;
  2870.     *sf = _fac;
  2871. }
  2872. SHAR_EOF
  2873. cat << \SHAR_EOF > where_.c
  2874. /*
  2875.     where_ - F77 interface to 'where'
  2876.  
  2877.     The CRC graphics package
  2878.  
  2879.     Carl Crawford 
  2880.     Purdue University
  2881.     West Lafayette, IN 47901
  2882.  
  2883.     October 1981
  2884. */
  2885.  
  2886. #include    "crc.h"
  2887.  
  2888. where_(x,y,sf)
  2889. float    *x;
  2890. float    *y;
  2891. float    *sf;
  2892. {
  2893.     where(x,y,sf);
  2894. }
  2895. SHAR_EOF
  2896. chdir ..
  2897. #    End of shell archive
  2898. exit 0
  2899.  
  2900. -- 
  2901.  
  2902. Rich $alz            "Anger is an energy"
  2903. Cronus Project, BBN Labs    rsalz@bbn.com
  2904. Moderator, comp.sources.unix    sources@uunet.uu.net
  2905.