home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2005 < prev    next >
Internet Message Format  |  1990-12-28  |  22KB

  1. From: hot@integow.uucp (Roland van Hout)
  2. Newsgroups: alt.sources
  3. Subject: PD plot(4) librarys (and hercules driver for interactive 386) part 2 of 9
  4. Message-ID: <1390@integow.uucp>
  5. Date: 28 Oct 90 03:52:28 GMT
  6.  
  7.  
  8.  
  9.  
  10. #!/bin/sh
  11. # This is part 02 of a multipart archive
  12. if touch 2>&1 | fgrep '[-amc]' > /dev/null
  13.  then TOUCH=touch
  14.  else TOUCH=true
  15. fi
  16. # ============= libplot/ReGIS/libReGIS.c ==============
  17. echo "x - extracting libplot/ReGIS/libReGIS.c (Text)"
  18. sed 's/^X//' << 'SHAR_EOF' > libplot/ReGIS/libReGIS.c &&
  19. X
  20. X/* plot(4) graphics library for a regis terminal for VT240/VT300/GIGI */
  21. X/* This is public domain written by Roland van Hout hot@hot.mug */
  22. Xextern float deltx,delty;
  23. Xfloat gxscrunch,gyscrunch;
  24. Xfloat pitograd;
  25. Xint offx,offy;
  26. X
  27. X#include <math.h>
  28. X
  29. Xopenpl()
  30. X{
  31. Xprintf(    "\033PpS(E)\033\\");
  32. X
  33. X}
  34. X
  35. Xclosepl()
  36. X{
  37. X    printf("\033\\\033[24;1H");
  38. X
  39. X}
  40. X
  41. Xspace(x0,y0,x1,y1)
  42. Xint x0,y0,x1,y1;
  43. X{
  44. Xint x,y;
  45. Xpitograd=(180.0/M_PI);
  46. X
  47. Xif (x1>0 && y1>0 && y0<y1 && x0<x1) {
  48. X    x=x1-x0;y=y1-y0;
  49. X    gxscrunch=(700/(float) x);gyscrunch=(490/(float) y);
  50. X    offx = -(x0*gxscrunch);offy= 485+(y0*gyscrunch);
  51. X}
  52. Xelse {
  53. X    gxscrunch=700/deltx;gyscrunch=490/delty;
  54. X    offx = 0; offy= 485;
  55. X
  56. X}
  57. X
  58. X}
  59. X
  60. Xerase()
  61. X{
  62. X    printf("\033PpS(E)\033\\");
  63. X}
  64. X
  65. Xlabel(s)
  66. Xchar *s;
  67. X{
  68. X    printf("\033PpP[,-12]T'%s';\033\\",s);
  69. X
  70. X}
  71. X
  72. Xmove(x,y)
  73. Xint x,y;
  74. X{
  75. X    char s[5];
  76. X    int xo,yo;
  77. X    xo = x*gxscrunch;
  78. X    yo = y*gyscrunch;
  79. X    yo = offy - yo;xo =  offx + xo;
  80. X    printf("\033PpP[%d,%d]\033\\",xo,yo);
  81. X}
  82. X
  83. Xcont(x,y)
  84. Xint x,y;
  85. X{
  86. X    char s[5];
  87. X    int xo,yo;
  88. X    xo = x*gxscrunch;
  89. X    yo = y*gyscrunch;
  90. X    yo = offy - yo;xo =  offx + xo;
  91. X
  92. X    printf("\033PpV[%d,%d]\033\\",xo,yo);
  93. X}
  94. X
  95. Xline (x1, y1, x2, y2)
  96. Xint x1,y1,x2,y2;
  97. X{
  98. X    move(x1,y1);
  99. X    cont(x2,y2);
  100. X}
  101. Xcircle(x,y,r)
  102. Xint x,y,r;
  103. X{
  104. Xint xo,yo;
  105. X    move((x-r),y);
  106. X    xo=(x*gxscrunch);yo=(y*gyscrunch);
  107. X    yo = offy - yo;xo =  offx + xo;
  108. X    printf("\033PpC(C)[%d,%d]",xo,yo);
  109. X}
  110. X
  111. Xarc(x,y,x0,y0,x1,y1)
  112. Xint x,y,x0,y0,x1,y1;
  113. X{
  114. Xfloat a1,a2,r1,r2;
  115. Xint xo,yo,c1,c2,c;
  116. X    move(x0,y0);
  117. X    if ((x-x0) > 0) {
  118. X        r1=(y-y0)/(x-x0);
  119. X        a1=atan(r1);
  120. X        c1=(a1*pitograd);
  121. X    }
  122. X    else {
  123. X        c1=180;
  124. X    }
  125. X    if ((x-x1) > 0) {
  126. X        r2=(y-y1)/(x-x1);
  127. X        a2=atan(r2);
  128. X        c2=(a2*pitograd);
  129. X    }
  130. X    else {
  131. X        c2=180;
  132. X    }
  133. X        c=c1-c2;
  134. X    xo=(x*gxscrunch);yo=(y*gyscrunch);
  135. X    yo = offy - yo;xo =  offx + xo;
  136. X    printf("\033PpC(A%dC) [%d,%d]\033\\",c,xo,yo);
  137. X}
  138. X
  139. Xdot(xi,yi,dx,n,pat)
  140. Xint xi,yi,dx,n,pat[256];
  141. X{
  142. X}
  143. X
  144. Xpoint(x,y)
  145. Xint x,y;
  146. X{
  147. X      move(x,y);
  148. X      printf("\033PpV[]\033\\");
  149. X}
  150. X
  151. Xlinemod(s)
  152. Xchar *s;
  153. X{
  154. X  if (strcmp(s,"dotted")==0) {
  155. X      printf("\033PpW(P4)\033\\");
  156. X      }
  157. X  else if (strcmp(s,"solid")==0) {
  158. X      printf("\033PpW(P1)\033\\");
  159. X      }
  160. X      else if (strcmp(s,"longdashed")==0) {
  161. X          printf("\033PpW(P11100111)\033\\");
  162. X          }
  163. X         else if (strcmp(s,"shortdashed")==0) {
  164. X             printf("\033PpW(P2)\033\\");
  165. X             }
  166. X            else if (strcmp(s,"dotdashed")==0) {
  167. X                printf("\033PpW(P3)\033\\");
  168. X                }
  169. X}
  170. X
  171. X
  172. X/*
  173. Xint vt300turt(),vt300from(),vt300to(),gtcheck(),gpenc(),gstate();
  174. Xstruct display vt300 ={0.0,0.0,0.0,-400.0,399.0,-240.0,239.0,0.9,0,
  175. X    "\033PpS(E)P[384,240]\033\\\033PrSM0\033\\\033[20;1H",
  176. X    "\033PrSM2\033\\\033PpS(E)\033\\",
  177. X    "\033PrSM2\033\\\033PpS(E)\033\\",
  178. X    "\033PpS(E)\033\\",
  179. X    vt300turt,vt300from,vt300to,gtcheck,nullfn,nullfn,nullfn,
  180. X    gpenc,nullfn,gstate};
  181. X
  182. Xchar *vt300pens[] = {"W(R)","W(E)","W(C)"};
  183. X*/
  184. X
  185. X/*vt300to(newx,newy)
  186. Xdouble newx,newy;
  187. X{
  188. X    printf(vt300pens[penerase]);
  189. X    cont((int)newx,(int)newy);
  190. X    printf("\033\\");
  191. X}
  192. X
  193. Xvt300turt()
  194. X{
  195. X    double newx,newy,angle;
  196. X
  197. X    printf("\033PpW(C)");
  198. X    angle = (mydpy->turth-90.0)*3.141592654/180.0;
  199. X    newx = mydpy->turtx + 15.0*sin(angle);
  200. X    newy = mydpy->turty + 15.0*cos(angle);
  201. X    gmovepos((int)newx,(int)(y= mydpy->turth*3.141592654/180.0;
  202. X    newx = mydpy->turtx + 15.0*sin(angle);
  203. X    newy = mydpy->turty + 15.0*cos(angle);
  204. X    gplotpos((int)newx,(int)(gyscrunch*newy));
  205. X    angle = (mydpy->turth+90.0)*3.141592654/180.0;
  206. X    newx = mydpy->turtx + 15.0*sin(angle);
  207. X    newy = mydpy->turty + 15.0*cos(angle);
  208. X    gplotpos((int)newx,(int)(gyscrunch*newy));
  209. X    angle = (mydpy->turth-90.0)*3.141592654/180.0;
  210. X    newx = mydpy->turtx + 15.0*sin(angle);
  211. X    newy = mydpy->turty + 15.0*cos(angle);
  212. X    gplotpos((int)newx,(int)(gyscrunch*newy));
  213. X    printf(vt300pens[penerase]);
  214. X    printf("\033\\");
  215. X}
  216. X
  217. Xgpenc(ipen)
  218. Xregister int ipen;
  219. X{
  220. X    if ((ipen<0) || (ipen>7)) {
  221. X        puts("Bad pen color, must be 0 to 7.");
  222. X        errhand();
  223. X    }
  224. X    printf("\033PpW(I%d)\033\\",ipen);
  225. X}
  226. X
  227. Xgstate(which) {
  228. X    switch(which) {
  229. X        case 't':
  230. X            printf("\033PrSM2\033\\\033PpS(E)\033\\");
  231. X            break;
  232. X        case 's':
  233. X        case 'f':
  234. X            printf("\033PrSM0\033\\\033PpS(E)\033\\");
  235. X            if (textmode && shown) vt300turt();
  236. X            break;
  237. X        case '*':
  238. X            printf("\033[K");
  239. X    }
  240. X}
  241. X*/
  242. X
  243. X
  244. X
  245. X
  246. SHAR_EOF
  247. $TOUCH -am 1014194990 libplot/ReGIS/libReGIS.c &&
  248. chmod 0644 libplot/ReGIS/libReGIS.c ||
  249. echo "restore of libplot/ReGIS/libReGIS.c failed"
  250. set `wc -c libplot/ReGIS/libReGIS.c`;Wc_c=$1
  251. if test "$Wc_c" != "4002"; then
  252.     echo original size 4002, current size $Wc_c
  253. fi
  254. # ============= libplot/hpgl/Makefile ==============
  255. if test ! -d 'libplot/hpgl'; then
  256.     echo "x - creating directory libplot/hpgl"
  257.     mkdir 'libplot/hpgl'
  258. fi
  259. echo "x - extracting libplot/hpgl/Makefile (Text)"
  260. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/Makefile &&
  261. X# Define CIRELBUG if the plotter has the firmware bug that puts it into
  262. X# relative-coordinate mode after a circle or an arc.
  263. XCFLAGS=-O -DCIRELBUG
  264. X
  265. Xall:    libhpgl.a
  266. X
  267. Xlibhpgl.a:     arc.o box.o circle.o close.o cont.o dot.o erase.o label.o line.o \
  268. X    linmod.o move.o open.o point.o space.o onoff.o hpglchord.o
  269. X    ar rc libhpgl.a *.o
  270. X
  271. Xclean:
  272. X    rm -f *.o libhpgl.a
  273. X
  274. Xmv:    all
  275. X    mv libhpgl.a ..
  276. SHAR_EOF
  277. $TOUCH -am 0708142187 libplot/hpgl/Makefile &&
  278. chmod 0644 libplot/hpgl/Makefile ||
  279. echo "restore of libplot/hpgl/Makefile failed"
  280. set `wc -c libplot/hpgl/Makefile`;Wc_c=$1
  281. if test "$Wc_c" != "378"; then
  282.     echo original size 378, current size $Wc_c
  283. fi
  284. # ============= libplot/hpgl/README ==============
  285. echo "x - extracting libplot/hpgl/README (Text)"
  286. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/README &&
  287. XFollowing is a shell archive of the source for a V7 plot(3) library for
  288. XHewlett-Packard plotters which speak HPGL (HP Graphics Language).  We have
  289. Xnow had fairly extensive experience using this software with our HP7470
  290. X2-pen plotter.
  291. X
  292. XWe have had enough requests for this software that we felt it was worth
  293. Xposting to the net.  The package was written jointly by myself and
  294. XHenry Spencer.  While the package has been fairly well-exercised, should
  295. Xany bugs show up, please let us know.
  296. X
  297. X                David Trueman @ U of Toronto Zoology
  298. X                {allegra,ihnp4,linus,decvax}!utzoo!david
  299. SHAR_EOF
  300. $TOUCH -am 0708142187 libplot/hpgl/README &&
  301. chmod 0644 libplot/hpgl/README ||
  302. echo "restore of libplot/hpgl/README failed"
  303. set `wc -c libplot/hpgl/README`;Wc_c=$1
  304. if test "$Wc_c" != "572"; then
  305.     echo original size 572, current size $Wc_c
  306. fi
  307. # ============= libplot/hpgl/arc.c ==============
  308. echo "x - extracting libplot/hpgl/arc.c (Text)"
  309. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/arc.c &&
  310. X/* @(#)arc.c    1.5 of 4 Aug 84 */
  311. X
  312. X#include <math.h>
  313. X#define    sq(x)    ((double)(x) * (double)(x))
  314. X
  315. Xextern int hpglchord();
  316. X
  317. Xarc(xc, yc, xs, ys, xe, ye)
  318. Xint xc, yc;    /* center of arc */
  319. Xint xs, ys;    /* starting point */
  320. Xint xe, ye;    /* end point */
  321. X{
  322. X    double as, ae;
  323. X    double angle;
  324. X    double rs;
  325. X    double pi = 3.14159265358979323846;
  326. X
  327. X    as = atan2((double)(ys - yc), (double)(xs - xc)) * (180/pi);
  328. X    ae = atan2((double)(ye - yc), (double)(xe - xc)) * (180/pi);
  329. X    angle = ae - as;
  330. X    if (angle < 0)
  331. X        angle += 360;
  332. X
  333. X    rs = sqrt(sq(xs - xc) + sq(ys - yc));
  334. X
  335. X    move(xs, ys);
  336. X    on();
  337. X    printf("PD;");
  338. X    printf("AA %d,%d,%.2f,%d;", xc, yc, angle, hpglchord((int)rs));
  339. X#ifdef CIRELBUG
  340. X    printf("PA;");        /* back into absolute mode -- firmware bug */
  341. X#endif
  342. X    off();
  343. X}
  344. SHAR_EOF
  345. $TOUCH -am 0708142187 libplot/hpgl/arc.c &&
  346. chmod 0644 libplot/hpgl/arc.c ||
  347. echo "restore of libplot/hpgl/arc.c failed"
  348. set `wc -c libplot/hpgl/arc.c`;Wc_c=$1
  349. if test "$Wc_c" != "737"; then
  350.     echo original size 737, current size $Wc_c
  351. fi
  352. # ============= libplot/hpgl/box.c ==============
  353. echo "x - extracting libplot/hpgl/box.c (Text)"
  354. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/box.c &&
  355. Xbox(x0, y0, x1, y1)
  356. Xint x0, y0;    /* one corner */
  357. Xint x1, y1;    /* other corner */
  358. X{
  359. X    move(x0, y0);
  360. X    cont(x0, y1);
  361. X    cont(x1, y1);
  362. X    cont(x1, y0);
  363. X    cont(x0, y0);
  364. X    move(x1, y1);
  365. X}
  366. SHAR_EOF
  367. $TOUCH -am 0708142187 libplot/hpgl/box.c &&
  368. chmod 0644 libplot/hpgl/box.c ||
  369. echo "restore of libplot/hpgl/box.c failed"
  370. set `wc -c libplot/hpgl/box.c`;Wc_c=$1
  371. if test "$Wc_c" != "174"; then
  372.     echo original size 174, current size $Wc_c
  373. fi
  374. # ============= libplot/hpgl/circle.c ==============
  375. echo "x - extracting libplot/hpgl/circle.c (Text)"
  376. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/circle.c &&
  377. X/* @(#)circle.c    1.4 of 31 July 84 */
  378. Xextern int hpglchord();
  379. X
  380. Xcircle(x, y, r)
  381. Xint x, y;    /* center */
  382. Xint r;    /* radius */
  383. X{
  384. X    move(x, y);
  385. X    on();
  386. X    printf("CI %d,%d;", r, hpglchord(r));
  387. X#ifdef CIRELBUG
  388. X    printf("PA;");        /* back into absolute mode -- firmware bug */
  389. X#endif
  390. X    off();
  391. X}
  392. SHAR_EOF
  393. $TOUCH -am 0708142187 libplot/hpgl/circle.c &&
  394. chmod 0644 libplot/hpgl/circle.c ||
  395. echo "restore of libplot/hpgl/circle.c failed"
  396. set `wc -c libplot/hpgl/circle.c`;Wc_c=$1
  397. if test "$Wc_c" != "278"; then
  398.     echo original size 278, current size $Wc_c
  399. fi
  400. # ============= libplot/hpgl/close.c ==============
  401. echo "x - extracting libplot/hpgl/close.c (Text)"
  402. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/close.c &&
  403. X/* @(#)close.c    1.2 of 26 July 84 */
  404. X#include <stdio.h>
  405. X
  406. Xclosepl()
  407. X{
  408. X    on();
  409. X    printf("PU;");        /* pen up */
  410. X    printf("SP;");        /* put pen away */
  411. X    off();
  412. X    fflush(stdout);
  413. X}
  414. SHAR_EOF
  415. $TOUCH -am 0708142187 libplot/hpgl/close.c &&
  416. chmod 0644 libplot/hpgl/close.c ||
  417. echo "restore of libplot/hpgl/close.c failed"
  418. set `wc -c libplot/hpgl/close.c`;Wc_c=$1
  419. if test "$Wc_c" != "168"; then
  420.     echo original size 168, current size $Wc_c
  421. fi
  422. # ============= libplot/hpgl/cont.c ==============
  423. echo "x - extracting libplot/hpgl/cont.c (Text)"
  424. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/cont.c &&
  425. Xcont(x, y)
  426. Xint x, y;     /* point to move to */
  427. X{
  428. X    on();
  429. X    printf("PD %d,%d;", x, y);
  430. X    off();
  431. X}
  432. SHAR_EOF
  433. $TOUCH -am 0708142187 libplot/hpgl/cont.c &&
  434. chmod 0644 libplot/hpgl/cont.c ||
  435. echo "restore of libplot/hpgl/cont.c failed"
  436. set `wc -c libplot/hpgl/cont.c`;Wc_c=$1
  437. if test "$Wc_c" != "92"; then
  438.     echo original size 92, current size $Wc_c
  439. fi
  440. # ============= libplot/hpgl/dot.c ==============
  441. echo "x - extracting libplot/hpgl/dot.c (Text)"
  442. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/dot.c &&
  443. Xdot()
  444. X{
  445. X    on();
  446. X    off();
  447. X}
  448. SHAR_EOF
  449. $TOUCH -am 0708142187 libplot/hpgl/dot.c &&
  450. chmod 0644 libplot/hpgl/dot.c ||
  451. echo "restore of libplot/hpgl/dot.c failed"
  452. set `wc -c libplot/hpgl/dot.c`;Wc_c=$1
  453. if test "$Wc_c" != "25"; then
  454.     echo original size 25, current size $Wc_c
  455. fi
  456. # ============= libplot/hpgl/erase.c ==============
  457. echo "x - extracting libplot/hpgl/erase.c (Text)"
  458. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/erase.c &&
  459. Xerase()
  460. X{
  461. X    on();
  462. X    off();
  463. X}
  464. SHAR_EOF
  465. $TOUCH -am 0708142187 libplot/hpgl/erase.c &&
  466. chmod 0644 libplot/hpgl/erase.c ||
  467. echo "restore of libplot/hpgl/erase.c failed"
  468. set `wc -c libplot/hpgl/erase.c`;Wc_c=$1
  469. if test "$Wc_c" != "27"; then
  470.     echo original size 27, current size $Wc_c
  471. fi
  472. # ============= libplot/hpgl/hpglchord.c ==============
  473. echo "x - extracting libplot/hpgl/hpglchord.c (Text)"
  474. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/hpglchord.c &&
  475. X/* @(#)hpglchord.c    1.2 of 2 Oct 84 */
  476. X
  477. Xextern int hpglsize;        /* Size of coordinate space. */
  478. X
  479. X#define    MINCHA    5        /* Minimum chord angle. */
  480. X
  481. X/*
  482. X * hpglchord - compute a suitable chord angle for circle/arc
  483. X */
  484. Xint
  485. Xhpglchord(r)
  486. Xint r;        /* radius */
  487. X{
  488. X    int changle;
  489. X
  490. X    /*
  491. X     * The following calculation is essentially just chord/radius,
  492. X     * where chord is the desired chord size (10 machine units).
  493. X     * This yields an (approximate) result in radians, which is then
  494. X     * multiplied by (360/2pi), about 57, to yield degrees.  The
  495. X     * messy part is that the desired chord needs to be expressed in
  496. X     * user units, and care is needed to avoid overflow and underflow
  497. X     * in integer arithmetic.  A 10-unit chord is 1/720 of the machine
  498. X     * coordinate space, so hpglsize/720 would be the chord.  Shuffling,
  499. X     * we have (57/720)*(hpglsize/r).  (1/13) is close to (57/720)
  500. X     * and involves much less chance of over/underflow problems.
  501. X     *
  502. X     * Actually, the machine coordinate space isn't always (in fact,
  503. X     * ever!) 7200x7200 any more, but the numbers still come out close
  504. X     * enough that it's not worth worrying about.
  505. X     *
  506. X     * After all that, we enforce a minimum chord for speed.  This
  507. X     * pretty much eliminates residual underflow worries.
  508. X     */
  509. X    changle = (hpglsize/r)/13;
  510. X    if (changle < MINCHA)
  511. X        changle = MINCHA;
  512. X
  513. X    return(changle);
  514. X}
  515. SHAR_EOF
  516. $TOUCH -am 0708142187 libplot/hpgl/hpglchord.c &&
  517. chmod 0644 libplot/hpgl/hpglchord.c ||
  518. echo "restore of libplot/hpgl/hpglchord.c failed"
  519. set `wc -c libplot/hpgl/hpglchord.c`;Wc_c=$1
  520. if test "$Wc_c" != "1323"; then
  521.     echo original size 1323, current size $Wc_c
  522. fi
  523. # ============= libplot/hpgl/label.c ==============
  524. echo "x - extracting libplot/hpgl/label.c (Text)"
  525. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/label.c &&
  526. X/* @(#)label.c    1.3 of 26 July 84 */
  527. Xlabel(s)
  528. Xchar *s;
  529. X{
  530. X    on();
  531. X    printf("CP -0.3333,-0.25;");    /* offset to center first char */
  532. X    printf("LB%s%c", s, 03);
  533. X    off();
  534. X}
  535. SHAR_EOF
  536. $TOUCH -am 0708142187 libplot/hpgl/label.c &&
  537. chmod 0644 libplot/hpgl/label.c ||
  538. echo "restore of libplot/hpgl/label.c failed"
  539. set `wc -c libplot/hpgl/label.c`;Wc_c=$1
  540. if test "$Wc_c" != "163"; then
  541.     echo original size 163, current size $Wc_c
  542. fi
  543. # ============= libplot/hpgl/line.c ==============
  544. echo "x - extracting libplot/hpgl/line.c (Text)"
  545. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/line.c &&
  546. Xline(x0,y0,x1,y1)
  547. Xint x0, y0;    /* starting point */
  548. Xint x1, y1;    /* end point */
  549. X{
  550. X    move(x0,y0);
  551. X    cont(x1,y1);
  552. X}
  553. SHAR_EOF
  554. $TOUCH -am 0708142187 libplot/hpgl/line.c &&
  555. chmod 0644 libplot/hpgl/line.c ||
  556. echo "restore of libplot/hpgl/line.c failed"
  557. set `wc -c libplot/hpgl/line.c`;Wc_c=$1
  558. if test "$Wc_c" != "111"; then
  559.     echo original size 111, current size $Wc_c
  560. fi
  561. # ============= libplot/hpgl/linmod.c ==============
  562. echo "x - extracting libplot/hpgl/linmod.c (Text)"
  563. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/linmod.c &&
  564. X/* @(#)linmod.c    1.2 of 9 Aug 84 */
  565. X
  566. X#define    STREQ(x, y)    (strcmp((x), (y)) == 0)
  567. X
  568. Xlinemod(s)
  569. Xchar *s;
  570. X{
  571. X    char *pattern;
  572. X
  573. X    if (STREQ(s, "dotted"))
  574. X        pattern = "1,1";
  575. X    else if (STREQ(s, "solid"))
  576. X        pattern = "";
  577. X    else if (STREQ(s, "longdashed"))
  578. X        pattern = "3,1";
  579. X    else if (STREQ(s, "shortdashed"))
  580. X        pattern = "2,1";
  581. X    else if (STREQ(s, "dotdashed"))
  582. X        pattern = "4,2";
  583. X    on();
  584. X    printf("LT %s;", pattern);
  585. X    off();
  586. X}
  587. SHAR_EOF
  588. $TOUCH -am 0708142187 libplot/hpgl/linmod.c &&
  589. chmod 0644 libplot/hpgl/linmod.c ||
  590. echo "restore of libplot/hpgl/linmod.c failed"
  591. set `wc -c libplot/hpgl/linmod.c`;Wc_c=$1
  592. if test "$Wc_c" != "413"; then
  593.     echo original size 413, current size $Wc_c
  594. fi
  595. # ============= libplot/hpgl/move.c ==============
  596. echo "x - extracting libplot/hpgl/move.c (Text)"
  597. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/move.c &&
  598. Xmove(x,y)
  599. Xint x, y;     /* point to move to */
  600. X{
  601. X    on();
  602. X    printf("PU %d,%d;", x, y);
  603. X    off();
  604. X}
  605. SHAR_EOF
  606. $TOUCH -am 0708142187 libplot/hpgl/move.c &&
  607. chmod 0644 libplot/hpgl/move.c ||
  608. echo "restore of libplot/hpgl/move.c failed"
  609. set `wc -c libplot/hpgl/move.c`;Wc_c=$1
  610. if test "$Wc_c" != "91"; then
  611.     echo original size 91, current size $Wc_c
  612. fi
  613. # ============= libplot/hpgl/onoff.c ==============
  614. echo "x - extracting libplot/hpgl/onoff.c (Text)"
  615. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/onoff.c &&
  616. Xon()
  617. X{
  618. X    printf("\033.Y");        /* wakeup plotter */
  619. X}
  620. X
  621. Xoff()
  622. X{
  623. X    printf("\033.Z");        /* turn plotter off again */
  624. X}
  625. SHAR_EOF
  626. $TOUCH -am 0708142187 libplot/hpgl/onoff.c &&
  627. chmod 0644 libplot/hpgl/onoff.c ||
  628. echo "restore of libplot/hpgl/onoff.c failed"
  629. set `wc -c libplot/hpgl/onoff.c`;Wc_c=$1
  630. if test "$Wc_c" != "110"; then
  631.     echo original size 110, current size $Wc_c
  632. fi
  633. # ============= libplot/hpgl/open.c ==============
  634. echo "x - extracting libplot/hpgl/open.c (Text)"
  635. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/open.c &&
  636. X/* @(#)open.c    1.5 of 2 Oct 84 */
  637. Xopenpl()
  638. X{
  639. X    on();
  640. X    printf("\033.I81;;17:");    /* set threshold for sending XOFF to 81
  641. X                     * and set XON character to DC1
  642. X                     */
  643. X    printf("\033.N;19:");        /* set XOFF character to DC3 */
  644. X    printf("IN;");            /* initialize everything */
  645. X    printf("SP 1;");        /* select left pen */
  646. X    printf("VS 20;");        /* reduce pen velocity */
  647. X    printf("SI 0.1368,0.27;");    /* char size absolute, shrunk a bit */
  648. X    off();
  649. X}
  650. SHAR_EOF
  651. $TOUCH -am 0708142187 libplot/hpgl/open.c &&
  652. chmod 0644 libplot/hpgl/open.c ||
  653. echo "restore of libplot/hpgl/open.c failed"
  654. set `wc -c libplot/hpgl/open.c`;Wc_c=$1
  655. if test "$Wc_c" != "429"; then
  656.     echo original size 429, current size $Wc_c
  657. fi
  658. # ============= libplot/hpgl/point.c ==============
  659. echo "x - extracting libplot/hpgl/point.c (Text)"
  660. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/point.c &&
  661. Xpoint(xi,yi){
  662. X    move(xi,yi);
  663. X    cont(xi,yi);
  664. X}
  665. SHAR_EOF
  666. $TOUCH -am 0708142187 libplot/hpgl/point.c &&
  667. chmod 0644 libplot/hpgl/point.c ||
  668. echo "restore of libplot/hpgl/point.c failed"
  669. set `wc -c libplot/hpgl/point.c`;Wc_c=$1
  670. if test "$Wc_c" != "44"; then
  671.     echo original size 44, current size $Wc_c
  672. fi
  673. # ============= libplot/hpgl/space.c ==============
  674. echo "x - extracting libplot/hpgl/space.c (Text)"
  675. sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/space.c &&
  676. X/* @(#)space.c    1.3 of 2 Oct 84 */
  677. X
  678. X#define    PLOTX    10300    /* How wide is plotter in physical units. */
  679. X#define    PLOTY    7650    /* How high is plotter in physical units. */
  680. X
  681. Xint hpglsize = 7200;    /* Size of coordinate space, for chord calculations. */
  682. X
  683. Xspace(x0,y0,x1,y1)
  684. Xint x0, y0;    /* lower left corner */
  685. Xint x1, y1;    /* upper right corner */
  686. X{
  687. X    int absy;
  688. X    long aspect;        /* In thousandths. */
  689. X    int llx, lly, urx, ury;
  690. X
  691. X    /*
  692. X     * compute physical plot area:  use as much of the paper as
  693. X     * possible while preserving the aspect ratio of the user space.
  694. X     */
  695. X    aspect = (1000L * abs(x1 - x0)) / abs(y1 - y0);
  696. X    if (aspect > (1000L * PLOTX) / PLOTY) {        /* Wide and squat. */
  697. X        llx = 0;
  698. X        urx = PLOTX;
  699. X        lly = (PLOTY - (int)((1000L * PLOTX) / aspect)) / 2;
  700. X        ury = lly + (int)((1000L * PLOTX) / aspect);
  701. X    } else {        /* Limited by height, not width. */
  702. X        lly = 0;
  703. X        ury = PLOTY;
  704. X        llx = (PLOTX - (int)((PLOTY * aspect)/1000)) / 2;
  705. X        urx = llx + (int)((PLOTY * aspect)/1000);
  706. X    }
  707. X
  708. X    on();
  709. X    printf("IP %d,%d,%d,%d;", llx, lly, urx, ury);    /* set plot area */
  710. X    printf("SC %d,%d,%d,%d;", x0, x1, y0, y1);    /* set scaling */
  711. X    off();
  712. X
  713. X    hpglsize = abs(x1 - x0);
  714. X    absy = abs(y1 - y0);
  715. X    if (absy > hpglsize)
  716. X        hpglsize = absy;
  717. X}
  718. SHAR_EOF
  719. $TOUCH -am 0708142187 libplot/hpgl/space.c &&
  720. chmod 0644 libplot/hpgl/space.c ||
  721. echo "restore of libplot/hpgl/space.c failed"
  722. set `wc -c libplot/hpgl/space.c`;Wc_c=$1
  723. if test "$Wc_c" != "1198"; then
  724.     echo original size 1198, current size $Wc_c
  725. fi
  726. # ============= libplot/lp/Makefile ==============
  727. if test ! -d 'libplot/lp'; then
  728.     echo "x - creating directory libplot/lp"
  729.     mkdir 'libplot/lp'
  730. fi
  731. echo "x - extracting libplot/lp/Makefile (Text)"
  732. sed 's/^X//' << 'SHAR_EOF' > libplot/lp/Makefile &&
  733. X# Unix Makefile for hpglplot
  734. X#
  735. X# Copyright (c) 1988 Environmental Defense Fund, Inc.
  736. X#
  737. X# Latest revision: 07/08/88
  738. X
  739. X# Defines that can go in CFLAGS:
  740. X# -DCHARSET=    path of character set data file
  741. X# -DTRUESOLID    use true solid fill instead of tri-hatch
  742. X#
  743. X# -DTESTVER    produce debugging output
  744. X# -DTTY=    terminal device name (only used if TESTVER defined)
  745. X# -DGENIX       use _exit in stead of exit in main.c
  746. X#CFLAGS=-O -DCHARSET=\"/u/local/lib/charset.0\" -DTRUESOLID -DTESTVER -DTTY=\"/dev/tty\"
  747. XCFLAGS=-O -DCHARSET=\"/usr2/local/lib/charset.0\" -DTTY=\"/dev/tty\" -DGENIX
  748. XLIBS=
  749. X
  750. XDOCS= README hpglplot.doc hpgl.doc Makefile charset.0
  751. X
  752. XSRCS= \
  753. Xlabel.c move.c circle.c liblj.c openpl.c linemod.c \
  754. Xep_map.c ib_map.c lj_map.c maps.c \
  755. Xplot_cha.c set_dbgs.c
  756. X
  757. XOBJS= \
  758. Xlabel.o move.o circle.o liblj.o openpl.o linemod.o \
  759. Xep_map.o ib_map.o lj_map.o maps.o \
  760. Xplot_cha.o set_dbgs.o
  761. X
  762. XHDRS= \
  763. Xconst.h dbgvars.h vars.h plotlp.h
  764. X
  765. XEXTRAS= 
  766. X
  767. Xlibplotlp.a:    $(OBJS) 
  768. X    ar r libplotlp.a $(OBJS) 
  769. X
  770. Xinstall:  libplotlp.a charset.0
  771. X    cp libplotlp.a /usr/lib
  772. X    cp charset.0 /u/local/lib
  773. X
  774. Xlint:    $(SRCS)
  775. X    lint $(SRCS) > lint.out
  776. X
  777. Xshar:    plotlp.shar
  778. X
  779. Xplotlp.shar:    $(DOCS) $(SRCS) $(HDRS)
  780. X    shar $(DOCS) $(SRCS) $(HDRS) > plotlp.shar
  781. X
  782. X# Break it down into several sharchives.
  783. Xkit:    $(DOCS) $(SRCS) $(HDRS) 
  784. X    makekit -nPLOTLP. -oMANIFEST $(DOCS) $(SRCS) $(HDRS)
  785. X    touch kit
  786. X
  787. Xclean:
  788. X    rm -f $(OBJS) libplotlp.a
  789. X
  790. Xep_map.c: const.h fillcnst.h dbgvars.h
  791. Xib_map.c: const.h fillcnst.h dbgvars.h
  792. Xlj_map.c: const.h fillcnst.h
  793. X#main.c: const.h vars.h dbgvars.h
  794. Xmaps.c: const.h vars.h
  795. Xmisc.c: const.h vars.h
  796. Xplot_cha.c: const.h vars.h dbgvars.h
  797. Xlabel.c  : plotlp.h
  798. Xmove.c  : plotlp.h
  799. Xcircle.c  : plotlp.h
  800. Xliblj.c  : plotlp.h
  801. Xopenpl.c  : plotlp.h
  802. Xlinemod.c : plotlp.h
  803. X
  804. X# Add missing default rule for UNOS.
  805. X.SUFFIXES:    .o
  806. X.c.o:
  807. X    $(CC) $(CFLAGS) -c $<
  808. X
  809. SHAR_EOF
  810. $TOUCH -am 0117134289 libplot/lp/Makefile &&
  811. chmod 0644 libplot/lp/Makefile ||
  812. echo "restore of libplot/lp/Makefile failed"
  813. set `wc -c libplot/lp/Makefile`;Wc_c=$1
  814. if test "$Wc_c" != "1799"; then
  815.     echo original size 1799, current size $Wc_c
  816. fi
  817. echo "End of part 2, continue with part 3"
  818. exit 0
  819.  
  820.  
  821. -- 
  822. UUCP: ..!uunet!mcsun!hp4nl!integow!hot    or  hot@integow.UUCP or hot@hot.mug
  823. Roland van Hout, Sr. software engineer, Integrity software consultants, 
  824.          Pelmolenlaan 16, 3447 GW Woerden, Netherlands,
  825.             tel +31 3480-30131, fax +31 3480-30182
  826.