home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume14 / vplot / part11 < prev    next >
Encoding:
Internet Message Format  |  1988-03-31  |  56.6 KB

  1. Subject:  v14i016:  Device-independant graphics system, with drivers
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Joe Dellinger <joe@hanauma.STANFORD.EDU>
  7. Posting-number: Volume 14, Issue 16
  8. Archive-name: vplot/part11
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 11 (of 24)."
  17. # Wrapped by rsalz@fig.bbn.com on Fri Mar 25 11:47:14 1988
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. if test -f 'RasterTek_device/rteklib/rtekraster.c' -a "${1}" != "-c" ; then 
  20.   echo shar: Will not clobber existing file \"'RasterTek_device/rteklib/rtekraster.c'\"
  21. else
  22. echo shar: Extracting \"'RasterTek_device/rteklib/rtekraster.c'\" \(3873 characters\)
  23. sed "s/^X//" >'RasterTek_device/rteklib/rtekraster.c' <<'END_OF_FILE'
  24. X/*
  25. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  26. X * University. Official permission to use this software is included in
  27. X * the documentation. It authorizes you to use this file for any
  28. X * non-commercial purpose, provided that this copyright notice is not
  29. X * removed and that any modifications made to this file are commented
  30. X * and dated in the style of my example below.
  31. X */
  32. X
  33. X/*
  34. X *
  35. X *  source file:   ./filters/rteklib/rtekraster.c
  36. X *
  37. X * Joe Dellinger (SEP), June 11 1987
  38. X *    Inserted this sample edit history entry.
  39. X *    Please log any further modifications made to this file:
  40. X */
  41. X
  42. X#include "rtekpen.h"
  43. X
  44. X/* Revised  4/19/87  Stewart A. Levin   SEP   added direct raster
  45. X *                                            for all orients
  46. X *
  47. X *  For orient=1, simply switch nrows and ncols from orient=0
  48. X *  For orient=2, reverse raster line in core and write it out
  49. X *  For orient=3, same method as orient=2.  Code also left in
  50. X *                to use rtek internal pixel functions to reverse
  51. X *                within the display using 3 XOR's.  This is not
  52. X *                invoked on the Convex because it's slower.
  53. X *
  54. X * Joe Dellinger 6/12/87 need to set lost=YES after raster.
  55. X * Joe Dellinger Feb 16 1988
  56. X *    Update to new order of arguments for dumb raster.
  57. X */
  58. extern int      genraster ();
  59. extern int      lost;
  60. X
  61. rtekraster (count, out_of, xpos, ypos, length, orient, raster, dummy1, dummy2)
  62. X    int             count, out_of, xpos, ypos, length, orient, dummy1, dummy2;
  63. X    char           *raster;
  64. X{
  65. int             hlen;
  66. register char  *ptr;
  67. X
  68. X    switch (orient)
  69. X    {
  70. X    case 0:
  71. X    rtekplot (xpos, ypos, 0);
  72. X    CHKLEN (5 + length);
  73. X    byte (PIXEL8);        /* cmdlen = 5 + length */
  74. X    word (1);
  75. X    word (length);
  76. X    fwrite (raster, 1, length, rtekfd);
  77. X    break;
  78. X    case 1:
  79. X    rtekplot (xpos, ypos, 0);
  80. X    CHKLEN (5 + length);
  81. X    byte (PIXEL8);        /* cmdlen = 5 + length */
  82. X    word (length);
  83. X    word (1);
  84. X    fwrite (raster, 1, length, rtekfd);
  85. X    break;
  86. X    case 2:
  87. X    rtekplot (xpos - length + 1, ypos, 0);
  88. X    CHKLEN (5 + length);
  89. X    byte (PIXEL8);
  90. X    word (1);
  91. X    word (length);
  92. X    for (ptr = raster + length - 1; ptr >= raster; ptr--)
  93. X        putc (*ptr, rtekfd);
  94. X    break;
  95. X    case 3:
  96. X    rtekplot (xpos, ypos + length - 1, 0);
  97. X    CHKLEN (5 + length);
  98. X    byte (PIXEL8);
  99. X    word (length);
  100. X    word (1);
  101. X    for (ptr = raster + length - 1; ptr >= raster; ptr--)
  102. X        putc (*ptr, rtekfd);
  103. X#ifdef undef
  104. X    /* this reverses rasters inside device */
  105. X    hlen = length >> 1;
  106. X    rtekplot (xpos, ypos + length - 1, 0);
  107. X    CHKLEN (5 + length);    /* load rasters backwards */
  108. X    byte (PIXEL8);
  109. X    word (length);
  110. X    word (1);
  111. X    fwrite (raster, 1, length, rtekfd);
  112. X    CHKLEN (2);        /* set to XOR pixel mode */
  113. X    byte (PIXFUN);
  114. X    byte (4);
  115. X    CHKLEN (6);        /* define 2 half-length windows */
  116. X    byte (CLOAD);
  117. X    byte (11);
  118. X    word (xpos);
  119. X    word (ypos);
  120. X    CHKLEN (6);
  121. X    byte (CLOAD);
  122. X    byte (12);
  123. X    word (xpos);
  124. X    word (ypos + hlen - 1);
  125. X    CHKLEN (6);
  126. X    byte (CLOAD);
  127. X    byte (13);
  128. X    word (xpos);
  129. X    word (ypos + length - 1);
  130. X    CHKLEN (6);
  131. X    byte (CLOAD);
  132. X    byte (14);
  133. X    word (xpos);
  134. X    word (ypos + length - hlen);
  135. X    CHKLEN (1);
  136. X    byte (PIXMOV);        /* perform XOR number 1 */
  137. X    CHKLEN (3);
  138. X    byte (CMOVE);
  139. X    byte (11);
  140. X    byte (13);
  141. X    CHKLEN (3);
  142. X    byte (CMOVE);
  143. X    byte (12);
  144. X    byte (14);
  145. X    CHKLEN (6);
  146. X    byte (CLOAD);
  147. X    byte (13);
  148. X    word (xpos);
  149. X    word (ypos);
  150. X    CHKLEN (6);
  151. X    byte (CLOAD);
  152. X    byte (14);
  153. X    word (xpos);
  154. X    word (ypos + hlen - 1);
  155. X    CHKLEN (1);
  156. X    byte (PIXMOV);
  157. X    CHKLEN (3);
  158. X    byte (CMOVE);
  159. X    byte (13);
  160. X    byte (11);
  161. X    CHKLEN (3);
  162. X    byte (CMOVE);
  163. X    byte (14);
  164. X    byte (12);
  165. X    CHKLEN (6);
  166. X    byte (CLOAD);
  167. X    byte (11);
  168. X    word (xpos);
  169. X    word (ypos);
  170. X    CHKLEN (6);
  171. X    byte (CLOAD);
  172. X    byte (12);
  173. X    word (xpos);
  174. X    word (ypos + hlen - 1);
  175. X    CHKLEN (1);
  176. X    byte (PIXMOV);
  177. X    CHKLEN (2);
  178. X    byte (PIXFUN);        /* reset pixel to insert mode */
  179. X    byte (0);
  180. X#endif undef
  181. X    break;
  182. X    default:            /* this shouldn't happen */
  183. X    genraster (count, out_of, xpos, ypos, length, orient, raster, 0, 0);
  184. X    break;
  185. X    }
  186. X    lost = 1;
  187. X}
  188. END_OF_FILE
  189. if test 3873 -ne `wc -c <'RasterTek_device/rteklib/rtekraster.c'`; then
  190.     echo shar: \"'RasterTek_device/rteklib/rtekraster.c'\" unpacked with wrong size!
  191. fi
  192. # end of 'RasterTek_device/rteklib/rtekraster.c'
  193. fi
  194. if test -f 'Regis_device/gigilib/gigiplot.c' -a "${1}" != "-c" ; then 
  195.   echo shar: Will not clobber existing file \"'Regis_device/gigilib/gigiplot.c'\"
  196. else
  197. echo shar: Extracting \"'Regis_device/gigilib/gigiplot.c'\" \(3046 characters\)
  198. sed "s/^X//" >'Regis_device/gigilib/gigiplot.c' <<'END_OF_FILE'
  199. X/*
  200. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  201. X * University. Official permission to use this software is included in
  202. X * the documentation. It authorizes you to use this file for any
  203. X * non-commercial purpose, provided that this copyright notice is not
  204. X * removed and that any modifications made to this file are commented
  205. X * and dated in the style of my example below.
  206. X */
  207. X
  208. X/*
  209. X *
  210. X *  source file:   ./filters/gigilib/gigiplot.c
  211. X *
  212. X * Joe Dellinger (SEP), June 11 1987
  213. X *    Inserted this sample edit history entry.
  214. X *    Please log any further modifications made to this file:
  215. X */
  216. X
  217. X#include <stdio.h>
  218. X#include "gigi.h"
  219. extern FILE    *pltout;
  220. extern int      dev_xmax, dev_ymax, dev_xmin, dev_ymin;
  221. int             lost = 1;    /* used by genvector */
  222. X
  223. gigiplot (xnew, ynew, draw)
  224. X    int             xnew, ynew, draw;
  225. X{
  226. int             ix, iy, dx, dy, gdx, gdy, adx, ady;
  227. float           slope, x, y, fdx, fdy;
  228. static int      xold, yold;
  229. X
  230. X    gcon (&xnew, &ynew);    /* Convert to Gigi's perverse coordinate
  231. X                 * system */
  232. X
  233. X    if (!in_a_poly)
  234. X    {
  235. X    if (!draw)
  236. X    {
  237. X        if (lastop != 'P')
  238. X        fprintf (pltout, "P@W");
  239. X    }
  240. X    else
  241. X    {
  242. X        if (lastop != 'V')
  243. X        fprintf (pltout, "V@W");
  244. X    }
  245. X    }
  246. X
  247. X    if (lost == 0)
  248. X    {
  249. X    gdx = xnew - xold;
  250. X    gdy = ynew - yold;
  251. X    adx = (gdx > 0 ? gdx : -gdx);
  252. X    ady = (gdy > 0 ? gdy : -gdy);
  253. X    if (adx == 0 && ady == 0)
  254. X        goto done;
  255. X    }
  256. X    else
  257. X    {
  258. X    lost = 0;
  259. X    adx = 100;
  260. X    ady = 100;
  261. X    }
  262. X    /* general move, fast for long vectors */
  263. X    if (adx > 10 || ady > 10)
  264. X    {
  265. X    fprintf (pltout, "[%d,%d]", 2 * ynew, 2 * xnew);
  266. X    goto done;
  267. X    }
  268. X    /* equivalent move, fast for short vectors */
  269. X    fdx = gdx;
  270. X    fdy = gdy;
  271. X    if (adx >= ady)
  272. X    {
  273. X    slope = 1.0001 * fdy / fdx;
  274. X    slope = (gdx > 0. ? slope : -slope);
  275. X    iy = yold;
  276. X    y = yold;
  277. X    for (ix = 0; ix < adx; ix++)
  278. X    {
  279. X        y = y + slope;
  280. X        dy = y - iy;
  281. X        iy = iy + dy;
  282. X        if (dy == 0)
  283. X        {
  284. X        if (gdx > 0)
  285. X            fprintf (pltout, "6");
  286. X        else
  287. X            fprintf (pltout, "2");
  288. X        }
  289. X        else
  290. X        if (dy > 0)
  291. X        {
  292. X        if (gdx > 0)
  293. X            fprintf (pltout, "7");
  294. X        else
  295. X            fprintf (pltout, "1");
  296. X        }
  297. X        else
  298. X        {
  299. X        if (gdx > 0)
  300. X            fprintf (pltout, "5");
  301. X        else
  302. X            fprintf (pltout, "3");
  303. X        }
  304. X    }
  305. X    }
  306. X    else
  307. X    {
  308. X    slope = 1.0001 * fdx / fdy;
  309. X    slope = (gdy > 0. ? slope : -slope);
  310. X    ix = xold;
  311. X    x = xold;
  312. X    for (iy = 0; iy < ady; iy++)
  313. X    {
  314. X        x = x + slope;
  315. X        dx = x - ix;
  316. X        ix = ix + dx;
  317. X        if (dx == 0)
  318. X        {
  319. X        if (gdy > 0)
  320. X            fprintf (pltout, "0");
  321. X        else
  322. X            fprintf (pltout, "4");
  323. X        }
  324. X        else
  325. X        if (dx > 0)
  326. X        {
  327. X        if (gdy > 0)
  328. X            fprintf (pltout, "7");
  329. X        else
  330. X            fprintf (pltout, "5");
  331. X        }
  332. X        else
  333. X        {
  334. X        if (gdy > 0)
  335. X            fprintf (pltout, "1");
  336. X        else
  337. X            fprintf (pltout, "3");
  338. X        }
  339. X    }
  340. X    }
  341. done:
  342. X    if (!in_a_poly)
  343. X    {
  344. X    if (!draw)
  345. X    {
  346. X        fprintf (pltout, "0V@W4");
  347. X    }
  348. X    lastop = 'V';
  349. X    }
  350. X    xold = xnew;
  351. X    yold = ynew;
  352. X    return;
  353. X}
  354. X
  355. gcon (x, y)
  356. X    int            *x, *y;
  357. X{
  358. int             temp;
  359. X
  360. X    temp = *x;
  361. X    *x = dev_ymin + dev_ymax - *y;
  362. X    *y = temp;
  363. X}
  364. END_OF_FILE
  365. if test 3046 -ne `wc -c <'Regis_device/gigilib/gigiplot.c'`; then
  366.     echo shar: \"'Regis_device/gigilib/gigiplot.c'\" unpacked with wrong size!
  367. fi
  368. # end of 'Regis_device/gigilib/gigiplot.c'
  369. fi
  370. if test -f 'Tek_device/cteklib/ctekraster.c' -a "${1}" != "-c" ; then 
  371.   echo shar: Will not clobber existing file \"'Tek_device/cteklib/ctekraster.c'\"
  372. else
  373. echo shar: Extracting \"'Tek_device/cteklib/ctekraster.c'\" \(3690 characters\)
  374. sed "s/^X//" >'Tek_device/cteklib/ctekraster.c' <<'END_OF_FILE'
  375. X/*
  376. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  377. X * University. Official permission to use this software is included in
  378. X * the documentation. It authorizes you to use this file for any
  379. X * non-commercial purpose, provided that this copyright notice is not
  380. X * removed and that any modifications made to this file are commented
  381. X * and dated in the style of my example below.
  382. X */
  383. X
  384. X/*
  385. X *
  386. X *  source file:   ./filters/cteklib/ctekraster.c
  387. X *
  388. X * Joe Dellinger (SEP), June 11 1987
  389. X *    Inserted this sample edit history entry.
  390. X *    Please log any further modifications made to this file:
  391. X * Joe Dellinger Feb 16 1988
  392. X *    Updated raster call.
  393. X */
  394. X
  395. X#include    <stdio.h>
  396. X#include    "ctek.h"
  397. X#include "../include/enum.h"
  398. X#include "../include/extern.h"
  399. extern FILE    *pltout;
  400. extern int      need_devcolor, overlay;
  401. extern int      genraster1 ();
  402. extern int      lost;
  403. X
  404. X/*
  405. X * IMPORTANT NOTE
  406. X * We couldn't just change the raster line which is handed to us to
  407. X * do the color mapping, because the same line MAY get handed to us
  408. X * again, which creates havoc when it gets mapped TWICE.
  409. X */
  410. X
  411. ctekraster (count, out_of, xpos, ypos, length, orient, raster, dummy1, dummy2)
  412. X    int             count, out_of, xpos, ypos, length, orient, dummy1, dummy2;
  413. X    char           *raster;
  414. X{
  415. register int    ii, jj, kk;
  416. int             length2;
  417. int             pixel[6];    /* Most number pixels per one character */
  418. static int      pix_pak = 0;
  419. int             xbreak;
  420. int             failure_count;
  421. X
  422. X/* Why were we even called? */
  423. X    if (length == 0)
  424. X    return;
  425. X
  426. X/*
  427. X * pixel stuff has to overwrite
  428. X */
  429. X    overlay = NO;
  430. X
  431. X    if (orient != 0)
  432. X    {
  433. X    genraster1 (count, out_of, xpos, ypos, length, raster, orient);
  434. X    return;
  435. X    }
  436. X
  437. X/*
  438. X * If it is just a solid line (or nearly solid) of a few colors, better to use
  439. X * genraster1.
  440. X */
  441. X    xbreak = 0;
  442. X    failure_count = 0;
  443. X    for (jj = 1; jj < length; jj++)
  444. X    {
  445. X    if (raster[jj] != raster[jj - 1])
  446. X    {
  447. X        if (jj - xbreak < 10)
  448. X        {
  449. X        failure_count++;
  450. X        if (failure_count > 2)
  451. X            break;
  452. X        }
  453. X        xbreak = jj;
  454. X    }
  455. X    }
  456. X    if (jj == length)
  457. X    {
  458. X    genraster1 (0, 1, xpos, ypos, length, raster, orient);
  459. X    return;
  460. X    }
  461. X
  462. X
  463. X/*
  464. X * Probably "runlength write" would be more efficient here in many
  465. X * circumstances. Anyone want to make this use that when it is faster?
  466. X * -JAD
  467. X */
  468. X
  469. X/* Do tek4105 Raster write */
  470. X
  471. X    cteksetmode (TEK);
  472. X
  473. X/* See how many bits we need to use */
  474. X    jj = 0;
  475. X    for (ii = 0; ii < length; ii++)
  476. X    {
  477. X    kk = ctekcolmap ((int) raster[ii]);
  478. X    if (jj < kk)
  479. X        jj = kk;
  480. X    if (jj > 3)
  481. X        break;
  482. X    }
  483. X    switch (jj)
  484. X    {
  485. X    case 0:
  486. X    case 1:
  487. X    jj = 6;
  488. X    break;
  489. X    case 2:
  490. X    case 3:
  491. X    jj = 3;
  492. X    break;
  493. X    default:
  494. X    jj = 2;
  495. X    break;
  496. X    }
  497. X
  498. X    if (pix_pak != jj)
  499. X    {
  500. X    pix_pak = jj;        /* pix_pak is number of pixels per char */
  501. X    fprintf (pltout, "%cRU1", ESC);    /* Begin Pixel Operations */
  502. X    tekipack (11);        /* Replace whatever was there before */
  503. X    tekipack (6 / pix_pak);    /* 6/pix_pak bits per pixel */
  504. X    }
  505. X
  506. X
  507. X    fprintf (pltout, "%cRH", ESC);    /* position pixel beam */
  508. X    ctekxypack (xpos, ypos);
  509. X
  510. X/* length2 is number of characters needed to hold length pixels */
  511. X    length2 = length / pix_pak;
  512. X    if (length % pix_pak != 0)
  513. X    length2++;
  514. X
  515. X    fprintf (pltout, "%cRP", ESC);    /* raster write (one line) */
  516. X    tekipack (length);        /* Number of pixels to set, */
  517. X    tekipack (length2);        /* encoded into this many characters */
  518. X
  519. X    for (jj = 0; jj < length; jj += pix_pak)
  520. X    {
  521. X    for (kk = 0; kk < pix_pak; kk++)
  522. X    {
  523. X        if (jj + kk >= length)
  524. X        {
  525. X        pixel[kk] = 0;
  526. X        break;
  527. X        }
  528. X        pixel[kk] = ctekcolmap ((int) raster[jj + kk]);
  529. X    }
  530. X
  531. X    pixpack (pixel, pix_pak);
  532. X    }
  533. X    lost = 1;
  534. X    need_devcolor = YES;
  535. X    return;
  536. X}
  537. END_OF_FILE
  538. if test 3690 -ne `wc -c <'Tek_device/cteklib/ctekraster.c'`; then
  539.     echo shar: \"'Tek_device/cteklib/ctekraster.c'\" unpacked with wrong size!
  540. fi
  541. # end of 'Tek_device/cteklib/ctekraster.c'
  542. fi
  543. if test -f 'Tek_device/teklib/tekopen.c' -a "${1}" != "-c" ; then 
  544.   echo shar: Will not clobber existing file \"'Tek_device/teklib/tekopen.c'\"
  545. else
  546. echo shar: Extracting \"'Tek_device/teklib/tekopen.c'\" \(3098 characters\)
  547. sed "s/^X//" >'Tek_device/teklib/tekopen.c' <<'END_OF_FILE'
  548. X/*
  549. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  550. X * University. Official permission to use this software is included in
  551. X * the documentation. It authorizes you to use this file for any
  552. X * non-commercial purpose, provided that this copyright notice is not
  553. X * removed and that any modifications made to this file are commented
  554. X * and dated in the style of my example below.
  555. X */
  556. X
  557. X/*
  558. X *
  559. X *  source file:   ./filters/teklib/tekopen.c
  560. X *
  561. X * Joe Dellinger (SEP), June 11 1987
  562. X *    Inserted this sample edit history entry.
  563. X *    Please log any further modifications made to this file:
  564. X */
  565. X
  566. X/*
  567. X * Device open routine for tek4010 emulators (no-op for a real tek401x)
  568. X *    Devices supported:
  569. X *        graphon 140, 230, 235, 240
  570. X *        selanar hi-rez 100
  571. X *        digital engineering retrographics boards in dec vt102 and vt131
  572. X *            and televideo 950 terminals
  573. X *         seiko d-scan (gr-1104), in monochrome
  574. X *
  575. X *                            chuck karish  25 november 1986
  576. X */
  577. X
  578. X#include <stdio.h>
  579. X#include "../include/enum.h"
  580. X#include "../include/extern.h"
  581. X#include "../teklib/tek.h"
  582. extern FILE    *pltout;
  583. extern char     wstype[];
  584. extern char     callname[];
  585. X
  586. tekopen ()
  587. X{
  588. X/*
  589. X * physical device parameters
  590. X */
  591. X    dev_xmax = 1000;
  592. X    dev_ymax = 750;
  593. X    dev_xmin = 0;
  594. X    dev_ymin = 0;
  595. X    pixels_per_inch = 78.;
  596. X    aspect_ratio = 1.;
  597. X
  598. X/*
  599. X * device capabilities
  600. X */
  601. X    need_end_erase = NO;
  602. X    buffer_output = YES;
  603. X    smart_clip = NO;
  604. X    num_col = 0;
  605. X
  606. X    if (!strcmp (wstype, "default"))
  607. X    {
  608. X    strcpy (wstype, "tek401X");
  609. X    }
  610. X    if ((!strcmp (wstype, "graphon")) ||
  611. X    (!strcmp (callname, "gopen")))
  612. X    {
  613. X    strcpy (wstype, "graphon");
  614. X    dev_xmax = 1023;
  615. X    dev_ymax = 780;
  616. X    pixels_per_inch = 128;
  617. X    need_end_erase = NO;
  618. X
  619. X    fprintf (pltout, "\0331");    /* go into 4014 mode and stay there */
  620. X    fflush (stdout);
  621. X    endpause = YES;
  622. X    }
  623. X
  624. X    else
  625. X    if ((!strcmp (wstype, "retrographics")) ||
  626. X        (!strcmp (callname, "retpen")) ||
  627. X        (!strcmp (callname, "ret")))
  628. X    {
  629. X    strcpy (wstype, "retrographics");
  630. X    dev_xmax = 1023;
  631. X    dev_ymax = 780;
  632. X    pixels_per_inch = 128;
  633. X
  634. X    fprintf (pltout, "\035");    /*go into 4010 mode and stay there */
  635. X    fflush (stdout);
  636. X    }
  637. X
  638. X    else
  639. X    if ((!strcmp (wstype, "selanar")) ||
  640. X        (!strcmp (callname, "selpen")))
  641. X    {
  642. X    strcpy (wstype, "selanar");
  643. X    dev_xmax = 1023;
  644. X    dev_ymax = 780;
  645. X    pixels_per_inch = 128;
  646. X    need_end_erase = YES;
  647. X    endpause = YES;
  648. X/*
  649. X * The text screen must be erased to keep fragments of the text
  650. X * plane from flashing by while drawing is taking place.
  651. X */
  652. X    fprintf (pltout, "\033[0;0H");    /* return cursor to home position */
  653. X    fprintf (pltout, "\033[2J");    /* erase text screen */
  654. X    fprintf (pltout, "\033[>0t");    /* turn off text video */
  655. X    fprintf (pltout, "\0331");    /* go to 4014 mode and stay there */
  656. X    fflush (stdout);
  657. X    }
  658. X    else
  659. X    if ((!strcmp (wstype, "dscan")) ||
  660. X        (!strcmp (callname, "dscanpen")))
  661. X    {
  662. X    strcpy (wstype, "dscan");
  663. X    dev_xmax = 1023;
  664. X    dev_ymax = 779;
  665. X    pixels_per_inch = 128;
  666. X    need_end_erase = NO;
  667. X    buffer_output = YES;
  668. X    smart_clip = NO;
  669. X    num_col = 0;
  670. X
  671. X    fprintf (pltout, "\033*");    /* go into 4014 mode and stay there */
  672. X    fflush (stdout);
  673. X    endpause = YES;
  674. X    }
  675. X}
  676. END_OF_FILE
  677. if test 3098 -ne `wc -c <'Tek_device/teklib/tekopen.c'`; then
  678.     echo shar: \"'Tek_device/teklib/tekopen.c'\" unpacked with wrong size!
  679. fi
  680. # end of 'Tek_device/teklib/tekopen.c'
  681. fi
  682. if test -f 'Virtual_device/raslib/rasopen.c' -a "${1}" != "-c" ; then 
  683.   echo shar: Will not clobber existing file \"'Virtual_device/raslib/rasopen.c'\"
  684. else
  685. echo shar: Extracting \"'Virtual_device/raslib/rasopen.c'\" \(3778 characters\)
  686. sed "s/^X//" >'Virtual_device/raslib/rasopen.c' <<'END_OF_FILE'
  687. X/*
  688. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  689. X * University. Official permission to use this software is included in
  690. X * the documentation. It authorizes you to use this file for any
  691. X * non-commercial purpose, provided that this copyright notice is not
  692. X * removed and that any modifications made to this file are commented
  693. X * and dated in the style of my example below.
  694. X */
  695. X
  696. X/*
  697. X *
  698. X *  source file:   ./filters/raslib/rasopen.c
  699. X *
  700. X * Joe Dellinger (SEP), June 11 1987
  701. X *    Inserted this sample edit history entry.
  702. X *    Please log any further modifications made to this file:
  703. X */
  704. X
  705. X#include <stdio.h>
  706. X#include "../include/enum.h"
  707. X#include "../include/extern.h"
  708. X#include "../include/err.h"
  709. X#include <strings.h>
  710. X#ifdef SEP
  711. X#include <ctype.h>
  712. X#endif
  713. X#define DEFAULT_OUT    isatty(fileno(pltout))
  714. X#include "raspen.h"
  715. X
  716. char           *image;
  717. extern char    *malloc ();
  718. extern float    aspect_ratio;
  719. extern float    pixels_per_inch;
  720. int             color_mult, rasor = 0;
  721. char            colfile[60];
  722. X
  723. extern int      num_col;
  724. extern int      rasvector2 ();
  725. X
  726. rasopen ()
  727. X{
  728. extern char   **xargv;
  729. extern FILE    *pltout;
  730. extern char    *alloc ();
  731. X#ifdef SEP
  732. extern int      headfd;
  733. char            headname[30], fname[80];
  734. char            path[50];
  735. char           *front, *tail, *ptr;
  736. X#endif
  737. char            newpath[60];
  738. X
  739. X/*
  740. X * physical device parameters
  741. X */
  742. X    dev_xmax = 100;
  743. X    dev_ymax = 100;
  744. X    dev_xmin = 0;
  745. X    dev_ymin = 0;
  746. X    pixels_per_inch = 100.;
  747. X    aspect_ratio = 1.;
  748. X
  749. X/*
  750. X * device capabilities
  751. X */
  752. X    need_end_erase = YES;
  753. X    buffer_output = YES;
  754. X    smart_clip = NO;
  755. X
  756. X    color_mult = 2;
  757. X    getpar ("colormult", "d", &color_mult);
  758. X    num_col = NCOLOR / color_mult;
  759. X
  760. X    getpar ("or", "1", &rasor);
  761. X    if (rasor)
  762. X    {
  763. X    dev.vector = rasvector2;
  764. X    }
  765. X
  766. X    dev_xmax = 1024;
  767. X    dev_ymax = 768;
  768. X    aspect_ratio = 1.;
  769. X    getpar ("n1", "d", &dev_xmax);
  770. X    getpar ("n2", "d", &dev_ymax);
  771. X    getpar ("aspect", "f", &aspect_ratio);
  772. X    pixels_per_inch /= ((float) 768 / (float) dev_ymax);
  773. X    getpar ("ppi", "d", &pixels_per_inch);
  774. X#ifdef SEP
  775. X    Puthead ("\n\n# Raspen: VPLOT graphics via Movie,\n");
  776. X    Puthead ("#\tor any other byte-deep raster device.\n\n");
  777. X    Puthead ("\taspect_ratio=%f\n", aspect_ratio);
  778. X    Puthead ("\tesize=1\n");
  779. X    Puthead ("\tn1=%d\n", dev_xmax);
  780. X    Puthead ("\tn2=%d\n", dev_ymax);
  781. X#endif
  782. X
  783. X
  784. X    /*
  785. X     * Allocate space for image 
  786. X     */
  787. X    if ((image = malloc (dev_xmax * dev_ymax)) == NULL)
  788. X    {
  789. X    ERR (FATAL, name, "Can't allocate space for raster image\n");
  790. X    }
  791. X
  792. X    if (DEFAULT_OUT)
  793. X    {
  794. X#ifdef SEP
  795. X    datapath (path);
  796. X/* Code stolen from output.c to get a reasonable raster file name. */
  797. X    if (0 < findnm (headfd, headname, sizeof (headname)))
  798. X    {
  799. X        /* modify slightly */
  800. X        strcpy (fname, "");
  801. X        front = rindex (headname, '/');
  802. X        if (front == ((char *) NULL))
  803. X        front = headname;
  804. X        else
  805. X        front++;
  806. X        if ((*front) == 'H')
  807. X        strcat (fname, ++front);
  808. X        else
  809. X        {
  810. X        tail = rindex (front, '.');
  811. X        if (tail == ((char *) NULL))
  812. X            strcat (fname, front);
  813. X        else
  814. X        {
  815. X            for (ptr = tail + 1; *ptr; ptr++)
  816. X            if (!isupper (*ptr))
  817. X                break;
  818. X            if (!(*ptr))/* drop suffix if all caps */
  819. X            *tail = '\0';
  820. X            (void) strcat (fname, front);
  821. X        }
  822. X        }
  823. X        (void) strcat (fname, ".raster");
  824. X    }
  825. X    else
  826. X    {
  827. X        strcpy (fname, "raster");
  828. X    }
  829. X
  830. X    sprintf (newpath, "%s%s", path, fname);
  831. X    Puthead ("\tin=%s\n", newpath);
  832. X#else
  833. X    sprintf (newpath, "%s", "raster_file");
  834. X#endif
  835. X    pltout = fopen (newpath, "w");
  836. X    if (pltout == NULL)
  837. X        ERR (FATAL, name, "can't open file %s\n", newpath);
  838. X
  839. X    strcpy (colfile, "colfile");
  840. X    getpar (colfile, "s", colfile);
  841. X#ifdef SEP
  842. X    Puthead ("\tcolfile=%s\n", colfile);
  843. X    Puthead ("\tcolor=T\n");
  844. X    if (color_mult == 1)
  845. X        Puthead ("\tumask=255\n");
  846. X#endif
  847. X    }
  848. X}
  849. END_OF_FILE
  850. if test 3778 -ne `wc -c <'Virtual_device/raslib/rasopen.c'`; then
  851.     echo shar: \"'Virtual_device/raslib/rasopen.c'\" unpacked with wrong size!
  852. fi
  853. # end of 'Virtual_device/raslib/rasopen.c'
  854. fi
  855. if test -f 'Virtual_device/vplib/vptextT.c' -a "${1}" != "-c" ; then 
  856.   echo shar: Will not clobber existing file \"'Virtual_device/vplib/vptextT.c'\"
  857. else
  858. echo shar: Extracting \"'Virtual_device/vplib/vptextT.c'\" \(3424 characters\)
  859. sed "s/^X//" >'Virtual_device/vplib/vptextT.c' <<'END_OF_FILE'
  860. X/*
  861. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  862. X * University. Official permission to use this software is included in
  863. X * the documentation. It authorizes you to use this file for any
  864. X * non-commercial purpose, provided that this copyright notice is not
  865. X * removed and that any modifications made to this file are commented
  866. X * and dated in the style of my example below.
  867. X */
  868. X
  869. X/*
  870. X *
  871. X *  source file:   ./filters/vplib/vptextT.c
  872. X *
  873. X * Joe Dellinger (SEP), Dec 19 1987
  874. X *    Inserted this sample edit history entry.
  875. X *    Please log any further modifications made to this file:
  876. X */
  877. X
  878. X/*
  879. X * THIS FILE SHOWS HOW TO DO TEXT USING THE VP_TEXT COMMAND.
  880. X * I INCLUDE THIS AS AN EXAMPLE OF HOW TO SUPPORT HARDWARE
  881. X * TEXT WELL ON DEVICES THAT CAN'T DO ARBITRARY TRANSFORMATIONS.
  882. X */
  883. X
  884. X#include    <stdio.h>
  885. X#include    <math.h>
  886. X#include    "../include/vplot.h"
  887. X#include    "../include/extern.h"
  888. X#include    "../include/enum.h"
  889. X#include    "../include/params.h"
  890. X#include    "../include/round.h"
  891. X#include    "./vp.h"
  892. X
  893. static double   path_orient_dx, path_orient_dy;
  894. static double   up_orient_dx, up_orient_dy;
  895. X
  896. extern int
  897. gentext (), nulldev ();
  898. X
  899. vptext (string, pathx, pathy, upx, upy)
  900. X    char           *string;
  901. X    float           pathx, pathy, upx, upy;
  902. X{
  903. double          fpathx, fpathy, fupx, fupy;
  904. double          up, path;
  905. int             vpsize, vporient;
  906. float           dot, cross, aspect;
  907. int             (*savevector) ();
  908. int             (*saveattributes) ();
  909. int             (*savearea) ();
  910. X
  911. X    vpsetflag = NO;
  912. X    lost = YES;
  913. X
  914. X    if (*string == '\0')
  915. X    return;
  916. X
  917. X/*
  918. X * Set the inital parameters
  919. X */
  920. X    fpathx = (double) pathx;
  921. X    fpathy = (double) pathy;
  922. X    fupx = (double) upx;
  923. X    fupy = (double) upy;
  924. X
  925. X    path = sqrt ((double) (fpathx * fpathx + fpathy * fpathy));
  926. X    up = sqrt ((double) (fupx * fupx + fupy * fupy));
  927. X
  928. X    path_orient_dx = fpathx / path;
  929. X    path_orient_dy = fpathy / path;
  930. X    up_orient_dx = fupx / up;
  931. X    up_orient_dy = fupy / up;
  932. X
  933. X/*
  934. X * Check for skewed coordinates
  935. X *
  936. X * If the path and orient vectors are scewed by more than 2
  937. X * degrees, or if the height/width ratio is more than 1 percent
  938. X * off, or if the letters are mirrored, then use vector text.
  939. X */
  940. X
  941. X    dot = path_orient_dx * up_orient_dx +
  942. X     path_orient_dy * up_orient_dy;
  943. X
  944. X    cross = path_orient_dx * up_orient_dy -
  945. X     path_orient_dy * up_orient_dx;
  946. X
  947. X    if (path != 0.)
  948. X    {
  949. X    aspect = up / path;
  950. X    }
  951. X    else
  952. X    {
  953. X    if (up == 0.)
  954. X        aspect = 1.;
  955. X    else
  956. X        aspect = 0.;
  957. X    }
  958. X
  959. X    if (fabs (dot) > .01 || cross < 0. || fabs (aspect - 1.) > .01)
  960. X    {
  961. X    gentext (string, pathx, pathy, upx, upy);
  962. X    return;
  963. X    }
  964. X
  965. X/*
  966. X *   Set the font and size
  967. X */
  968. X    vpsize = ROUND (TXPERIN * path / RPERIN);
  969. X    vporient = ROUND (acos (path_orient_dx) * 180 / 3.141592654);
  970. X    if (pathy < 0)
  971. X    vporient *= -1;
  972. X
  973. X    vp_text ((float) xold / RPERIN, (float) yold / RPERIN,
  974. X         vpsize, vporient, string);
  975. X
  976. X/*
  977. X *   Now reset the pen position.
  978. X *   Do a dummy run through (if this indeed a gentext font)
  979. X */
  980. X    if (txfont < NUMGENFONT)
  981. X    {
  982. X    savevector = dev.vector;
  983. X    saveattributes = dev.attributes;
  984. X    savearea = dev.area;
  985. X
  986. X/*
  987. X *   Disconnect everything except error messages
  988. X */
  989. X    dev.vector = nulldev;
  990. X    dev.attributes = nulldev;
  991. X    dev.area = nulldev;
  992. X
  993. X    gentext (string, pathx, pathy, upx, upy);
  994. X
  995. X    dev.vector = savevector;
  996. X    dev.attributes = saveattributes;
  997. X    dev.area = savearea;
  998. X
  999. X    vp_move ((float) xold / RPERIN, (float) yold / RPERIN);
  1000. X    }
  1001. X}
  1002. END_OF_FILE
  1003. if test 3424 -ne `wc -c <'Virtual_device/vplib/vptextT.c'`; then
  1004.     echo shar: \"'Virtual_device/vplib/vptextT.c'\" unpacked with wrong size!
  1005. fi
  1006. # end of 'Virtual_device/vplib/vptextT.c'
  1007. fi
  1008. if test -f 'Vplot_Kernel/filters/Tests/polytest.c' -a "${1}" != "-c" ; then 
  1009.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/Tests/polytest.c'\"
  1010. else
  1011. echo shar: Extracting \"'Vplot_Kernel/filters/Tests/polytest.c'\" \(3083 characters\)
  1012. sed "s/^X//" >'Vplot_Kernel/filters/Tests/polytest.c' <<'END_OF_FILE'
  1013. X/*
  1014. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  1015. X * University. Official permission to use this software is included in
  1016. X * the documentation. It authorizes you to use this file for any
  1017. X * non-commercial purpose, provided that this copyright notice is not
  1018. X * removed and that any modifications made to this file are commented
  1019. X * and dated in the style of my example below.
  1020. X */
  1021. X
  1022. X/*
  1023. X *
  1024. X *  source file:   ./filters/Tests/polytest.c
  1025. X *
  1026. X * Joe Dellinger (SEP), June 11 1987
  1027. X *    Inserted this sample edit history entry.
  1028. X *    Please log any further modifications made to this file:
  1029. X */
  1030. X
  1031. X#include <stdio.h>
  1032. X#include <vplot.h>
  1033. X#include <math.h>
  1034. X
  1035. X#define NP 10
  1036. X
  1037. main ()
  1038. X{
  1039. int             mtype, msize;
  1040. float           xarray[NP], yarray[NP];
  1041. float           dash[2], gap[2];
  1042. int             i, j;
  1043. int             pattern[100];
  1044. X
  1045. X/*
  1046. X * Set up where you want the vplot output to go.
  1047. X */
  1048. X    vp_filep (stdout);
  1049. X
  1050. X/*
  1051. X * Decide what "style" plot this is to be.
  1052. X */
  1053. X    vp_style (STANDARD);
  1054. X
  1055. X/*
  1056. X * Draw polymarkers.
  1057. X */
  1058. X    for (i = 0; i < NP; i++)
  1059. X    {
  1060. X    xarray[i] = 4.25 + i % 3;
  1061. X    yarray[i] = (1. - (float) i / NP) * 8.;
  1062. X    }
  1063. X    msize = 20;
  1064. X    mtype = 23;
  1065. X    vp_color (RED);
  1066. X    vp_pmark (NP, mtype, msize, xarray, yarray);
  1067. X
  1068. X/*
  1069. X * Draw dashed polyline.
  1070. X */
  1071. X    dash[0] = (.5);
  1072. X    dash[1] = (.1);
  1073. X    gap[0] = (.1);
  1074. X    gap[1] = (.1);
  1075. X    vp_setdash (dash, gap, 2);
  1076. X    vp_color (WHITE);
  1077. X
  1078. X    for (i = 0; i < NP; i++)
  1079. X    {
  1080. X    xarray[i] = 4.25 + (i + 1) % 3;
  1081. X    yarray[i] = (1. - (float) i / NP) * 8.;
  1082. X    }
  1083. X    vp_pline (xarray, yarray, NP);
  1084. X
  1085. X    vp_color (BLUE);
  1086. X
  1087. X    for (i = 0; i < NP; i++)
  1088. X    {
  1089. X    xarray[i] = 4.25 + (i + 2) % 3;
  1090. X    yarray[i] = (1. - (float) i / NP) * 8.;
  1091. X    }
  1092. X    vp_pline (xarray, yarray, NP);
  1093. X
  1094. X    for (i = 0; i < 10; i++)
  1095. X    for (j = 0; j < 10; j++)
  1096. X    {
  1097. X        pattern[i + j * 10] = (int)
  1098. X         (.25 * ((i - 6.) * (i - 3.) + (j - 6.) * (j - 3.)));
  1099. X        if (pattern[i + j * 10] > 7 || pattern[i + j * 10] < 0)
  1100. X        pattern[i + j * 10] = 7;
  1101. X    }
  1102. X    vp_patload (10, 10, 10, GREEN, pattern);
  1103. X
  1104. X    i = 0;
  1105. X    pattern[i++] = 1;
  1106. X    pattern[i++] = RED;
  1107. X    pattern[i++] = 0. * HATCHPERIN;
  1108. X    pattern[i++] = (.5) * HATCHPERIN;
  1109. X
  1110. X    pattern[i++] = 1;
  1111. X    pattern[i++] = WHITE;
  1112. X    pattern[i++] = (.25) * HATCHPERIN;
  1113. X    pattern[i++] = (.5) * HATCHPERIN;
  1114. X
  1115. X    pattern[i++] = 1;
  1116. X    pattern[i++] = BLUE;
  1117. X    pattern[i++] = 0. * HATCHPERIN;
  1118. X    pattern[i++] = (.5) * HATCHPERIN;
  1119. X
  1120. X    pattern[i++] = 1;
  1121. X    pattern[i++] = WHITE;
  1122. X    pattern[i++] = (.25) * HATCHPERIN;
  1123. X    pattern[i++] = (.5) * HATCHPERIN;
  1124. X
  1125. X    vp_hatchload (30, 2, RED, pattern);
  1126. X
  1127. X    vp_color (GREEN);
  1128. X    for (i = 0; i < NP; i++)
  1129. X    {
  1130. X    xarray[i] = 9. + 2. * cos (i * 2. * 3.14159 / NP);
  1131. X    yarray[i] = 4. + 2. * sin (i * 2. * 3.14159 / NP);
  1132. X    }
  1133. X    vp_fill (xarray, yarray, NP);
  1134. X
  1135. X    vp_color (RED);
  1136. X    for (i = 0; i < NP; i++)
  1137. X    {
  1138. X    xarray[i] = 2. + 2. * cos (i * 2. * 3.14159 / NP);
  1139. X    yarray[i] = 4. + 2. * sin (i * 2. * 3.14159 / NP);
  1140. X    }
  1141. X    vp_fill (xarray, yarray, NP);
  1142. X
  1143. X    vp_fat (5);
  1144. X    vp_setdash (NULL, NULL, 0);
  1145. X    vp_pline (xarray, yarray, NP);
  1146. X
  1147. X/*
  1148. X * Finish up
  1149. X */
  1150. X    vp_endplot ();
  1151. X}
  1152. END_OF_FILE
  1153. if test 3083 -ne `wc -c <'Vplot_Kernel/filters/Tests/polytest.c'`; then
  1154.     echo shar: \"'Vplot_Kernel/filters/Tests/polytest.c'\" unpacked with wrong size!
  1155. fi
  1156. # end of 'Vplot_Kernel/filters/Tests/polytest.c'
  1157. fi
  1158. if test -f 'Vplot_Kernel/filters/genlib/vecarea.c' -a "${1}" != "-c" ; then 
  1159.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/genlib/vecarea.c'\"
  1160. else
  1161. echo shar: Extracting \"'Vplot_Kernel/filters/genlib/vecarea.c'\" \(3158 characters\)
  1162. sed "s/^X//" >'Vplot_Kernel/filters/genlib/vecarea.c' <<'END_OF_FILE'
  1163. X/*
  1164. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  1165. X * University. Official permission to use this software is included in
  1166. X * the documentation. It authorizes you to use this file for any
  1167. X * non-commercial purpose, provided that this copyright notice is not
  1168. X * removed and that any modifications made to this file are commented
  1169. X * and dated in the style of my example below.
  1170. X */
  1171. X
  1172. X/*
  1173. X *
  1174. X *  source file:   ./filters/genlib/vecarea.c
  1175. X *
  1176. X * Joe Dellinger (SEP), June 11 1987
  1177. X *    Inserted this sample edit history entry.
  1178. X *    Please log any further modifications made to this file:
  1179. X */
  1180. X
  1181. X#include <stdio.h>
  1182. X#include "../include/pat.h"
  1183. X#include "../include/vertex.h"
  1184. X#include "../include/params.h"
  1185. X#include "../include/extern.h"
  1186. X
  1187. extern char    *malloc ();
  1188. X
  1189. vecarea (npts, head)
  1190. X    int             npts;
  1191. X    struct vertex  *head;
  1192. X{
  1193. register int    x, y, i;
  1194. register int    xstr, xend, ystr, yend;
  1195. int             skip;
  1196. int             ncross;
  1197. int             vminx, vmaxx, vminy, vmaxy;
  1198. struct vertex  *xhead, *yhead, *v;
  1199. int            *crosses;
  1200. X
  1201. X    /*
  1202. X     * allocate storage for scan line cross points 
  1203. X     */
  1204. X    crosses = (int *) malloc ((unsigned) npts * sizeof (int));
  1205. X
  1206. X    /*
  1207. X     * double link the vertices. (head) is set to the node with the maximum
  1208. X     * x-value so that intersect() will not eliminate 'head' while casting
  1209. X     * off vertices. 
  1210. X     */
  1211. X    vminx = head->x;
  1212. X    vmaxx = head->x;
  1213. X    vminy = head->y;
  1214. X    vmaxy = head->y;
  1215. X    xhead = head;
  1216. X    yhead = head;
  1217. X
  1218. X    v = head;
  1219. X    for (i = 0; i < npts; i++)
  1220. X    {
  1221. X    if (v->x > vmaxx)
  1222. X    {
  1223. X        vmaxx = v->x;
  1224. X        xhead = v;
  1225. X    }
  1226. X    if (v->y > vmaxy)
  1227. X    {
  1228. X        vmaxy = v->y;
  1229. X        yhead = v;
  1230. X    }
  1231. X    if (v->x < vminx)
  1232. X        vminx = v->x;
  1233. X    if (v->y < vminy)
  1234. X        vminy = v->y;
  1235. X    v++;
  1236. X    }
  1237. X
  1238. X    if (vmaxx > xwmax)
  1239. X    vmaxx = xwmax;
  1240. X    if (vminx < xwmin)
  1241. X    vminx = xwmin;
  1242. X    if (vmaxy > ywmax)
  1243. X    vmaxy = ywmax;
  1244. X    if (vminy < ywmin)
  1245. X    vminy = ywmin;
  1246. X
  1247. X    if ((pat[ipat] .ydim > 0) || (pat[ipat] .xdim == 1))
  1248. X    {
  1249. X    /* stretch polygon in y-direction */
  1250. X    v = yhead;
  1251. X    do
  1252. X    {
  1253. X        v->y = 2 * (v->y) + 1;
  1254. X        v = v->next;
  1255. X    } while (v != yhead);
  1256. X
  1257. X    skip = (pat[ipat] .xdim == 1) ? 1 : pat[ipat] .ydim;
  1258. X    for (y = vminy; y <= vmaxy; y += skip)
  1259. X    {
  1260. X        ncross = intersect (2 * y, crosses, yhead, 1);
  1261. X        sort (crosses, ncross);
  1262. X        for (i = 0; i < ncross; i += 2)
  1263. X        {
  1264. X        xstr = crosses[i];
  1265. X        xend = crosses[i + 1];
  1266. X        dev.vector (xstr, y, xend, y, 0, 0);
  1267. X        }
  1268. X    }
  1269. X    /* shrink in y */
  1270. X    v = yhead;
  1271. X    do
  1272. X    {
  1273. X        v->y = ((v->y - 1) / 2);
  1274. X        v = v->next;
  1275. X    } while (v != yhead);
  1276. X    }
  1277. X
  1278. X    if ((pat[ipat] .xdim > 1) && (pat[ipat] .ydim > 1))
  1279. X    {
  1280. X    /*
  1281. X     * expand in x 
  1282. X     */
  1283. X    v = xhead;
  1284. X    do
  1285. X    {
  1286. X        v->x = 2 * v->x + 1;
  1287. X        v = v->next;
  1288. X    } while (v != xhead);
  1289. X
  1290. X    skip = pat[ipat] .xdim;
  1291. X    for (x = vminx; x <= vmaxx; x += skip)
  1292. X    {
  1293. X        ncross = intersect (2 * x, crosses, xhead, 0);
  1294. X        sort (crosses, ncross);
  1295. X        for (i = 0; i < ncross; i += 2)
  1296. X        {
  1297. X        ystr = crosses[i];
  1298. X        yend = crosses[i + 1];
  1299. X        dev.vector (x, ystr, x, yend, 0, 0);
  1300. X        }
  1301. X    }
  1302. X
  1303. X    /*
  1304. X     * shrink in x 
  1305. X     */
  1306. X    v = xhead;
  1307. X    do
  1308. X    {
  1309. X        v->x = ((v->x - 1) / 2);
  1310. X        v = v->next;
  1311. X    } while (v != xhead);
  1312. X    }
  1313. X    free ((char *) crosses);
  1314. X}
  1315. END_OF_FILE
  1316. if test 3158 -ne `wc -c <'Vplot_Kernel/filters/genlib/vecarea.c'`; then
  1317.     echo shar: \"'Vplot_Kernel/filters/genlib/vecarea.c'\" unpacked with wrong size!
  1318. fi
  1319. # end of 'Vplot_Kernel/filters/genlib/vecarea.c'
  1320. fi
  1321. if test -f 'Vplot_Kernel/filters/loclib/getpar_decode.c' -a "${1}" != "-c" ; then 
  1322.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/loclib/getpar_decode.c'\"
  1323. else
  1324. echo shar: Extracting \"'Vplot_Kernel/filters/loclib/getpar_decode.c'\" \(3753 characters\)
  1325. sed "s/^X//" >'Vplot_Kernel/filters/loclib/getpar_decode.c' <<'END_OF_FILE'
  1326. X/*
  1327. X *
  1328. X *  source file:   ./filters/loclib/getpar_decode.c
  1329. X *
  1330. X * Joe Dellinger (SEP), June 11 1987
  1331. X *    Inserted this sample edit history entry.
  1332. X *    Please log any further modifications made to this file:
  1333. X */
  1334. X
  1335. X/* Revised 3-8-86 stew  Added timestamp to recover older functionality
  1336. X *            when presented with multiple tags
  1337. X * Revised 9-18-86 joe  Added '1' type ... y or 1 for yes, n or 0 for no
  1338. X */
  1339. X#include <stdio.h>
  1340. X#include "fastpar.h"
  1341. X
  1342. X/*
  1343. X * split off first tag "n1" from input tags "n1 nt ne"
  1344. X */
  1345. static int tag_split(tag,tlen,subtag,sublen)
  1346. register char *tag;
  1347. char **subtag;
  1348. register int tlen;
  1349. int *sublen;
  1350. X{
  1351. X register int i,j;
  1352. X
  1353. X for(i=0; i<tlen; i++) if(tag[i] != ' ') break;
  1354. X if(i == tlen) return(0); /* all bytes consumed */
  1355. X *subtag = tag+i;
  1356. X for(j=i+1; j<tlen; j++) if(tag[j] == ' ') break;
  1357. X *sublen = (j-i);
  1358. X return(1);
  1359. X}
  1360. X
  1361. X/*
  1362. X * take string "n1 nt ne" and look up stored parameters with those
  1363. X * names, returning value with most recent timestamp
  1364. X */
  1365. int getpar_decode(q,qlen,tag,type,val)
  1366. hash_item **q;
  1367. int qlen;
  1368. char *tag, *type;
  1369. MIXED val;
  1370. X{
  1371. X register char *next, *end;
  1372. X char *subtag;
  1373. X int sublen, count = 0 ;
  1374. X register hash_item *foundit, *saveit;
  1375. X extern hash_item *getpar_hash_lookup();
  1376. X register int bigtime = -1;
  1377. X
  1378. X next=tag; end = tag+strlen(tag);
  1379. X while(tag_split(next,end-next,&subtag,&sublen)) {
  1380. X    foundit = getpar_hash_lookup(q,qlen,subtag,sublen);
  1381. X    if(foundit != ((hash_item *) NULL))
  1382. X    if(bigtime < foundit->timestamp) {
  1383. X        bigtime = foundit->timestamp;
  1384. X        saveit = foundit;
  1385. X        }
  1386. X    next = subtag+sublen;
  1387. X    }
  1388. X if(bigtime >= 0) count = getpar_getval(saveit,type,val);
  1389. X return(count);
  1390. X }
  1391. X
  1392. X/*
  1393. X * return 1 if char c is not in string s; else return 0
  1394. X */
  1395. static int
  1396. getpar_neq(c,s)
  1397. register int c;
  1398. register char *s;
  1399. X{
  1400. X    do {
  1401. X        if(*s == c) {
  1402. X            return(0); 
  1403. X        }
  1404. X    } 
  1405. X    while(*s++);
  1406. X    return(1);
  1407. X}
  1408. X
  1409. X/*
  1410. X * take stored string value and convert it according to "type" format
  1411. X * result stored at "ptr"
  1412. X *
  1413. X * type formats:
  1414. X *               "i" or "d"  to convert to integer
  1415. X *               "r" or "f"  to convert to real
  1416. X *               "g"         to convert to double precision
  1417. X *               "s"         to keep as a string value
  1418. X *
  1419. X * stored string values may specify a vector of numerics:
  1420. X *
  1421. X *               3.0,5x3.5,-1.0,3*2.2
  1422. X * 
  1423. X * yields the result:
  1424. X *
  1425. X *               3.0,3.5,3.5,3.5,3.5,3.5,-1.0,2.2,2.2,2.2
  1426. X *
  1427. X * the function's return value will be the count (10) of items converted
  1428. X */
  1429. static int getpar_getval(foundit,type,ptr)
  1430. hash_item *foundit;
  1431. char *type;
  1432. MIXED ptr;
  1433. X{
  1434. X    register char *sptr, *str;
  1435. X    register int ival, jval;
  1436. X    register int index, endindex;
  1437. X    extern double atof();
  1438. X    extern int atoi();
  1439. X    float flt;
  1440. X    double dubble;
  1441. X    int integer;
  1442. X    index=0;
  1443. X    str = foundit->val;
  1444. X    ival = foundit->vlen;
  1445. X
  1446. X    while(ival > 0) {
  1447. X    endindex= index+1;
  1448. X    if(*type != 's') {
  1449. X        sptr = str;
  1450. X        jval = ival;
  1451. X        while(jval && getpar_neq((int) (*sptr),"*x,"))
  1452. X            { sptr++; jval--;}
  1453. X        if(jval > 0)
  1454. X            if(*sptr=='*' || *sptr=='x') {
  1455. X            endindex= index+atoi(str);
  1456. X            str= sptr+1;
  1457. X            ival = jval-1;
  1458. X        }
  1459. X    }
  1460. X    switch(*type) {
  1461. X    case 'd':
  1462. X    case 'i':
  1463. X        integer= atoi(str);
  1464. X        while(index<endindex) ptr.i[index++]= integer;
  1465. X        break;
  1466. X    case '1':
  1467. X        if (str[0] == 'y' || str[0] == '1' || str[0] == 'Y')
  1468. X            integer = 1;
  1469. X        else
  1470. X            integer = 0;
  1471. X        while(index<endindex) ptr.i[index++]= integer;
  1472. X        break;
  1473. X    case 'f':
  1474. X    case 'r':
  1475. X        flt= atof(str);
  1476. X        while(index<endindex) ptr.f[index++]= flt;
  1477. X        break;
  1478. X    case 'g':
  1479. X        dubble= atof(str);
  1480. X        while(index<endindex) ptr.g[index++]= dubble;
  1481. X        break;
  1482. X    case 's':
  1483. X        bcopy(str,ptr.s,ival);
  1484. X        ptr.s[ival]='\0';
  1485. X        return(1);
  1486. X    default:
  1487. X        err("getpar() unknown conversion type %c\n",*type);
  1488. X    }
  1489. X    while((--ival) && ((*(str++)) != ',')); /* skip past next comma */
  1490. X    }
  1491. X    return(endindex);
  1492. X}
  1493. END_OF_FILE
  1494. if test 3753 -ne `wc -c <'Vplot_Kernel/filters/loclib/getpar_decode.c'`; then
  1495.     echo shar: \"'Vplot_Kernel/filters/loclib/getpar_decode.c'\" unpacked with wrong size!
  1496. fi
  1497. # end of 'Vplot_Kernel/filters/loclib/getpar_decode.c'
  1498. fi
  1499. if test -f 'Vplot_Kernel/filters/proc_vplot.c' -a "${1}" != "-c" ; then 
  1500.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/proc_vplot.c'\"
  1501. else
  1502. echo shar: Extracting \"'Vplot_Kernel/filters/proc_vplot.c'\" \(3621 characters\)
  1503. sed "s/^X//" >'Vplot_Kernel/filters/proc_vplot.c' <<'END_OF_FILE'
  1504. X/*
  1505. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  1506. X * University. Official permission to use this software is included in
  1507. X * the documentation. It authorizes you to use this file for any
  1508. X * non-commercial purpose, provided that this copyright notice is not
  1509. X * removed and that any modifications made to this file are commented
  1510. X * and dated in the style of my example below.
  1511. X */
  1512. X
  1513. X/*
  1514. X *
  1515. X *  source file:   ./filters/proc_vplot.c
  1516. X *
  1517. X * Joe Dellinger (SEP), Feb 19 1988
  1518. X *    Inserted this sample edit history entry.
  1519. X *    Please log any further modifications made to this file:
  1520. X *
  1521. X * Joe Dellinger Feb 22 1988
  1522. X *    Created INT_PAUSE to be separate from INT_GET_STRING.
  1523. X * Joe Dellinger Feb 27 1988
  1524. X *    Interact option turns of endpausing.
  1525. X */
  1526. X
  1527. X#include    <stdio.h>
  1528. X#include    <math.h>
  1529. X#define        GETPAR    getpar
  1530. X
  1531. X
  1532. X#include    <sys/ioctl.h>
  1533. X#include    <sys/types.h>
  1534. X#include    <sys/stat.h>
  1535. X#include    <sgtty.h>
  1536. X#include    <ctype.h>
  1537. X#include    <strings.h>
  1538. X
  1539. X#include    <vplot.h>
  1540. X
  1541. X#include    "./include/params.h"    /* for machine dependencies */
  1542. X#include    "./include/enum.h"
  1543. X#include    "./include/err.h"
  1544. X#include    "./include/attrcom.h"
  1545. X#include    "./include/intcom.h"
  1546. X#include    "./include/mesgcom.h"
  1547. X#include    "./include/erasecom.h"
  1548. X#include    "./include/closestat.h"
  1549. X#include    "./include/pat.h"
  1550. X#include    "./include/vertex.h"
  1551. X#include    "./include/round.h"
  1552. X#include    "./include/extern.h"
  1553. X
  1554. extern struct sgttyb tty_clean_state;
  1555. extern int      tty_clean_local_mode;
  1556. extern int      need_end_erase;
  1557. extern int      buffer_input;
  1558. extern int      ever_called;
  1559. extern int      out_isatty;
  1560. extern int      nplots;
  1561. extern int      endpause;
  1562. extern int      allowecho;
  1563. extern int      epause;
  1564. extern char     interact[];
  1565. extern int      pltoutfd;
  1566. extern int      (*message) ();
  1567. extern FILE    *pltin;
  1568. extern FILE    *controltty;
  1569. extern FILE    *pltinarray[];
  1570. extern char     pltinname[][MAXFLEN + 1];
  1571. extern char     pltname[];
  1572. extern int      infileno;
  1573. extern int      (*genreader) ();
  1574. X
  1575. FILE           *fopen ();
  1576. X
  1577. X/*
  1578. X * This routine is responsible for processing the input files,
  1579. X * and performing the necessary pausing, etc, that may be needed
  1580. X * at the end before exiting.
  1581. X */
  1582. X
  1583. proc_vplot ()
  1584. X{
  1585. int             ii;
  1586. char            string[MAXFLEN + 1];
  1587. X
  1588. X/*
  1589. X * Finally, shove all the plot files off to be done!
  1590. X */
  1591. X
  1592. X    if (!buffer_input)
  1593. X    {
  1594. X    for (ii = 0; ii < infileno; ii++)
  1595. X    {
  1596. X        setbuf (pltinarray[ii], (char *) NULL);
  1597. X    }
  1598. X    }
  1599. X
  1600. X    (*genreader) (infileno, pltinarray, pltinname);
  1601. X
  1602. X/*
  1603. X * Normally, *genreader will be gen_do_dovplot, found in genlib
  1604. X */
  1605. X
  1606. X    if (ever_called)
  1607. X    {
  1608. X    dev.close (CLOSE_FLUSH);
  1609. X    if (epause > 0)
  1610. X    {
  1611. X        sleep ((unsigned) epause);
  1612. X    }
  1613. X    if (need_end_erase)
  1614. X    {
  1615. X        dev.erase (ERASE_END);
  1616. X    }
  1617. X    /*
  1618. X     * Inquire point back from device. Skip endpause stuff if we do
  1619. X     * interact, Since that's a pause in itself. 
  1620. X     */
  1621. X    if (interact[0] != '\0')
  1622. X    {
  1623. X        getapoint ();
  1624. X    }
  1625. X    else
  1626. X    {
  1627. X
  1628. X/*
  1629. X * Pause at the end if the user specifically asks us to on the command line,
  1630. X * even if we don't think we should because we think it's a file.
  1631. X */
  1632. X        if (epause <= 0 &&
  1633. X        (out_isatty || getpar ("endpause", "s", string))
  1634. X        && endpause)
  1635. X        {
  1636. X        dev.close (CLOSE_PAUSE);
  1637. X        dev.interact (INT_F_PAUSE, controltty, string);
  1638. X        }
  1639. X    }
  1640. X    message (MESG_ON);
  1641. X    dev.close (CLOSE_NORMAL);
  1642. X    dev.close (CLOSE_DONE);
  1643. X    nplots++;
  1644. X    }
  1645. X    else
  1646. X    {
  1647. X    dev.close (CLOSE_NOTHING);
  1648. X    ERR (COMMENT, name, "No input?");
  1649. X    dev.close (CLOSE_DONE);
  1650. X    }
  1651. X
  1652. X    /*
  1653. X     * Done, let them see what they are doing again 
  1654. X     */
  1655. X    if (!allowecho)
  1656. X    {
  1657. X    ioctl (pltoutfd, TIOCLSET, (char *) (&tty_clean_local_mode));
  1658. X    ioctl (pltoutfd, TIOCSETN, (char *) (&tty_clean_state));
  1659. X    }
  1660. X}
  1661. END_OF_FILE
  1662. if test 3621 -ne `wc -c <'Vplot_Kernel/filters/proc_vplot.c'`; then
  1663.     echo shar: \"'Vplot_Kernel/filters/proc_vplot.c'\" unpacked with wrong size!
  1664. fi
  1665. # end of 'Vplot_Kernel/filters/proc_vplot.c'
  1666. fi
  1667. if test -f 'Vplot_Kernel/filters/utilities/error.c' -a "${1}" != "-c" ; then 
  1668.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/utilities/error.c'\"
  1669. else
  1670. echo shar: Extracting \"'Vplot_Kernel/filters/utilities/error.c'\" \(3578 characters\)
  1671. sed "s/^X//" >'Vplot_Kernel/filters/utilities/error.c' <<'END_OF_FILE'
  1672. X/*
  1673. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  1674. X * University. Official permission to use this software is included in
  1675. X * the documentation. It authorizes you to use this file for any
  1676. X * non-commercial purpose, provided that this copyright notice is not
  1677. X * removed and that any modifications made to this file are commented
  1678. X * and dated in the style of my example below.
  1679. X */
  1680. X
  1681. X/*
  1682. X *
  1683. X *  source file:   ./filters/utilities/error.c
  1684. X *
  1685. X * Joe Dellinger (SEP), June 11 1987
  1686. X *    Inserted this sample edit history entry.
  1687. X *    Please log any further modifications made to this file:
  1688. X * Stewart A. Levin (SEP), June 23 1987
  1689. X *    Changed system("stty echo") to ioctl() to restore original tty
  1690. X *    settings after we've deliberately forced echo off.
  1691. X * Stewart A. Levin (SEP), July 5,1987
  1692. X *      Added reset of local mode word corresponding to frontend.c change.
  1693. X * Joe Dellinger, Nov 9, 1987
  1694. X *    Stew's changes make it necessary to explicitly put "Carriage-Return
  1695. X *    Line-Feed" instead of just "\n", since output stream may be
  1696. X *    uncooked. "CRLF" is defined in mesgcom.h.
  1697. X * Joe Dellinger, Jan 10, 1988
  1698. X *    Up to 8 arguments instead of just 3! This routine isn't very kosher.
  1699. X * Joe Dellinger, Feb 16, 1988
  1700. X *    Use vsprintf on machines that have them.
  1701. X */
  1702. X
  1703. X/*
  1704. X * error reporting for VPLOT filters
  1705. X * To print text to the outside world, other routines must go through err,
  1706. X * which in turn must go through message.
  1707. X */
  1708. X
  1709. X#include <sys/ioctl.h>
  1710. X#include <sgtty.h>
  1711. X#include <stdio.h>
  1712. X#include "../include/err.h"
  1713. X#include "../include/closestat.h"
  1714. X#include "../include/mesgcom.h"
  1715. X#include "../include/extern.h"
  1716. extern int      device_open;
  1717. extern struct sgttyb tty_clean_state;
  1718. extern int      tty_clean_local_mode;
  1719. X
  1720. X#if defined (SUN) || defined (ULTRIX)
  1721. X
  1722. X#include <varargs.h>
  1723. X
  1724. ERR (va_alist)
  1725. va_dcl
  1726. X{
  1727. va_list         apdum;
  1728. int             type;
  1729. char           *filter, *fmt;
  1730. X
  1731. char            string[200];
  1732. char            text[150];
  1733. extern char    *sprintf (), *strcat ();
  1734. X
  1735. X    va_start (apdum);
  1736. X    type = va_arg (apdum, int);
  1737. X    filter = va_arg (apdum, char *);
  1738. X    fmt = va_arg (apdum, char *);
  1739. X
  1740. X    (void) vsprintf (text, fmt, apdum);
  1741. X    (void) sprintf (string, "%s: ", filter);
  1742. X
  1743. X    va_end (apdum);
  1744. X
  1745. X#else
  1746. X
  1747. ERR (type, filter, fmt, a1, a2, a3, a4, a5, a6, a7, a8)
  1748. X    int             type;
  1749. X    char           *filter, *fmt;
  1750. X    double          a1, a2, a3, a4, a5, a6, a7, a8;
  1751. X{
  1752. char            string[200];
  1753. char            text[150];
  1754. extern char    *sprintf (), *strcat ();
  1755. X
  1756. X    (void) sprintf (text, fmt, a1, a2, a3, a4, a5, a6, a7, a8);
  1757. X    (void) sprintf (string, "%s: ", filter);
  1758. X
  1759. X#endif
  1760. X
  1761. X    message (MESG_READY);
  1762. X
  1763. X    switch (type)
  1764. X    {
  1765. X    case WARN:
  1766. X    (void) strcat (string, "(warning) ");
  1767. X    (void) strcat (string, text);
  1768. X    (void) strcat (string, CRLF);
  1769. X    message (MESG_TEXT, string);
  1770. X    message (MESG_DONE);
  1771. X    break;
  1772. X    case COMMENT:
  1773. X    (void) strcat (string, " ");
  1774. X    (void) strcat (string, text);
  1775. X    (void) strcat (string, CRLF);
  1776. X    message (MESG_TEXT, string);
  1777. X    message (MESG_DONE);
  1778. X    break;
  1779. X    case FATAL:
  1780. X    default:
  1781. X    (void) strcat (string, "(fatal) ");
  1782. X    (void) strcat (string, text);
  1783. X    (void) strcat (string, CRLF);
  1784. X    message (MESG_TEXT, string);
  1785. X    message (MESG_DONE);
  1786. X    if (device_open)
  1787. X    {
  1788. X        dev.close (CLOSE_ERROR);
  1789. X        message (MESG_ON);
  1790. X        dev.close (CLOSE_DONE);
  1791. X        fflush (pltout);
  1792. X    }
  1793. X    if (!allowecho)        /* restore terminal to original tty state */
  1794. X    {
  1795. X        (void) ioctl ((int) (fileno (pltout)), TIOCLSET,
  1796. X              (char *) (&tty_clean_local_mode));
  1797. X        (void) ioctl ((int) (fileno (pltout)), TIOCSETN,
  1798. X              (char *) (&tty_clean_state));
  1799. X    }
  1800. X    exit (-1);
  1801. X    }
  1802. X}
  1803. END_OF_FILE
  1804. if test 3578 -ne `wc -c <'Vplot_Kernel/filters/utilities/error.c'`; then
  1805.     echo shar: \"'Vplot_Kernel/filters/utilities/error.c'\" unpacked with wrong size!
  1806. fi
  1807. # end of 'Vplot_Kernel/filters/utilities/error.c'
  1808. fi
  1809. if test -f 'Vplot_Kernel/filters/utilities/vptodev.c' -a "${1}" != "-c" ; then 
  1810.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/utilities/vptodev.c'\"
  1811. else
  1812. echo shar: Extracting \"'Vplot_Kernel/filters/utilities/vptodev.c'\" \(3185 characters\)
  1813. sed "s/^X//" >'Vplot_Kernel/filters/utilities/vptodev.c' <<'END_OF_FILE'
  1814. X/*
  1815. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  1816. X * University. Official permission to use this software is included in
  1817. X * the documentation. It authorizes you to use this file for any
  1818. X * non-commercial purpose, provided that this copyright notice is not
  1819. X * removed and that any modifications made to this file are commented
  1820. X * and dated in the style of my example below.
  1821. X */
  1822. X
  1823. X/*
  1824. X *
  1825. X *  source file:   ./filters/utilities/vptodev.c
  1826. X *
  1827. X * Joe Dellinger (SEP), June 11 1987
  1828. X *    Inserted this sample edit history entry.
  1829. X *    Please log any further modifications made to this file:
  1830. X */
  1831. X
  1832. X/*
  1833. X * convert vplot coordinates to device coordinates, or vice versa
  1834. X */
  1835. X#include <stdio.h>
  1836. X#include "../include/extern.h"
  1837. X#include "../include/round.h"
  1838. X
  1839. vptodevxy (x, y, outx, outy)
  1840. X    int             x, y;
  1841. X    int            *outx, *outy;
  1842. X{
  1843. float           tempx, tempy, temp;
  1844. X
  1845. X
  1846. X    tempx = (float) (x - xorigin) * xscale;
  1847. X    tempy = (float) (y - yorigin) * yscale;
  1848. X
  1849. X    temp = mxx * tempx + mxy * tempy;
  1850. X    tempy = myx * tempx + myy * tempy;
  1851. X    tempx = temp;
  1852. X
  1853. X    tempx = tempx * hdevscale + dev_xmin + hshift;
  1854. X    tempy = tempy * vdevscale + dev_ymin + vshift;
  1855. X
  1856. X    *outx = ROUND (tempx);
  1857. X    *outy = ROUND (tempy);
  1858. X}
  1859. X
  1860. vptodevw (x1, y1, x2, y2, x1out, y1out, x2out, y2out)
  1861. X    int             x1, y1, x2, y2;
  1862. X    int            *x1out, *y1out, *x2out, *y2out;
  1863. X{
  1864. int             x11, y11, x12, y12, x21, y21, x22, y22, a, b;
  1865. X
  1866. X    vptodevxy (x1, y1, &x11, &y11);
  1867. X    vptodevxy (x1, y2, &x12, &y12);
  1868. X    vptodevxy (x2, y1, &x21, &y21);
  1869. X    vptodevxy (x2, y2, &x22, &y22);
  1870. X
  1871. X    a = (x11 > x12 ? x11 : x12);
  1872. X    b = (x22 > x21 ? x22 : x21);
  1873. X    *x2out = (a > b ? a : b);
  1874. X
  1875. X    a = (y11 > y12 ? y11 : y12);
  1876. X    b = (y22 > y21 ? y22 : y21);
  1877. X    *y2out = (a > b ? a : b);
  1878. X
  1879. X    a = (x11 < x12 ? x11 : x12);
  1880. X    b = (x22 < x21 ? x22 : x21);
  1881. X    *x1out = (a < b ? a : b);
  1882. X
  1883. X    a = (y11 < y12 ? y11 : y12);
  1884. X    b = (y22 < y21 ? y22 : y21);
  1885. X    *y1out = (a < b ? a : b);
  1886. X}
  1887. X
  1888. devtovpxy (x, y, outx, outy)
  1889. X    int             x, y;
  1890. X    int            *outx, *outy;
  1891. X{
  1892. float           tempx, tempy, temp;
  1893. X
  1894. X    tempx = (float) (x - dev_xmin - hshift) / hdevscale;
  1895. X    tempy = (float) (y - dev_ymin - vshift) / vdevscale;
  1896. X
  1897. X    temp = mxx * tempx - mxy * tempy;
  1898. X    tempy = -myx * tempx + myy * tempy;
  1899. X    tempx = temp;
  1900. X
  1901. X    tempx = tempx / xscale + xorigin;
  1902. X    tempy = tempy / yscale + yorigin;
  1903. X
  1904. X    *outx = ROUND (tempx);
  1905. X    *outy = ROUND (tempy);
  1906. X}
  1907. X
  1908. devtovpw (x1, y1, x2, y2, x1out, y1out, x2out, y2out)
  1909. X    int             x1, y1, x2, y2;
  1910. X    int            *x1out, *y1out, *x2out, *y2out;
  1911. X{
  1912. int             x11, y11, x12, y12, x21, y21, x22, y22, a, b;
  1913. X
  1914. X    devtovpxy (x1, y1, &x11, &y11);
  1915. X    devtovpxy (x1, y2, &x12, &y12);
  1916. X    devtovpxy (x2, y1, &x21, &y21);
  1917. X    devtovpxy (x2, y2, &x22, &y22);
  1918. X
  1919. X    a = (x11 > x12 ? x11 : x12);
  1920. X    b = (x22 > x21 ? x22 : x21);
  1921. X    *x2out = (a > b ? a : b);
  1922. X
  1923. X    a = (y11 > y12 ? y11 : y12);
  1924. X    b = (y22 > y21 ? y22 : y21);
  1925. X    *y2out = (a > b ? a : b);
  1926. X
  1927. X    a = (x11 < x12 ? x11 : x12);
  1928. X    b = (x22 < x21 ? x22 : x21);
  1929. X    *x1out = (a < b ? a : b);
  1930. X
  1931. X    a = (y11 < y12 ? y11 : y12);
  1932. X    b = (y22 < y21 ? y22 : y21);
  1933. X    *y1out = (a < b ? a : b);
  1934. X}
  1935. END_OF_FILE
  1936. if test 3185 -ne `wc -c <'Vplot_Kernel/filters/utilities/vptodev.c'`; then
  1937.     echo shar: \"'Vplot_Kernel/filters/utilities/vptodev.c'\" unpacked with wrong size!
  1938. fi
  1939. # end of 'Vplot_Kernel/filters/utilities/vptodev.c'
  1940. fi
  1941. if test -f 'Vplot_Kernel/lvplot/fixcplot' -a "${1}" != "-c" ; then 
  1942.   echo shar: Will not clobber existing file \"'Vplot_Kernel/lvplot/fixcplot'\"
  1943. else
  1944. echo shar: Extracting \"'Vplot_Kernel/lvplot/fixcplot'\" \(3089 characters\)
  1945. sed "s/^X//" >'Vplot_Kernel/lvplot/fixcplot' <<'END_OF_FILE'
  1946. X#!/bin/csh
  1947. X# fixcplot: a sed script to change cplotlib function names to the
  1948. X#           newer vplotlib names.
  1949. X#
  1950. X# keywords: vplot fix vplotlib update
  1951. X#
  1952. if ($#argv == 0) then
  1953. X    echo "fixcplot, a shell to change archaic cplotlib function names"
  1954. X    echo "to their new forms. The original file is kept in .Boriginal_file"
  1955. X    echo "Usage: fixcplot file_name"
  1956. exit
  1957. endif
  1958. X
  1959. cp $1 .B$1
  1960. expand < .B$1 | sed \
  1961. X    -e 's/ window[ ]*(/ vp_clip (/g'\
  1962. X    -e 's/ windo[ ]*(/ vp_clip (/g'\
  1963. X    -e 's/ where[ ]*(/ vp_where (/g'\
  1964. X    -e 's/ uwindow[ ]*(/ vp_uclip (/g'\
  1965. X    -e 's/ uwindo[ ]*(/ vp_uclip (/g'\
  1966. X    -e 's/ setfn[ ]*(/ vp_file (/g'\
  1967. X    -e 's/ setfp[ ]*(/ vp_filep (/g'\
  1968. X    -e 's/ set0[ ]*(/ vp_orig (/g'\
  1969. X    -e 's/ setu0[ ]*(/ vp_uorig (/g'\
  1970. X    -e 's/ setcol[ ]*(/ vp_color (/g'\
  1971. X    -e 's/ setscl[ ]*(/ vp_scale (/g'\
  1972. X    -e 's/ setdash[ ]*(/ vp_dash (/g'\
  1973. X    -e 's/ text[ ]*(\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\))/ vp_text (\1,\2,\3,90*(\4),\5)/g'\
  1974. X    -e 's/ utext[ ]*(\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\))/ vp_utext (\1,\2,\3,90*(\4),\5)/g'\
  1975. X    -e 's/ Text[ ]*(/ vp_text (/g'\
  1976. X    -e 's/ uText[ ]*(/ vp_utext (/g'\
  1977. X    -e 's/ arrow[ ]*(/ vp_arrow (/g'\
  1978. X    -e 's/ uarrow[ ]*(/ vp_uarrow (/g'\
  1979. X    -e 's/ area[ ]*(/ vp_area (/g'\
  1980. X    -e 's/ uarea[ ]*(/ vp_uarea (/g'\
  1981. X    -e 's/ draw[ ]*(/ vp_draw (/g'\
  1982. X    -e 's/ udraw[ ]*(/ vp_udraw (/g'\
  1983. X    -e 's/ endplot[ ]*(/ vp_endplot (/g'\
  1984. X    -e 's/ endplt[ ]*(/ vp_endplot (/g'\
  1985. X    -e 's/ erase[ ]*(/ vp_erase (/g'\
  1986. X    -e 's/ move[ ]*(/ vp_move (/g'\
  1987. X    -e 's/ umove[ ]*(/ vp_umove (/g'\
  1988. X    -e 's/ pendn[ ]*(/ vp_pendn (/g'\
  1989. X    -e 's/ upendn[ ]*(/ vp_upendn (/g'\
  1990. X    -e 's/ penup[ ]*(/ vp_penup (/g'\
  1991. X    -e 's/ plot[ ]*(/ vp_plot (/g'\
  1992. X    -e 's/ uplot[ ]*(/ vp_uplot (/g'\
  1993. X    -e 's/ purge_plot[ ]*(/ vp_purge (/g'\
  1994. X    -e 's/ setfat[ ]*(/ vp_fat (/g'\
  1995. X    -e 's/ setovl[ ]*(/ vp_overlay (/g' \
  1996. X    -e 's/^window[ ]*(/vp_clip (/'\
  1997. X    -e 's/^windo[ ]*(/vp_clip (/'\
  1998. X    -e 's/^where[ ]*(/vp_where (/'\
  1999. X    -e 's/^uwindow[ ]*(/vp_uclip (/'\
  2000. X    -e 's/^uwindo[ ]*(/vp_uclip (/'\
  2001. X    -e 's/^setfn[ ]*(/vp_file (/'\
  2002. X    -e 's/^setfp[ ]*(/vp_filep (/'\
  2003. X    -e 's/^set0[ ]*(/vp_orig (/'\
  2004. X    -e 's/^setu0[ ]*(/vp_uorig (/'\
  2005. X    -e 's/^setcol[ ]*(/vp_color (/'\
  2006. X    -e 's/^setscl[ ]*(/vp_scale (/'\
  2007. X    -e 's/^setdash[ ]*(/vp_dash (/'\
  2008. X    -e 's/^text[ ]*(\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\))/vp_text (\1,\2,\3,90*(\4),\5)/'\
  2009. X    -e 's/^utext[ ]*(\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\))/vp_utext (\1,\2,\3,90*(\4),\5)/'\
  2010. X    -e 's/^Text[ ]*(/vp_text (/'\
  2011. X    -e 's/^uText[ ]*(/vp_utext (/'\
  2012. X    -e 's/^arrow[ ]*(/vp_arrow (/'\
  2013. X    -e 's/^uarrow[ ]*(/vp_uarrow (/'\
  2014. X    -e 's/^area[ ]*(/vp_area (/'\
  2015. X    -e 's/^uarea[ ]*(/vp_uarea (/'\
  2016. X    -e 's/^draw[ ]*(/vp_draw (/'\
  2017. X    -e 's/^udraw[ ]*(/vp_udraw (/'\
  2018. X    -e 's/^endplot[ ]*(/vp_endplot (/'\
  2019. X    -e 's/^endplt[ ]*(/vp_endplot (/'\
  2020. X    -e 's/^erase[ ]*(/vp_erase (/'\
  2021. X    -e 's/^move[ ]*(/vp_move (/'\
  2022. X    -e 's/^umove[ ]*(/vp_umove (/'\
  2023. X    -e 's/^pendn[ ]*(/vp_pendn (/'\
  2024. X    -e 's/^upendn[ ]*(/vp_upendn (/'\
  2025. X    -e 's/^penup[ ]*(/vp_penup (/'\
  2026. X    -e 's/^plot[ ]*(/vp_plot (/'\
  2027. X    -e 's/^uplot[ ]*(/vp_uplot (/'\
  2028. X    -e 's/^purge_plot[ ]*(/vp_purge (/'\
  2029. X    -e 's/^setfat[ ]*(/vp_fat (/'\
  2030. X    -e 's/^setovl[ ]*(/vp_overlay (/' \
  2031. X| unexpand > $1
  2032. END_OF_FILE
  2033. if test 3089 -ne `wc -c <'Vplot_Kernel/lvplot/fixcplot'`; then
  2034.     echo shar: \"'Vplot_Kernel/lvplot/fixcplot'\" unpacked with wrong size!
  2035. fi
  2036. chmod +x 'Vplot_Kernel/lvplot/fixcplot'
  2037. # end of 'Vplot_Kernel/lvplot/fixcplot'
  2038. fi
  2039. if test -f 'Vplot_Kernel/lvplot/vp_plot.c' -a "${1}" != "-c" ; then 
  2040.   echo shar: Will not clobber existing file \"'Vplot_Kernel/lvplot/vp_plot.c'\"
  2041. else
  2042. echo shar: Extracting \"'Vplot_Kernel/lvplot/vp_plot.c'\" \(3100 characters\)
  2043. sed "s/^X//" >'Vplot_Kernel/lvplot/vp_plot.c' <<'END_OF_FILE'
  2044. X/*
  2045. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  2046. X * University. Official permission to use this software is included in
  2047. X * the documentation. It authorizes you to use this file for any
  2048. X * non-commercial purpose, provided that this copyright notice is not
  2049. X * removed and that any modifications made to this file are commented
  2050. X * and dated in the style of my example below.
  2051. X */
  2052. X
  2053. X/*
  2054. X *
  2055. X *  source file:   ./lvplot/vp_plot.c
  2056. X *
  2057. X * Joe Dellinger (SEP), June 11 1987
  2058. X *    Inserted this sample edit history entry.
  2059. X *    Please log any further modifications made to this file:
  2060. X * Joe Dellinger Jan 14 1988
  2061. X *    Do rounding (not truncation) before output.
  2062. X */
  2063. X
  2064. X#ifndef FORTRAN
  2065. X#include <stdio.h>
  2066. X#include <vplot.h>
  2067. X#include "round.h"
  2068. X#include "vp_pc.h"
  2069. X
  2070. PC              vp_pc =
  2071. X{
  2072. X 0.0, 0.0,
  2073. X 0.0, 0.0,
  2074. X 1.0, 1.0,
  2075. X 0.0, 0.0,
  2076. X 0.0,
  2077. X 0.0, 0.0, 0.0, 0.0,
  2078. X 0,
  2079. X 0,
  2080. X stdout,
  2081. X TH_NORMAL, TV_NORMAL,
  2082. X NO_CHANGE, NO_CHANGE, NO_CHANGE,
  2083. X};
  2084. X
  2085. vp_plot (x, y, down)
  2086. X    float           x, y;
  2087. X    int             down;
  2088. X{
  2089. float           dx, dy, dist, dpos, xp, yp, tonext, cosine, sine;
  2090. int             i;
  2091. double          p_fmod (), sqrt ();
  2092. X
  2093. X    if (!down || !vp_pc._dashon)    /* if move or no dashes */
  2094. X    {
  2095. X    p_pout (x, y, down, vp_pc._pltout);    /* output a move or draw */
  2096. X    vp_pc._xold = x;
  2097. X    vp_pc._yold = y;        /* save old x and y */
  2098. X    vp_pc._dpos = 0.0;        /* reset position in dashes */
  2099. X    return;
  2100. X    }
  2101. X    dx = x - vp_pc._xold;
  2102. X    dy = y - vp_pc._yold;        /* change in x and y */
  2103. X    dist = sqrt (dx * dx + dy * dy);    /* distance */
  2104. X    if (dist <= 0.)
  2105. X    return;            /* return if no change */
  2106. X    cosine = dx / dist;
  2107. X    sine = dy / dist;
  2108. X    dpos = vp_pc._dpos;        /* current position in dashes */
  2109. X    vp_pc._dpos = p_fmod (dpos + dist, vp_pc._ddef[3]);    /* next position in
  2110. X                             * dashes */
  2111. X    for (i = 0; i < 4 && vp_pc._ddef[i] <= dpos; i++);    /* index to dash def */
  2112. X    xp = vp_pc._xold;
  2113. X    yp = vp_pc._yold;        /* initialize xp and yp */
  2114. X    while (dist > 0.0)
  2115. X    {
  2116. X    tonext = vp_pc._ddef[i] - dpos;    /* dist to next gap or dash */
  2117. X    if (tonext > dist)
  2118. X        tonext = dist;
  2119. X    xp += tonext * cosine;
  2120. X    yp += tonext * sine;
  2121. X    p_pout (xp, yp, !(i % 2), vp_pc._pltout);
  2122. X    dpos = vp_pc._ddef[i];    /* new position */
  2123. X    i = (i + 1) % 4;    /* i = 0,1,2, or 3 */
  2124. X    if (i == 0)
  2125. X        dpos = 0.0;        /* back to start of dashes */
  2126. X    dist -= tonext;
  2127. X    }
  2128. X    vp_pc._xold = xp;
  2129. X    vp_pc._yold = yp;
  2130. X}
  2131. X
  2132. p_pout (xp, yp, down, plt)
  2133. X    float           xp, yp;
  2134. X    int             down;
  2135. X    FILE           *plt;
  2136. X{
  2137. int             ix, iy;
  2138. X    xp = (xp > VP_MAX) ? VP_MAX : xp;
  2139. X    xp = (xp < -VP_MAX) ? -VP_MAX : xp;
  2140. X    yp = (yp > VP_MAX) ? VP_MAX : yp;
  2141. X    yp = (yp < -VP_MAX) ? -VP_MAX : yp;
  2142. X    ix = ROUND (xp * RPERIN);
  2143. X    iy = ROUND (yp * RPERIN);
  2144. X    putc ((down ? VP_DRAW : VP_MOVE), plt);
  2145. X    puth (ix, plt);
  2146. X    puth (iy, plt);
  2147. X}
  2148. X
  2149. static double
  2150. p_fmod (x, y)
  2151. X    float           x, y;
  2152. X{
  2153. double          floor ();
  2154. X    return (x - floor (x / y) * y);
  2155. X}
  2156. X
  2157. X#else
  2158. X
  2159. X#include <stdio.h>
  2160. X#include <vplot.h>
  2161. X#include "vp_pc.h"
  2162. X
  2163. vpplot_ (x, y, down)
  2164. X    float          *x, *y;
  2165. X    int            *down;
  2166. X{
  2167. X    vp_plot (*x, *y, *down);
  2168. X}
  2169. X#endif
  2170. END_OF_FILE
  2171. if test 3100 -ne `wc -c <'Vplot_Kernel/lvplot/vp_plot.c'`; then
  2172.     echo shar: \"'Vplot_Kernel/lvplot/vp_plot.c'\" unpacked with wrong size!
  2173. fi
  2174. # end of 'Vplot_Kernel/lvplot/vp_plot.c'
  2175. fi
  2176. echo shar: End of archive 11 \(of 24\).
  2177. cp /dev/null ark11isdone
  2178. MISSING=""
  2179. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ; do
  2180.     if test ! -f ark${I}isdone ; then
  2181.     MISSING="${MISSING} ${I}"
  2182.     fi
  2183. done
  2184. if test "${MISSING}" = "" ; then
  2185.     echo You have unpacked all 24 archives.
  2186.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2187. else
  2188.     echo You still need to unpack the following archives:
  2189.     echo "        " ${MISSING}
  2190. fi
  2191. ##  End of shell archive.
  2192. exit 0
  2193.