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

  1. Subject:  v14i017:  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 17
  8. Archive-name: vplot/part12
  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 12 (of 24)."
  17. # Wrapped by rsalz@fig.bbn.com on Fri Mar 25 11:47:16 1988
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. if test -f 'Printronix_device/lprlib/lprvector.c' -a "${1}" != "-c" ; then 
  20.   echo shar: Will not clobber existing file \"'Printronix_device/lprlib/lprvector.c'\"
  21. else
  22. echo shar: Extracting \"'Printronix_device/lprlib/lprvector.c'\" \(4223 characters\)
  23. sed "s/^X//" >'Printronix_device/lprlib/lprvector.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/lprlib/lprvector.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 <stdio.h>
  43. X#include "lprpen.h"
  44. X#include "../include/err.h"
  45. X#include "../include/enum.h"
  46. X#include "../include/extern.h"
  47. X
  48. X/*
  49. X * Vector rasterizes the line defined by the endpoints (x1,y1) and (x2,y2).
  50. X */
  51. X
  52. extern int      lpr_color;
  53. X
  54. lprvector (x1, y1, x2, y2, nfat, dashon)
  55. X    int             x1, y1, x2, y2, nfat, dashon;
  56. X{
  57. register int    test, bit, dx2, dy2, len;
  58. register short *psec;
  59. int             dx, dy, i;
  60. X
  61. X    if (nfat < 0)
  62. X    return;
  63. X
  64. X    if (dashon)
  65. X    {
  66. X    dashvec (x1, y1, x2, y2, nfat, dashon);
  67. X    return;
  68. X    }
  69. X
  70. X    if (nfat)
  71. X    {
  72. X    fatvec (x1, y1, x2, y2, nfat, dashon);
  73. X    return;
  74. X    }
  75. X
  76. X    if (clip (&x1, &y1, &x2, &y2))
  77. X    return;
  78. X
  79. X    if (x2 >= xlimit)
  80. X    {
  81. X    /*
  82. X     * Try expanding memory. If it fails take what we can get and
  83. X     * rewindow the vector. Expand will print a warning message. 
  84. X     */
  85. X    if (expand (x2) <= x2)
  86. X        if (clip (&x1, &y1, &x2, &y2))
  87. X        return;
  88. X    }
  89. X    dx = (x2 > x1 ? x2 - x1 : x1 - x2);
  90. X    dy = (y2 > y1 ? y2 - y1 : y1 - y2);
  91. X    dx2 = dx << 1;
  92. X    dy2 = dy << 1;
  93. X    if (((dx < dy) && (y1 > y2)) || ((dx >= dy) && (x1 > x2)))
  94. X    {
  95. X    test = x1;
  96. X    x1 = x2;
  97. X    x2 = test;        /* swap endpoints to make */
  98. X    test = y1;
  99. X    y1 = y2;
  100. X    y2 = test;        /* intervals positive  */
  101. X    }
  102. X    psec = mem + x1 * NYW + (y1 >> 4);
  103. X    bit = 0100000 >> (y1 & 017);
  104. X    if (lpr_color > 0)
  105. X    *psec |= bit;        /* plot first point */
  106. X    else
  107. X    *psec &= ~bit;        /* plot first point */
  108. X
  109. X    if (dx >= dy)        /* plot y = f(x)  */
  110. X    {
  111. X    len = dx;
  112. X    test = len - dy2;
  113. X    if (y2 > y1)
  114. X    {
  115. X        while (len--)
  116. X        {
  117. X        psec += NYW;
  118. X        if (test <= 0)    /* test for y increment */
  119. X        {
  120. X            if ((bit = (bit >> 1)) == 0)
  121. X            {
  122. X            bit = 0100000;
  123. X            psec++;
  124. X            }
  125. X            test += dx2;
  126. X        }
  127. X        if (lpr_color > 0)
  128. X            *psec |= bit;
  129. X        else
  130. X            *psec &= ~bit;
  131. X        test -= dy2;
  132. X        }
  133. X    }
  134. X    else
  135. X    {
  136. X        while (len--)
  137. X        {
  138. X        psec += NYW;
  139. X        if (test <= 0)    /* test for y increment */
  140. X        {
  141. X            if ((bit = (bit << 1)) == 0200000)
  142. X            {
  143. X            bit = 01;
  144. X            psec--;
  145. X            }
  146. X            test += dx2;
  147. X        }
  148. X        if (lpr_color > 0)
  149. X            *psec |= bit;
  150. X        else
  151. X            *psec &= ~bit;
  152. X        test -= dy2;
  153. X        }
  154. X    }
  155. X    }
  156. X    else            /* plot x = f(y)  */
  157. X    {
  158. X    len = dy;
  159. X    test = len - dx2;
  160. X    if (x2 > x1)
  161. X    {
  162. X        while (len--)
  163. X        {
  164. X        if (test <= 0)    /* test for x increment */
  165. X        {
  166. X            psec += NYW;
  167. X            test += dy2;
  168. X        }
  169. X        if ((bit = (bit >> 1)) == 0)
  170. X        {
  171. X            bit = 0100000;
  172. X            psec++;
  173. X        }
  174. X        if (lpr_color > 0)
  175. X            *psec |= bit;
  176. X        else
  177. X            *psec &= ~bit;
  178. X        test -= dx2;
  179. X        }
  180. X    }
  181. X    else
  182. X    {
  183. X        while (len--)
  184. X        {
  185. X        if (test <= 0)    /* test for x increment */
  186. X        {
  187. X            psec -= NYW;
  188. X            test += dy2;
  189. X        }
  190. X        if ((bit = (bit >> 1)) == 0)
  191. X        {
  192. X            bit = 0100000;
  193. X            psec++;
  194. X        }
  195. X        if (lpr_color > 0)
  196. X            *psec |= bit;
  197. X        else
  198. X            *psec &= ~bit;
  199. X        test -= dx2;
  200. X        }
  201. X    }
  202. X    }
  203. X}
  204. X
  205. X/*
  206. X * expand memory in units of 2*NYW*XINCSZ bytes.
  207. X * If we fail to get more memory then use what
  208. X * already have and set the window.
  209. X */
  210. expand (x)
  211. X    int             x;
  212. X{
  213. int             xinc, desired, newxlimit, newsize;
  214. short          *memhold;
  215. char           *realloc ();
  216. X
  217. X    xinc = ((x + XINCSZ) / XINCSZ) * XINCSZ - xlimit;
  218. X    desired = xinc;
  219. X    while (xinc > 0)
  220. X    {
  221. X    newsize = 2 * (xlimit + xinc) * NYW;
  222. X    memhold = mem;
  223. X    mem = (short *) realloc (memhold, newsize);
  224. X    if (mem != NULL)
  225. X        break;
  226. X    mem = memhold;
  227. X    xinc -= XINCSZ;
  228. X    }
  229. X    newxlimit = xlimit + xinc;
  230. X    if (xinc < desired)
  231. X    {
  232. X    ERR (WARN, name,
  233. X         "cannot expand memory. Plot limited to %6.2f inches",
  234. X         (float) (newxlimit / 200.0));
  235. X    /* stop requests for more memory */
  236. X    xwmax = newxlimit - 1;
  237. X    }
  238. X    zap (&mem[xlimit * NYW], xinc);
  239. X    xlimit = newxlimit;
  240. X    return (xlimit);
  241. X}
  242. END_OF_FILE
  243. if test 4223 -ne `wc -c <'Printronix_device/lprlib/lprvector.c'`; then
  244.     echo shar: \"'Printronix_device/lprlib/lprvector.c'\" unpacked with wrong size!
  245. fi
  246. # end of 'Printronix_device/lprlib/lprvector.c'
  247. fi
  248. if test -f 'Virtual_device/vplib/vpattr.c' -a "${1}" != "-c" ; then 
  249.   echo shar: Will not clobber existing file \"'Virtual_device/vplib/vpattr.c'\"
  250. else
  251. echo shar: Extracting \"'Virtual_device/vplib/vpattr.c'\" \(4864 characters\)
  252. sed "s/^X//" >'Virtual_device/vplib/vpattr.c' <<'END_OF_FILE'
  253. X/*
  254. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  255. X * University. Official permission to use this software is included in
  256. X * the documentation. It authorizes you to use this file for any
  257. X * non-commercial purpose, provided that this copyright notice is not
  258. X * removed and that any modifications made to this file are commented
  259. X * and dated in the style of my example below.
  260. X */
  261. X
  262. X/*
  263. X *
  264. X *  source file:   ./filters/vplib/vpattr.c
  265. X *
  266. X * Joe Dellinger (SEP), Dec 19 1987
  267. X *    Inserted this sample edit history entry.
  268. X *    Please log any further modifications made to this file:
  269. X */
  270. X
  271. X#include <stdio.h>
  272. X#include <vplot.h>
  273. X#include "../include/attrcom.h"
  274. X#include "../include/params.h"
  275. X#include "../include/extern.h"
  276. X#include "../include/round.h"
  277. X#include "../include/enum.h"
  278. X#include "../include/pat.h"
  279. X#include "vp.h"
  280. X
  281. int             vpcolor = WHITE;
  282. int             vpfat = 0;
  283. X
  284. vpattributes (command, value, v1, v2, v3)
  285. X    int             command, value;
  286. X    int             v1, v2, v3;
  287. X{
  288. static float    vpdash[MAXDASH];
  289. static float    vpgap[MAXDASH];
  290. static int      vpndash;
  291. static int     *vpattrarray;
  292. static int      vpxwmin, vpywmin, vpxwmax, vpywmax;
  293. static int      vpfont1, vpfont2, vpfont3;
  294. static int      vpjust1, vpjust2;
  295. static int      vpcolt1, vpcolt2, vpcolt3, vpcolt4;
  296. static int      vpovly;
  297. int             ii, jj;
  298. X
  299. X    lost = YES;
  300. X
  301. X    if (!vpdumb)
  302. X    {
  303. X    switch (command)
  304. X    {
  305. X    case SET_COLOR:
  306. X        if (vpsetflag & F_COL)
  307. X        {
  308. X        if (vpcolor == value)
  309. X            break;
  310. X        }
  311. X        vp_color (value);
  312. X        vpcolor = value;
  313. X        vpsetflag |= F_COL;
  314. X        break;
  315. X
  316. X    case SET_COLOR_TABLE:
  317. X        if (vpsetflag & F_COLT)
  318. X        {
  319. X        if (vpcolt1 == value &&
  320. X            vpcolt2 == v1 &&
  321. X            vpcolt3 == v2 &&
  322. X            vpcolt4 == v3)
  323. X            break;
  324. X        }
  325. X        vp_coltab (value,
  326. X               (float) v1 / (float) MAX_GUN,
  327. X               (float) v2 / (float) MAX_GUN,
  328. X               (float) v3 / (float) MAX_GUN);
  329. X        vpcolt1 = value;
  330. X        vpcolt2 = v1;
  331. X        vpcolt3 = v2;
  332. X        vpcolt4 = v3;
  333. X        vpsetflag |= F_COLT;
  334. X        break;
  335. X
  336. X    case SET_WINDOW:
  337. X
  338. X        if (vpsetflag & F_CLIP)
  339. X        {
  340. X        if (value == vpxwmin &&
  341. X            v1 == vpywmin &&
  342. X            v2 == vpxwmax &&
  343. X            v3 == vpywmax)
  344. X            break;
  345. X        }
  346. X
  347. X        vp_clip ((float) (value) / RPERIN, (float) (v1) / RPERIN,
  348. X             (float) (v2) / RPERIN, (float) (v3) / RPERIN);
  349. X        vpxwmin = value;
  350. X        vpywmin = v1;
  351. X        vpxwmax = v2;
  352. X        vpywmax = v3;
  353. X        vpsetflag |= F_CLIP;
  354. X        break;
  355. X
  356. X    case NEW_DASH:
  357. X        if (vpsetflag & F_DASH)
  358. X        {
  359. X        if (value == vpndash)
  360. X        {
  361. X            jj = YES;
  362. X            for (ii = 0; ii < value; ii++)
  363. X            {
  364. X            if (vpdash[ii] != dashes[2 * ii] ||
  365. X                vpgap[ii] != dashes[2 * ii + 1])
  366. X                jj = NO;
  367. X            }
  368. X            if (jj)
  369. X            break;
  370. X        }
  371. X        }
  372. X
  373. X        for (ii = 0; ii < value; ii++)
  374. X        {
  375. X        vpdash[ii] = dashes[2 * ii];
  376. X        vpgap[ii] = dashes[2 * ii + 1];
  377. X        }
  378. X        vp_setdash (vpdash, vpgap, value);
  379. X        vpndash = value;
  380. X        vpsetflag |= F_DASH;
  381. X        break;
  382. X
  383. X    case NEW_PAT:
  384. X        vpattrarray = (int *) malloc ((unsigned)
  385. X              (pat[value] .xdim * pat[value] .ydim * sizeof (int)));
  386. X
  387. X        if (vpattrarray != NULL)
  388. X        {
  389. X        for (ii = 0; ii < pat[value] .xdim * pat[value] .ydim; ii++)
  390. X            vpattrarray[ii] = pat[value] .patbits[ii];
  391. X
  392. X        vp_patload ((int) RPERIN,
  393. X                pat[value] .xdim, pat[value] .ydim,
  394. X                value - 1, vpattrarray);
  395. X
  396. X        free ((char *) vpattrarray);
  397. X        }
  398. X        break;
  399. X
  400. X    case NEW_FONT:
  401. X        if (value == -1)
  402. X        value = vpfont1;
  403. X        if (v1 == -1)
  404. X        v1 = vpfont2;
  405. X        if (v2 == -1)
  406. X        v2 = vpfont3;
  407. X
  408. X        if (vpsetflag & F_FONT)
  409. X        {
  410. X        if (vpfont1 == value &&
  411. X            vpfont2 == v1 &&
  412. X            vpfont3 == v2)
  413. X            break;
  414. X        }
  415. X
  416. X        vp_tfont (value, v1, v2);
  417. X        vpfont1 = value;
  418. X        vpfont2 = v1;
  419. X        vpfont3 = v2;
  420. X        vpsetflag |= F_FONT;
  421. X        break;
  422. X
  423. X    case NEW_OVERLAY:
  424. X        if (vpsetflag & F_OVLY)
  425. X        {
  426. X        if (vpovly == value)
  427. X            break;
  428. X        }
  429. X/*
  430. X * Another libvplot command that doesn't exist but should.
  431. X * XXXXXX
  432. X *        vp_overlay(value);
  433. X */
  434. X        vpsetflag |= F_OVLY;
  435. X        vpovly = value;
  436. X        break;
  437. X
  438. X    case NEW_ALIGN:
  439. X        if (vpsetflag & F_JUST)
  440. X        {
  441. X        if (vpjust1 == value &&
  442. X            vpjust2 == v1)
  443. X            break;
  444. X        }
  445. X        vp_tjust (value, v1);
  446. X        vpjust1 = value;
  447. X        vpjust2 = v1;
  448. X        vpsetflag |= F_JUST;
  449. X        break;
  450. X
  451. X    case NEW_FAT:
  452. X        if (vpsetflag & F_FAT)
  453. X        {
  454. X        if (vpfat == value)
  455. X            break;
  456. X        }
  457. X
  458. X        vp_fat (ROUND (value * FATPERIN / RPERIN));
  459. X        vpfat = value;
  460. X        vpsetflag |= F_FAT;
  461. X        break;
  462. X
  463. X    case BEGIN_GROUP:
  464. X        if (value > 0)
  465. X        vp_bgroup (group_name);
  466. X        break;
  467. X
  468. X    case END_GROUP:
  469. X        if (value > 0)
  470. X        vp_egroup ();
  471. X        break;
  472. X
  473. X    default:
  474. X        break;
  475. X    }
  476. X    }
  477. X    else
  478. X    {
  479. X    switch (command)
  480. X    {
  481. X    case SET_COLOR:
  482. X        if (vpsetflag & F_COL)
  483. X        {
  484. X        if (vpcolor == value)
  485. X            break;
  486. X        }
  487. X        vp_color (value);
  488. X        vpcolor = value;
  489. X        vpsetflag |= F_COL;
  490. X        break;
  491. X
  492. X    default:
  493. X        break;
  494. X    }
  495. X    }
  496. X
  497. X    return 0;
  498. X}
  499. END_OF_FILE
  500. if test 4864 -ne `wc -c <'Virtual_device/vplib/vpattr.c'`; then
  501.     echo shar: \"'Virtual_device/vplib/vpattr.c'\" unpacked with wrong size!
  502. fi
  503. # end of 'Virtual_device/vplib/vpattr.c'
  504. fi
  505. if test -f 'Virtual_device/vplib/vpopen.c' -a "${1}" != "-c" ; then 
  506.   echo shar: Will not clobber existing file \"'Virtual_device/vplib/vpopen.c'\"
  507. else
  508. echo shar: Extracting \"'Virtual_device/vplib/vpopen.c'\" \(4172 characters\)
  509. sed "s/^X//" >'Virtual_device/vplib/vpopen.c' <<'END_OF_FILE'
  510. X/*
  511. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  512. X * University. Official permission to use this software is included in
  513. X * the documentation. It authorizes you to use this file for any
  514. X * non-commercial purpose, provided that this copyright notice is not
  515. X * removed and that any modifications made to this file are commented
  516. X * and dated in the style of my example below.
  517. X */
  518. X
  519. X/*
  520. X *
  521. X *  source file:   ./filters/vplib/vpopen.c
  522. X *
  523. X * Joe Dellinger (SEP), Dec 19 1987
  524. X *    Inserted this sample edit history entry.
  525. X *    Please log any further modifications made to this file:
  526. X */
  527. X
  528. X#include <stdio.h>
  529. X#include <vplot.h>
  530. X#include "../include/enum.h"
  531. X#include "../include/extern.h"
  532. X#include "../include/err.h"
  533. X#include "../include/params.h"
  534. X#include "vp.h"
  535. X
  536. extern int
  537. vpopen (), vpreset (), vpmessage (), vperase (), vpclose ();
  538. extern int
  539. vpattributes (), vpvector (), vpplot ();
  540. extern int
  541. vpstartpoly (), vpmidpoly (), vpendpoly ();
  542. extern int
  543. vpraster (), vpmarker (), vptext ();
  544. extern int
  545. genarea (), genpoint ();
  546. extern int      nulldev ();
  547. X
  548. extern FILE    *pltout;
  549. X
  550. extern int      vp_do_dovplot ();
  551. extern int      (*genreader) ();
  552. extern int      allow_pipe;
  553. extern int      first_time;
  554. X
  555. int             vpbig = YES;
  556. int             vpdumb = NO;
  557. int             vpstat = NO;
  558. int             vpalign = NO;
  559. int             vpstyle = YES;
  560. int             vpblast = YES;
  561. int             vpbit = 0;
  562. char            vpaligns[80] = "uu";
  563. int             vparray[2] = {0, 0};
  564. int             vpasize[2] = {0, 0};
  565. int             vpframe = -1;
  566. X
  567. int             vpsetflag;
  568. X
  569. vpopen ()
  570. X{
  571. float           atemp[2];
  572. X
  573. X    first_time = YES;
  574. X
  575. X/*
  576. X * Special options
  577. X */
  578. X    getpar ("dumb", "1", &vpdumb);
  579. X    getpar ("blast", "1", &vpblast);
  580. X    getpar ("bit", "d", &vpbit);
  581. X    getpar ("grid", "d", &vpframe);
  582. X
  583. X    getpar ("stat", "1", &vpstat);
  584. X    getpar ("align", "s", vpaligns);
  585. X
  586. X    if (vpstat || strcmp (vpaligns, "uu") != 0)
  587. X    {
  588. X    vpalign = YES;
  589. X    allow_pipe = NO;
  590. X    }
  591. X
  592. X    getpar ("gridnum", "d", vparray);
  593. X
  594. X    if (vparray[1] == 0)
  595. X    vparray[1] = vparray[0];
  596. X
  597. X    if (vparray[0] != 0)
  598. X    {
  599. X    vpbig = NO;
  600. X    vpstyle = NO;
  601. X    }
  602. X
  603. X    getpar ("big", "1", &vpbig);
  604. X    getpar ("vpstyle", "1", &vpstyle);
  605. X
  606. X    if (vparray[0] != 0)
  607. X    {
  608. X    if (vpbig || vpalign)
  609. X        ERR (FATAL, name, "Incompatible option with gridnum");
  610. X    atemp[0] = (float) (STANDARD_HEIGHT / SCREEN_RATIO) / vparray[0];
  611. X    atemp[1] = (float) (STANDARD_HEIGHT) / vparray[1];
  612. X
  613. X    getpar ("gridsize", "f", atemp);
  614. X
  615. X    vpasize[0] = atemp[0] * RPERIN;
  616. X    vpasize[1] = atemp[1] * RPERIN;
  617. X    }
  618. X
  619. X
  620. X/*
  621. X * We want to go through the input files ourselves
  622. X */
  623. X
  624. X    genreader = vp_do_dovplot;
  625. X
  626. X/*
  627. X * device capabilities
  628. X */
  629. X
  630. X    if (vpbig)
  631. X    {
  632. X    dev_xmax = VP_MAX * RPERIN;
  633. X    dev_ymax = VP_MAX * RPERIN * SCREEN_RATIO;
  634. X    dev_xmin = -dev_xmax;
  635. X    dev_ymin = -dev_ymax;
  636. X    default_hshift = -dev_xmin;
  637. X    default_vshift = -dev_ymin;
  638. X    }
  639. X    else
  640. X    {
  641. X    dev_xmax = STANDARD_HEIGHT * RPERIN / SCREEN_RATIO;
  642. X    dev_ymax = STANDARD_HEIGHT * RPERIN;
  643. X    dev_xmin = 0;
  644. X    dev_ymin = 0;
  645. X    default_hshift = 0;
  646. X    default_vshift = 0;
  647. X    }
  648. X
  649. X    pixels_per_inch = RPERIN;
  650. X    aspect_ratio = 1.;
  651. X    num_col = 256;
  652. X    if (vparray[0] == 0)
  653. X    size = ABSOLUTE;
  654. X
  655. X
  656. X/*
  657. X * Since font gets hard-wired in after first pass,
  658. X * make it a nice one if they don't specify it.
  659. X */
  660. X    txfont = DEFAULT_HARDCOPY_FONT;
  661. X    txprec = DEFAULT_HARDCOPY_PREC;
  662. X
  663. X/*
  664. X * Make vplib routines more useful to be included in other programs
  665. X * besides just vppen
  666. X */
  667. X    dev.open = vpopen;
  668. X    dev.reset = vpreset;
  669. X    dev.message = vpmessage;
  670. X    dev.erase = vperase;
  671. X    dev.close = vpclose;
  672. X    dev.vector = vpvector;
  673. X    dev.marker = vpmarker;
  674. X    dev.text = vptext;
  675. X    dev.area = genarea;
  676. X    dev.raster = vpraster;
  677. X    dev.point = genpoint;
  678. X    dev.attributes = vpattributes;
  679. X    dev.getpoint = nulldev;
  680. X    dev.interact = nulldev;
  681. X    dev.plot = vpplot;
  682. X    dev.startpoly = vpstartpoly;
  683. X    dev.midpoly = vpmidpoly;
  684. X    dev.endpoly = vpendpoly;
  685. X
  686. X/*
  687. X * To keep messages from being lost
  688. X */
  689. X    message = dev.message;
  690. X
  691. X/*
  692. X * Open up the "device", if we're ever going to use libvplot at all.
  693. X */
  694. X    if (!vpstat)
  695. X    {
  696. X    vp_filep (pltout);
  697. X    }
  698. X
  699. X    allowecho = YES;
  700. X
  701. X}
  702. END_OF_FILE
  703. if test 4172 -ne `wc -c <'Virtual_device/vplib/vpopen.c'`; then
  704.     echo shar: \"'Virtual_device/vplib/vpopen.c'\" unpacked with wrong size!
  705. fi
  706. # end of 'Virtual_device/vplib/vpopen.c'
  707. fi
  708. if test -f 'Vplot_Kernel/Hershey/hertovplot.c' -a "${1}" != "-c" ; then 
  709.   echo shar: Will not clobber existing file \"'Vplot_Kernel/Hershey/hertovplot.c'\"
  710. else
  711. echo shar: Extracting \"'Vplot_Kernel/Hershey/hertovplot.c'\" \(4655 characters\)
  712. sed "s/^X//" >'Vplot_Kernel/Hershey/hertovplot.c' <<'END_OF_FILE'
  713. X/*
  714. X *
  715. X *  source file:   ./Hershey/hertovplot.c
  716. X *
  717. X * Joe Dellinger (SEP), June 11 1987
  718. X *    Inserted this sample edit history entry.
  719. X *    Please log any further modifications made to this file:
  720. X */
  721. X
  722. X/*
  723. X * This program converts the Hershey fonts in the form distributed with
  724. X * mod.sources into "Vplot fonts", given a ".hmp" file as the first argument.
  725. X * Here is a sample .hmp file, that for the font "romanc":
  726. X *
  727. X2199    2214    2217    2275    2274    2271    2272    2251
  728. X2221    2222    2219    2232    2211    2231    2210    2220
  729. X2200-2209
  730. X2212    2213    2241    2238    2242    2215    2273
  731. X2001-2026
  732. X2223    804     2224    2262    999     2252
  733. X2101-2126
  734. X2225    2229    2226    2246    2218
  735. X2177-2182
  736. X *
  737. X * It is simply a list of the Hershey glyphs to use in that font.
  738. X * For example, the first glyph would be number 2199, the second number 2214,
  739. X * etc, etc. As a shorthand convenience, the notation X-Y will give the
  740. X * inclusive range from number X to number Y. (2200-2209 are the glyphs for
  741. X * the digits, as you might expect.)
  742. X *
  743. X * The optional second argument (default 32) is an integer giving the
  744. X * ASCII value of the first character in the font. (Note that there CAN
  745. X * be more than 256 characters in a font!)
  746. X *
  747. X * For example,
  748. X * cat hersh.oc* | hershtovplot romanc.hmp 32 > romanc_font
  749. X *
  750. X * You have to go in yourself and add such information as the letter spacing,
  751. X * top height, bottom, etc, etc. The hershey fonts provide the left and right
  752. X * width data, which is used, but do not provide data about where to center
  753. X * the symbol vertically if it is used as a marker. This must be edited in
  754. X * by hand if the default calculated by "makefont" is unacceptable.
  755. X *
  756. X * SEE ALSO: makefont.c, a program which "packs" Vplot font files into
  757. X * ".include" fonts so that they can be included into font_definitions.h
  758. X *  and thus be used with "gentext.c". It also makes runtime-loadable
  759. X *  ".bin" fonts. It also gives the format of a vplot font in the comments
  760. X *  at the start of the source!
  761. X *
  762. X * - Joe Dellinger, Stanford University Dept of Geophysics
  763. X *
  764. X * Bits of this code are stolen from "hershey.c" by James Hurt.
  765. X *
  766. X */
  767. X
  768. X#include <stdio.h>
  769. X#include <strings.h>
  770. X
  771. X/*
  772. X * scanint: a function to scan an integer, using n characters of
  773. X *          the input file, ignoring newlines. (scanf won't work
  774. X *          because it also ignores blanks)
  775. X */
  776. int
  777. scanint (n)
  778. X    int             n;
  779. X{
  780. char            buf[20];
  781. int             i, c;
  782. X
  783. X    for (i = 0; i < n; i++)
  784. X    {
  785. X    while ((c = getchar ()) == '\n');    /* discard spare newlines */
  786. X    if (c == EOF)
  787. X        return (-1);
  788. X    buf[i] = c;
  789. X    }
  790. X
  791. X    buf[i] = 0;
  792. X    return (atoi (buf));
  793. X}
  794. X
  795. main (argc, argv)
  796. X    int             argc;
  797. X    char          **argv;
  798. X{
  799. int             ich, nch, i, j, x, y;
  800. int             font[32000];
  801. int             line[2][1000];
  802. int             move, ipnt;
  803. FILE           *fp;
  804. char            string[100];
  805. int             nc, start;
  806. X
  807. X    if (argc == 1)
  808. X    {
  809. X    fprintf (stderr, "Sorry, but you must specify a .hmp file for me to use\n");
  810. X    exit (1);
  811. X    }
  812. X    fp = fopen (argv[1], "r");
  813. X    if (fp == NULL)
  814. X    {
  815. X    fprintf (stderr, "Can't open the file %s.\n", argv[1]);
  816. X    exit (0);
  817. X    }
  818. X
  819. X    if (argc == 3)
  820. X    {
  821. X    start = atoi (argv[2]);
  822. X    }
  823. X    else
  824. X    start = 32;
  825. X
  826. X    nc = 0;
  827. X    i = 0;
  828. X    while (fscanf (fp, "%s", string) != EOF)
  829. X    {
  830. X    if (index (string, '-'))
  831. X    {
  832. X        for (j = atoi (string); j <= atoi (index (string, '-') + 1); j++)
  833. X        {
  834. X        font[i] = j;
  835. X        i++;
  836. X        nc++;
  837. X        }
  838. X    }
  839. X    else
  840. X    {
  841. X        font[i] = atoi (string);
  842. X        i++;
  843. X        nc++;
  844. X    }
  845. X    }
  846. X
  847. X    fprintf (stderr, "%d glyphs in this font.\n", nc);
  848. X
  849. X    while (1)
  850. X    {
  851. X    if ((ich = scanint (5)) < 1)
  852. X    {
  853. X        exit (0);
  854. X    }
  855. X    nch = scanint (3);
  856. X
  857. X    for (i = 0; i < nch; i++)
  858. X    {
  859. X        if ((i == 32) || (i == 68) || (i == 104) || (i == 140))
  860. X        getchar ();    /* skip newlines */
  861. X        line[0][i] = getchar ();
  862. X        line[1][i] = getchar ();
  863. X    }
  864. X    getchar ();
  865. X
  866. X    for (i = 0; i < nc; i++)
  867. X    {
  868. X        if (font[i] == ich)
  869. X        break;
  870. X    }
  871. X
  872. X    if (i < nc)
  873. X    {
  874. X        fprintf (stderr, "hershey=%d, place=%d\n", ich, i);
  875. X/*             .. left and right widths */
  876. X
  877. X        x = -((int) line[0][0] - (int) 'R');
  878. X        y = (int) line[1][0] - (int) 'R';
  879. X
  880. X        move = i + start;
  881. X        if (move >= '!' && move <= '~')
  882. X        printf ("e %d %d %c\n", x, y, move);
  883. X        else
  884. X        printf ("e %d %d \\%d\n", x, y, move);
  885. X
  886. X        move = 1;
  887. X        for (ipnt = 1; ipnt < nch; ipnt++)
  888. X        {
  889. X        if (line[0][ipnt] == ' ')
  890. X        {
  891. X            move = 1;
  892. X        }
  893. X        else
  894. X        {
  895. X            x = (int) line[0][ipnt] - (int) 'R';
  896. X            y = (int) line[1][ipnt] - (int) 'R';
  897. X            if (move)
  898. X            printf ("m ");
  899. X            else
  900. X            printf ("d ");
  901. X            move = 0;
  902. X            printf ("%d %d\n", x, -y);
  903. X        }
  904. X        }
  905. X    }
  906. X    }
  907. X}
  908. END_OF_FILE
  909. if test 4655 -ne `wc -c <'Vplot_Kernel/Hershey/hertovplot.c'`; then
  910.     echo shar: \"'Vplot_Kernel/Hershey/hertovplot.c'\" unpacked with wrong size!
  911. fi
  912. # end of 'Vplot_Kernel/Hershey/hertovplot.c'
  913. fi
  914. if test -f 'Vplot_Kernel/filters/README' -a "${1}" != "-c" ; then 
  915.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/README'\"
  916. else
  917. echo shar: Extracting \"'Vplot_Kernel/filters/README'\" \(4744 characters\)
  918. sed "s/^X//" >'Vplot_Kernel/filters/README' <<'END_OF_FILE'
  919. X
  920. X    PEN filters:  programs to display VPLOT files
  921. X
  922. To make a new set of executables,
  923. X
  924. X    - Link  ./include/vplot.h to /usr/include/vplot.h
  925. X
  926. X    - Edit  ./machdep to reflect the configuration you desire:
  927. X        BIN directory:
  928. X        Where to put the executables.
  929. X        OWNER, GROUP: parameters for "install"
  930. X        CFLAGS: Link for debugging?  Where are the include files?
  931. X            Note that CFLAGS will be exported to the subdirectories
  932. X            when make is run there.
  933. X
  934. X    - Edit ./machdep_restrict to indicate pen filters that should
  935. X    only be runnable by people in a certain group.
  936. X    Normally all pen filters are owned by "OWNER" and in group
  937. X    "GROUP" (as set in machdep) with everybody having execute
  938. X    permission.
  939. X    Each line of machdep_restrict has the format:
  940. X    pen_filter_name    group_name
  941. X    Pen filter "pen_filter_name" will be executable only by
  942. X    people in group "group_name". If machdep_restrict doesn't
  943. X    exist, all pen filters will be installed with the default
  944. X    permissions.
  945. X
  946. X    - Move subdirectories for pen libraries you don't need (does
  947. X        your installation have a Raster Technologies display?) to
  948. X        ./otherpens.  This will prevent MakeMake from adding those
  949. X        libraries to the Makefile.
  950. X    (If you don't HAVE any pen libraries at all, don't panic,
  951. X    they are also being distributed by the same channels as
  952. X    this "Vplot Kernel" package. For example, if you want a
  953. X    pen filter for an Envision, you simply get the "Envision_device"
  954. X    distribution. In this distribution will be a directory "envilib".
  955. X    Move that directory into this one, and you're ready to go to
  956. X    the next step.)
  957. X
  958. X    - Remove MakeMakesep if you don't have SEPlib on your machine.
  959. X    If you do have SEPlib edit machdepsep like you edited
  960. X    machdep. (See comment on SEPlib at the bottom of this file.)
  961. X
  962. X    - Edit ./hosttype to give your machine type
  963. X
  964. X    - Check the entries in ./include/params.h to be sure the default
  965. X        parameters are correct for your system.
  966. X        The default STYLE is usually STANDARD or ROTATED.
  967. X        The traditional default vplot font is 0; Some prefer 1,
  968. X        the Hershey Roman simplex font.
  969. X
  970. X    - Do
  971. X        csh MakeMake
  972. X            and a Makefile will be generated, based on makefile
  973. X            fragments (*makef files) taken from each device subdirectory.
  974. X        (If you have written a new device, you should also create
  975. X        a makef file for it, following one of the ones for another
  976. X        device as an example.)
  977. X
  978. X        Comment out install lines for files which won't be installed.
  979. X
  980. X        Check the group and owner entries on the install lines.
  981. X            If your users don't have write access in the spooling
  982. X            directory, ipen and pspen must be setuid or setgid
  983. X            (and the owner or group must have the appropriate
  984. X            access).
  985. X
  986. X    - Do
  987. X    Either get the Hershey fonts and install them as described in
  988. X    man vplottext, or edit ./include/font_definitions.h so that you
  989. X    only try to compile the provided pen font into gentext.c.
  990. X    (You can leave the other fonts to be loaded at runtime; if you
  991. X    try to use them you'll only get a warning. That way if you later
  992. X    get the Hershey fonts you can slip them in without having to recompile
  993. X    anything.) Don't forget to do "make" in the directory
  994. X    ./include/vplotfonts to install all the required fonts in the required
  995. X    formats.
  996. X
  997. X    - Do 
  998. X        make >& Makelog &
  999. X            and then
  1000. X        make install
  1001. X            and the programs should be usable. (Good luck! If they're not,
  1002. X        I suppose you have to look in Makelog and figure out what
  1003. X        happened...)
  1004. X
  1005. Remember to also install copies of plas and pldb (they are in ../util).
  1006. You'll need them to try out most of the tests (in ./Tests).
  1007. X
  1008. If the number of vplot filters on your system grows large, I recommend
  1009. creating a shell to pick the correct pen filter for the user. We call
  1010. ours ``tube''. An example copy of it is in ../util. Since you won't have
  1011. the same terminals, yours will have to be different.
  1012. X
  1013. The mysterious references to "SEP" in ifdef's throughout the code
  1014. and in the Makefiles can be safely ignored if you don't know what SEPlib
  1015. is and don't have the -lsep library. This code is designed to run either
  1016. under SEP-lib or outside of it. (SEPlib is a seismic data-processing
  1017. system invented by Stew Levin and Jon Claerbout that we use in the
  1018. Stanford Exploration Project in the Geophysics Department at
  1019. Stanford University.)
  1020. I didn't want to create a different version of the source code just
  1021. for this distribution. We use both the SEP and non-SEP versions of the code
  1022. at Stanford.
  1023. X
  1024. X                                        Written by Chuck Karish
  1025. X                                        January 8, 1987
  1026. X                    Modified by Joe Dellinger
  1027. X                                        June 2, 1987
  1028. END_OF_FILE
  1029. if test 4744 -ne `wc -c <'Vplot_Kernel/filters/README'`; then
  1030.     echo shar: \"'Vplot_Kernel/filters/README'\" unpacked with wrong size!
  1031. fi
  1032. # end of 'Vplot_Kernel/filters/README'
  1033. fi
  1034. if test -f 'Vplot_Kernel/filters/Tests/TEST_aspect_ratio' -a "${1}" != "-c" ; then 
  1035.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/Tests/TEST_aspect_ratio'\"
  1036. else
  1037. echo shar: Extracting \"'Vplot_Kernel/filters/Tests/TEST_aspect_ratio'\" \(3917 characters\)
  1038. sed "s/^X//" >'Vplot_Kernel/filters/Tests/TEST_aspect_ratio' <<'END_OF_FILE'
  1039. X#plas: Vplot units used in this file
  1040. e
  1041. S s
  1042. z
  1043. Test for proper aspect ratio.
  1044. z
  1045. X
  1046. w -32760 -32760 32760 32760
  1047. F 0 0 0
  1048. J 0 0
  1049. s 0
  1050. f 0
  1051. c 7
  1052. F 0 0 0
  1053. J 0 0
  1054. s 0
  1055. f 0
  1056. F 0 0 0
  1057. J 0 0
  1058. s 0
  1059. f 0
  1060. F 0 0 0
  1061. J 0 0
  1062. s 0
  1063. f 0
  1064. z
  1065. This square should really be exactly square!
  1066. z
  1067. If it isn't, then you don't have "aspect_ratio" right.
  1068. z
  1069. X
  1070. m 1620 1620
  1071. d 5100 1620
  1072. d 5100 5100
  1073. d 1620 5100
  1074. d 1620 1620
  1075. m 1967 1620
  1076. d 5100 1967
  1077. d 4752 5100
  1078. d 1620 4752
  1079. d 1967 1620
  1080. m 2280 1650
  1081. d 5063 2280
  1082. d 4434 5063
  1083. d 1650 4434
  1084. d 2280 1650
  1085. m 2556 1710
  1086. d 4998 2556
  1087. d 4152 4998
  1088. d 1710 4152
  1089. d 2556 1710
  1090. m 2796 1794
  1091. d 4908 2796
  1092. d 3906 4908
  1093. d 1794 3906
  1094. d 2796 1794
  1095. m 3004 1890
  1096. d 4806 3004
  1097. d 3690 4806
  1098. d 1890 3690
  1099. d 3004 1890
  1100. m 3185 1998
  1101. d 4692 3185
  1102. d 3510 4692
  1103. d 1998 3510
  1104. d 3185 1998
  1105. m 3335 2112
  1106. d 4572 3335
  1107. d 3354 4572
  1108. d 2112 3354
  1109. d 3335 2112
  1110. m 3454 2232
  1111. d 4446 3454
  1112. d 3228 4446
  1113. d 2232 3228
  1114. d 3454 2232
  1115. m 3552 2352
  1116. d 4320 3552
  1117. d 3126 4320
  1118. d 2352 3126
  1119. d 3552 2352
  1120. m 3624 2472
  1121. d 4200 3624
  1122. d 3048 4200
  1123. d 2472 3048
  1124. d 3624 2472
  1125. m 3678 2585
  1126. d 4080 3678
  1127. d 2988 4080
  1128. d 2585 2988
  1129. d 3678 2585
  1130. m 3713 2694
  1131. d 3965 3713
  1132. d 2946 3965
  1133. d 2694 2946
  1134. d 3713 2694
  1135. m 3738 2796
  1136. d 3863 3738
  1137. d 2915 3863
  1138. d 2796 2915
  1139. d 3738 2796
  1140. m 3750 2885
  1141. d 3767 3750
  1142. d 2904 3767
  1143. d 2885 2904
  1144. d 3750 2885
  1145. m 3750 2970
  1146. d 3678 3750
  1147. d 2898 3678
  1148. d 2970 2898
  1149. d 3750 2970
  1150. m 3738 3048
  1151. d 3600 3738
  1152. d 2904 3600
  1153. d 3048 2904
  1154. d 3738 3048
  1155. m 3720 3113
  1156. d 3528 3720
  1157. d 2915 3528
  1158. d 3113 2915
  1159. d 3720 3113
  1160. m 3696 3174
  1161. d 3461 3696
  1162. d 2933 3461
  1163. d 3174 2933
  1164. d 3696 3174
  1165. m 3672 3222
  1166. d 3406 3672
  1167. d 2956 3406
  1168. d 3222 2956
  1169. d 3672 3222
  1170. m 3642 3263
  1171. d 3360 3642
  1172. d 2981 3360
  1173. d 3263 2981
  1174. d 3642 3263
  1175. m 3611 3300
  1176. d 3317 3611
  1177. d 3004 3317
  1178. d 3300 3004
  1179. d 3611 3300
  1180. m 3582 3330
  1181. d 3281 3582
  1182. d 3030 3281
  1183. d 3330 3030
  1184. d 3582 3330
  1185. m 3552 3354
  1186. d 3252 3552
  1187. d 3060 3252
  1188. d 3354 3060
  1189. d 3552 3354
  1190. m 3522 3372
  1191. d 3228 3522
  1192. d 3083 3228
  1193. d 3372 3083
  1194. d 3522 3372
  1195. m 3492 3383
  1196. d 3210 3492
  1197. d 3106 3210
  1198. d 3383 3106
  1199. d 3492 3383
  1200. m 3461 3390
  1201. d 3198 3461
  1202. d 3131 3198
  1203. d 3390 3131
  1204. d 3461 3390
  1205. m 3431 3396
  1206. d 3185 3431
  1207. d 3154 3185
  1208. d 3396 3154
  1209. d 3431 3396
  1210. m 3402 3396
  1211. d 3180 3402
  1212. d 3180 3180
  1213. d 3396 3180
  1214. d 3402 3396
  1215. m 3378 3396
  1216. d 3180 3378
  1217. d 3198 3180
  1218. d 3396 3198
  1219. d 3378 3396
  1220. m 5100 1620
  1221. d 1620 1620
  1222. m 5100 1620
  1223. d 5100 5100
  1224. d 1620 5100
  1225. d 1620 1620
  1226. m 4752 1620
  1227. d 5100 4752
  1228. d 1967 5100
  1229. d 1620 1967
  1230. d 4752 1620
  1231. m 5063 4434
  1232. d 2280 5063
  1233. d 1650 2280
  1234. d 4434 1650
  1235. d 5063 4434
  1236. m 2556 4998
  1237. d 1710 2556
  1238. d 4152 1710
  1239. d 4998 4152
  1240. d 2556 4998
  1241. m 1794 2796
  1242. d 3906 1794
  1243. d 4908 3906
  1244. d 2796 4908
  1245. d 1794 2796
  1246. m 3690 1890
  1247. d 4806 3690
  1248. d 3004 4806
  1249. d 1890 3004
  1250. d 3690 1890
  1251. m 4692 3510
  1252. d 3185 4692
  1253. d 1998 3185
  1254. d 3510 1998
  1255. d 4692 3510
  1256. m 3335 4572
  1257. d 2112 3335
  1258. d 3354 2112
  1259. d 4572 3354
  1260. d 3335 4572
  1261. m 2232 3454
  1262. d 3228 2232
  1263. d 4446 3228
  1264. d 3454 4446
  1265. d 2232 3454
  1266. m 3126 2352
  1267. d 4320 3126
  1268. d 3552 4320
  1269. d 2352 3552
  1270. d 3126 2352
  1271. m 4200 3048
  1272. d 3624 4200
  1273. d 2472 3624
  1274. d 3048 2472
  1275. d 4200 3048
  1276. m 3678 4080
  1277. d 2585 3678
  1278. d 2988 2585
  1279. d 4080 2988
  1280. d 3678 4080
  1281. m 2694 3713
  1282. d 2946 2694
  1283. d 3965 2946
  1284. d 3713 3965
  1285. d 2694 3713
  1286. m 2915 2796
  1287. d 3863 2915
  1288. d 3738 3863
  1289. d 2796 3738
  1290. d 2915 2796
  1291. m 3767 2904
  1292. d 3750 3767
  1293. d 2885 3750
  1294. d 2904 2885
  1295. d 3767 2904
  1296. m 3750 3678
  1297. d 2970 3750
  1298. d 2898 2970
  1299. d 3678 2898
  1300. d 3750 3678
  1301. m 3048 3738
  1302. d 2904 3048
  1303. d 3600 2904
  1304. d 3738 3600
  1305. d 3048 3738
  1306. m 2915 3113
  1307. d 3528 2915
  1308. d 3720 3528
  1309. d 3113 3720
  1310. d 2915 3113
  1311. m 3461 2933
  1312. d 3696 3461
  1313. d 3174 3696
  1314. d 2933 3174
  1315. d 3461 2933
  1316. m 3672 3406
  1317. d 3222 3672
  1318. d 2956 3222
  1319. d 3406 2956
  1320. d 3672 3406
  1321. m 3263 3642
  1322. d 2981 3263
  1323. d 3360 2981
  1324. d 3642 3360
  1325. d 3263 3642
  1326. m 3004 3300
  1327. d 3317 3004
  1328. d 3611 3317
  1329. d 3300 3611
  1330. d 3004 3300
  1331. m 3281 3030
  1332. d 3582 3281
  1333. d 3330 3582
  1334. d 3030 3330
  1335. d 3281 3030
  1336. m 3552 3252
  1337. d 3354 3552
  1338. d 3060 3354
  1339. d 3252 3060
  1340. d 3552 3252
  1341. m 3372 3522
  1342. d 3083 3372
  1343. d 3228 3083
  1344. d 3522 3228
  1345. d 3372 3522
  1346. m 3106 3383
  1347. d 3210 3106
  1348. d 3492 3210
  1349. d 3383 3492
  1350. d 3106 3383
  1351. m 3198 3131
  1352. d 3461 3198
  1353. d 3390 3461
  1354. d 3131 3390
  1355. d 3198 3131
  1356. m 3431 3185
  1357. d 3396 3431
  1358. d 3154 3396
  1359. d 3185 3154
  1360. d 3431 3185
  1361. m 3396 3402
  1362. d 3180 3396
  1363. d 3180 3180
  1364. d 3402 3180
  1365. d 3396 3402
  1366. m 3198 3396
  1367. d 3180 3198
  1368. d 3378 3180
  1369. d 3396 3378
  1370. d 3198 3396
  1371. END_OF_FILE
  1372. if test 3917 -ne `wc -c <'Vplot_Kernel/filters/Tests/TEST_aspect_ratio'`; then
  1373.     echo shar: \"'Vplot_Kernel/filters/Tests/TEST_aspect_ratio'\" unpacked with wrong size!
  1374. fi
  1375. # end of 'Vplot_Kernel/filters/Tests/TEST_aspect_ratio'
  1376. fi
  1377. if test -f 'Vplot_Kernel/filters/Tests/TEST_pattern' -a "${1}" != "-c" ; then 
  1378.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/Tests/TEST_pattern'\"
  1379. else
  1380. echo shar: Extracting \"'Vplot_Kernel/filters/Tests/TEST_pattern'\" \(3984 characters\)
  1381. sed "s/^X//" >'Vplot_Kernel/filters/Tests/TEST_pattern' <<'END_OF_FILE'
  1382. e
  1383. S s
  1384. z
  1385. Test of user-loaded polygon patterns
  1386. z
  1387. X
  1388. z
  1389. This file tests polygons filled with a user-defined pattern.
  1390. z
  1391. You should have to tilt your head left to read the square insert,
  1392. z
  1393. and tilt your head right for the bow-tie shaped insert.
  1394. z
  1395. The background pattern is right side up.
  1396. z
  1397. Try using the pen option "patternmult=.1" on an imagen.
  1398. z
  1399. X
  1400. z
  1401. The hammer should be cyan, and the sickle should be blue.
  1402. z
  1403. For devices that can only fill with a solid color, the background should
  1404. z
  1405. be red, and the two inserts should be green.
  1406. C 10 255 0 0
  1407. C 11 0 255 0
  1408. C 12 0 255 0
  1409. l   300    0     0    9
  1410. l   30   32    32   10
  1411. X00000000000000000000000000000000
  1412. X44444444444444444444444444444444
  1413. X00000000000000000000000000000004
  1414. X00000000000000000000000000000004
  1415. X00000000000000000000000000000004
  1416. X00000000000000000000000000000004
  1417. X00000000000000000000000000000004
  1418. X00000000000000000000000000000004
  1419. X00000000000011111111110000000004
  1420. X00000000001111111111111111000004
  1421. X00000000011100000000001111000004
  1422. X00000000011000000500000011000004
  1423. X00000000011100000555000000000004
  1424. X00000000011100000555500000000004
  1425. X00000000001110555555500000000004
  1426. X00000000055111000005500000000004
  1427. X00005555500011100000000000000004
  1428. X00550000000000110000000000000004
  1429. X00000000000001100000000000000004
  1430. X00000000000011000000000000000004
  1431. X00000000000110000000000000000004
  1432. X00000000011100000000000000000004
  1433. X00000000000000000000000000000004
  1434. X00000000000000000000000000000004
  1435. X00000000000000000000000000000004
  1436. X00333333033333303333330333333004
  1437. X00300000030000003000000300003004
  1438. X00300000030000003000000300003004
  1439. X00300000030000003000000333330004
  1440. X00300000030000003000000300000004
  1441. X00333333033333303333330300000004
  1442. X00000000000000000000000300000004
  1443. l   50   32    32   11
  1444. X04444444444444444444444444444444
  1445. X04000000000000000000000000000000
  1446. X04000000000000000000000000000000
  1447. X04000000000000000000000003330000
  1448. X04000000000000000000000003003000
  1449. X04000000000000000000000003003000
  1450. X04000000011100000000000003003000
  1451. X04000000011100000000000003003000
  1452. X04000000011000000000000003333333
  1453. X04000000011000000000000000000000
  1454. X04000000110000000000000003000030
  1455. X04000000110005550000000003000030
  1456. X04000000110055550000000003000030
  1457. X04000000110055500000000003000030
  1458. X04000000110555500000000003000030
  1459. X04000000110000500000000003333330
  1460. X04000000110000500100000000000000
  1461. X04000000110000501110000003000030
  1462. X04000000110000011011000003000030
  1463. X04000000110000111001100003000030
  1464. X04000000011011110000110003000030
  1465. X04000000011111150000010003000030
  1466. X04000000001111050000010003333330
  1467. X04000000000000005000000000000000
  1468. X04000000000000005000000003000030
  1469. X04000000000000005000000003000030
  1470. X04000000000000005000000003000030
  1471. X04000000000000005000000003000030
  1472. X04000000000000000500000003000030
  1473. X04000000000000000500000003333330
  1474. X04000000000000000000000000000000
  1475. X04000000000000000000000000000000
  1476. l   60   32    32   12
  1477. X00000000000000000000000000000040
  1478. X00000000000000000000000000000040
  1479. X03333330000000500000000000000040
  1480. X03000030000000500000000000000040
  1481. X03000030000000050000000000000040
  1482. X03000030000000050000000000000040
  1483. X03000030000000050000000000000040
  1484. X03000030000000050000000000000040
  1485. X00000000000000050000000000000040
  1486. X03333330001000005011110000000040
  1487. X03000030001000005111111000000040
  1488. X03000030001100001111011000000040
  1489. X03000030000110011100001100000040
  1490. X03000030000011011000001100000040
  1491. X03000030000001110500001100000040
  1492. X00000000000000100500001100000040
  1493. X03333330000000000500001100000040
  1494. X03000030000000000555501100000040
  1495. X03000030000000000555001100000040
  1496. X03000030000000005555001100000040
  1497. X03000030000000005550001100000040
  1498. X03000030000000000000001100000040
  1499. X00000000000000000000011000000040
  1500. X33333330000000000000011000000040
  1501. X00030030000000000000111000000040
  1502. X00030030000000000000111000000040
  1503. X00030030000000000000000000000040
  1504. X00030030000000000000000000000040
  1505. X00003330000000000000000000000040
  1506. X00000000000000000000000000000040
  1507. X00000000000000000000000000000040
  1508. X44444444444444444444444444444440
  1509. c 10
  1510. A 4
  1511. X0000 0000
  1512. X0000 6000
  1513. X6000 6000
  1514. X6000 0000
  1515. c 11
  1516. A 4
  1517. X0500 0500
  1518. X0500 2000
  1519. X2000 2000
  1520. X2000 0500
  1521. c 12
  1522. o -2400 -2000
  1523. A 4
  1524. X0500 0500
  1525. X2000 2000
  1526. X0500 2000
  1527. X2000 0500
  1528. END_OF_FILE
  1529. if test 3984 -ne `wc -c <'Vplot_Kernel/filters/Tests/TEST_pattern'`; then
  1530.     echo shar: \"'Vplot_Kernel/filters/Tests/TEST_pattern'\" unpacked with wrong size!
  1531. fi
  1532. # end of 'Vplot_Kernel/filters/Tests/TEST_pattern'
  1533. fi
  1534. if test -f 'Vplot_Kernel/filters/genlib/genmarker.c' -a "${1}" != "-c" ; then 
  1535.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/genlib/genmarker.c'\"
  1536. else
  1537. echo shar: Extracting \"'Vplot_Kernel/filters/genlib/genmarker.c'\" \(4464 characters\)
  1538. sed "s/^X//" >'Vplot_Kernel/filters/genlib/genmarker.c' <<'END_OF_FILE'
  1539. X/*
  1540. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  1541. X * University. Official permission to use this software is included in
  1542. X * the documentation. It authorizes you to use this file for any
  1543. X * non-commercial purpose, provided that this copyright notice is not
  1544. X * removed and that any modifications made to this file are commented
  1545. X * and dated in the style of my example below.
  1546. X */
  1547. X
  1548. X/*
  1549. X *
  1550. X *  source file:   ./filters/genlib/genmarker.c
  1551. X *
  1552. X * Joe Dellinger (SEP), June 11 1987
  1553. X *    Inserted this sample edit history entry.
  1554. X *    Please log any further modifications made to this file:
  1555. X *
  1556. X * Joe Dellinger, Dec 7 1987
  1557. X *    Fixed a bug that caused markers >127 and (>6 and <19)
  1558. X *    not to be drawn.
  1559. X * Joe Dellinger Feb 28 1988
  1560. X *    Even if size is zero still plot a point.
  1561. X */
  1562. X
  1563. X#include "../include/params.h"
  1564. X#include <stdio.h>
  1565. X#include <math.h>
  1566. X#include <vplot.h>
  1567. X#include "../include/enum.h"
  1568. X#include "../include/extern.h"
  1569. X#include "../include/round.h"
  1570. X
  1571. genmarker (npts, type, size, pvec)
  1572. X    int             npts, type, size;
  1573. X    int            *pvec;
  1574. X{
  1575. int             savetxfont, savetxprec, savetxovly, savefat;
  1576. struct txalign  savealign;
  1577. extern float    fatmult_orig;
  1578. char            txbuf[10];
  1579. char           *txbuffer = txbuf;
  1580. X
  1581. X    savealign.hor = txalign.hor;
  1582. X    savealign.ver = txalign.ver;
  1583. X
  1584. X    savetxfont = txfont;
  1585. X    savetxprec = txprec;
  1586. X    savetxovly = txovly;
  1587. X    savefat = fat;
  1588. X
  1589. X/*
  1590. X * If it's shrunk away to nothing, plot it as a point.
  1591. X * Gentext eats zero-size text.
  1592. X */
  1593. X    if (size == 0)
  1594. X    type = 0;
  1595. X
  1596. X    fat = (fatmult_orig * size * SYMBFATRATIO);
  1597. X    fat += fatmult * (float) fatbase;
  1598. X    txalign.hor = TH_SYMBOL;
  1599. X    txalign.ver = TV_SYMBOL;
  1600. X    txovly = OVLY_NORMAL;
  1601. X
  1602. X    if ((type > 32) && (type < 127))    /* is it a printing character? */
  1603. X    {
  1604. X    *txbuffer = (char) (type);
  1605. X    *(txbuffer + 1) = '\0';
  1606. X    text_marker (txbuffer, size, npts, pvec);
  1607. X    }
  1608. X    else
  1609. X    if (type >= 127)        /* special non-ASCII character */
  1610. X    {
  1611. X    sprintf (txbuffer, "\\v%d \0", type);
  1612. X    text_marker (txbuffer, size, npts, pvec);
  1613. X    }
  1614. X    else            /* 0 through 5 are pre-defined; 6 through 20
  1615. X                 * reserved */
  1616. X    {
  1617. X    switch (type)
  1618. X    {
  1619. X    case 0:
  1620. X    case 1:
  1621. X        while (npts--)
  1622. X        {
  1623. X        dev.point (*pvec, *(pvec + 1));
  1624. X        pvec += 2;
  1625. X        }
  1626. X        break;
  1627. X    case 2:        /* '+' */
  1628. X        txfont = MATH;
  1629. X        *txbuffer = (char) 57;
  1630. X        *(txbuffer + 1) = '\0';
  1631. X        text_marker (txbuffer, size, npts, pvec);
  1632. X        break;
  1633. X    case 3:        /* '*' */
  1634. X        txfont = MATH;
  1635. X        *txbuffer = (char) 33;
  1636. X        *(txbuffer + 1) = '\0';
  1637. X        text_marker (txbuffer, size, npts, pvec);
  1638. X        break;
  1639. X    case 4:        /* circle */
  1640. X        txfont = MISC;
  1641. X        *txbuffer = (char) 105;
  1642. X        *(txbuffer + 1) = '\0';
  1643. X        text_marker (txbuffer, size, npts, pvec);
  1644. X        break;
  1645. X    case 5:        /* 'X' */
  1646. X        txfont = MATH;
  1647. X        *txbuffer = (char) 60;
  1648. X        *(txbuffer + 1) = '\0';
  1649. X        text_marker (txbuffer, size, npts, pvec);
  1650. X        break;
  1651. X    case 20:        /* square */
  1652. X        txfont = MISC;
  1653. X        *txbuffer = (char) 72;
  1654. X        *(txbuffer + 1) = '\0';
  1655. X        text_marker (txbuffer, size, npts, pvec);
  1656. X        break;
  1657. X    case 21:        /* triangle */
  1658. X        txfont = MISC;
  1659. X        *txbuffer = (char) 73;
  1660. X        *(txbuffer + 1) = '\0';
  1661. X        text_marker (txbuffer, size, npts, pvec);
  1662. X        break;
  1663. X    case 22:        /* diamond */
  1664. X        txfont = MISC;
  1665. X        *txbuffer = (char) 74;
  1666. X        *(txbuffer + 1) = '\0';
  1667. X        text_marker (txbuffer, size, npts, pvec);
  1668. X        break;
  1669. X    case 23:        /* star */
  1670. X        txfont = MISC;
  1671. X        *txbuffer = (char) 75;
  1672. X        *(txbuffer + 1) = '\0';
  1673. X        text_marker (txbuffer, size, npts, pvec);
  1674. X        break;
  1675. X    default:
  1676. X        while (npts--)
  1677. X        {
  1678. X        dev.point (*pvec, *(pvec + 1));
  1679. X        pvec += 2;
  1680. X        }
  1681. X        break;
  1682. X    }
  1683. X    }
  1684. X
  1685. X    txalign.hor = savealign.hor;
  1686. X    txalign.ver = savealign.ver;
  1687. X    txfont = savetxfont;
  1688. X    txprec = savetxprec;
  1689. X    txovly = savetxovly;
  1690. X    fat = savefat;
  1691. X
  1692. X    return (0);
  1693. X}
  1694. X
  1695. text_marker (txbuffer, size, npts, pvec)
  1696. X    char           *txbuffer;
  1697. X    int             size, npts;
  1698. X    int            *pvec;
  1699. X{
  1700. X
  1701. X    while (npts--)
  1702. X    {
  1703. X    xold = *pvec;
  1704. X    yold = *(pvec + 1);
  1705. X    if (txfont < NUMGENFONT)
  1706. X    {
  1707. X        gentext (txbuffer,
  1708. X        /* Character path direction */
  1709. X             (float) size * aspect_ratio,
  1710. X             (float) 0,
  1711. X        /* Character up vector direction */
  1712. X             (float) 0,
  1713. X             (float) size);
  1714. X    }
  1715. X    else
  1716. X    {
  1717. X        dev.text (txbuffer,
  1718. X        /* Character path direction */
  1719. X              (float) size * aspect_ratio,
  1720. X              (float) 0,
  1721. X        /* Character up vector direction */
  1722. X              (float) 0,
  1723. X              (float) size);
  1724. X    }
  1725. X    pvec += 2;
  1726. X    }
  1727. X}
  1728. END_OF_FILE
  1729. if test 4464 -ne `wc -c <'Vplot_Kernel/filters/genlib/genmarker.c'`; then
  1730.     echo shar: \"'Vplot_Kernel/filters/genlib/genmarker.c'\" unpacked with wrong size!
  1731. fi
  1732. # end of 'Vplot_Kernel/filters/genlib/genmarker.c'
  1733. fi
  1734. if test -f 'Vplot_Kernel/filters/genlib/genpatarea.c' -a "${1}" != "-c" ; then 
  1735.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/genlib/genpatarea.c'\"
  1736. else
  1737. echo shar: Extracting \"'Vplot_Kernel/filters/genlib/genpatarea.c'\" \(4233 characters\)
  1738. sed "s/^X//" >'Vplot_Kernel/filters/genlib/genpatarea.c' <<'END_OF_FILE'
  1739. X/*
  1740. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  1741. X * University. Official permission to use this software is included in
  1742. X * the documentation. It authorizes you to use this file for any
  1743. X * non-commercial purpose, provided that this copyright notice is not
  1744. X * removed and that any modifications made to this file are commented
  1745. X * and dated in the style of my example below.
  1746. X */
  1747. X
  1748. X/*
  1749. X *
  1750. X *  source file:   ./filters/genlib/genpatarea.c
  1751. X *
  1752. X * Joe Dellinger (SEP), June 11 1987
  1753. X *    Inserted this sample edit history entry.
  1754. X *    Please log any further modifications made to this file:
  1755. X * Joe Dellinger, Feb 16 1988
  1756. X *    Make number of arguments to dev.attributes and dev.raster consistent.
  1757. X */
  1758. X
  1759. X#include <stdio.h>
  1760. X#include "../include/pat.h"
  1761. X#include "../include/vertex.h"
  1762. X#include "../include/params.h"
  1763. X#include "../include/extern.h"
  1764. X#include "../include/enum.h"
  1765. X#include "../include/attrcom.h"
  1766. X
  1767. X/* Make the damn modulo function work for negative numbers */
  1768. X#define MODULO(A,B)    (((A)>=0)?((A)%(B)):(((A)%(B)+(B))%(B)))
  1769. X
  1770. X/*
  1771. X * This routine turns polygons filled with a pattern into calls to
  1772. X * dev.raster. (one line at a time).
  1773. X */
  1774. extern int      need_devcolor, cur_color;
  1775. extern char    *malloc ();
  1776. X
  1777. genpatarea (npts, head)
  1778. X    int             npts;
  1779. X    struct vertex  *head;
  1780. X{
  1781. register int    y, i, ii;
  1782. register int    xstr, xend;
  1783. int             ncross;
  1784. int             vminx, vmaxx, vminy, vmaxy;
  1785. struct vertex  *yhead, *v;
  1786. int            *crosses;
  1787. unsigned char  *rasline;
  1788. static int      cur_color_save;
  1789. int             color;
  1790. X
  1791. X/*
  1792. X * Save color so we can restore it the last time.
  1793. X */
  1794. X    cur_color_save = cur_color;
  1795. X
  1796. X    /*
  1797. X     * allocate storage for scan line cross points 
  1798. X     */
  1799. X    crosses = (int *) malloc ((unsigned) npts * sizeof (int));
  1800. X
  1801. X    /*
  1802. X     * allocate storage for raster line 
  1803. X     */
  1804. X    rasline = (unsigned char *) malloc ((unsigned) (xwmax - xwmin + 1) * sizeof (unsigned char));
  1805. X
  1806. X    /*
  1807. X     * double link the vertices. (head) is set to the node with the maximum
  1808. X     * x-value so that intersect() will not eliminate 'head' while casting
  1809. X     * off vertices. 
  1810. X     */
  1811. X    vminx = head->x;
  1812. X    vmaxx = head->x;
  1813. X    vminy = head->y;
  1814. X    vmaxy = head->y;
  1815. X    yhead = head;
  1816. X
  1817. X    v = head;
  1818. X    for (i = 0; i < npts; i++)
  1819. X    {
  1820. X    if (v->x > vmaxx)
  1821. X    {
  1822. X        vmaxx = v->x;
  1823. X    }
  1824. X    if (v->y > vmaxy)
  1825. X    {
  1826. X        vmaxy = v->y;
  1827. X        yhead = v;
  1828. X    }
  1829. X    if (v->x < vminx)
  1830. X        vminx = v->x;
  1831. X    if (v->y < vminy)
  1832. X        vminy = v->y;
  1833. X    v++;
  1834. X    }
  1835. X
  1836. X    if (vmaxx > xwmax)
  1837. X    vmaxx = xwmax;
  1838. X    if (vminx < xwmin)
  1839. X    vminx = xwmin;
  1840. X    if (vmaxy > ywmax)
  1841. X    vmaxy = ywmax;
  1842. X    if (vminy < ywmin)
  1843. X    vminy = ywmin;
  1844. X
  1845. X    if ((pat[ipat] .ydim > 0) && (pat[ipat] .xdim > 0))
  1846. X    {
  1847. X    /* stretch polygon in y-direction */
  1848. X    v = yhead;
  1849. X    do
  1850. X    {
  1851. X        v->y = 2 * (v->y) + 1;
  1852. X        v = v->next;
  1853. X    } while (v != yhead);
  1854. X
  1855. X    for (y = vminy; y <= vmaxy; y++)
  1856. X    {
  1857. X        ncross = intersect (2 * y, crosses, yhead, 1);
  1858. X        sort (crosses, ncross);
  1859. X        for (i = 0; i < ncross; i += 2)
  1860. X        {
  1861. X        xstr = crosses[i];
  1862. X        xend = crosses[i + 1];
  1863. X
  1864. X        if (xstr < xwmin && xend < xwmin)
  1865. X            continue;
  1866. X        if (xstr > xwmax && xend > xwmax)
  1867. X            continue;
  1868. X
  1869. X        if (xstr < xwmin)
  1870. X            xstr = xwmin;
  1871. X        if (xend > xwmax)
  1872. X            xend = xwmax;
  1873. X
  1874. X        if (pat[ipat] .xdim == 1)
  1875. X        {
  1876. X/* Faster to fill it with one vector */
  1877. X            color =
  1878. X             pat[ipat] .patbits[
  1879. X                    ((pat[ipat] .ydim - 1) - (MODULO (y, pat[ipat] .ydim))) * pat[ipat] .xdim
  1880. X             ];
  1881. X            if (cur_color != color || need_devcolor)
  1882. X            {
  1883. X            cur_color = color;
  1884. X            dev.attributes (SET_COLOR, cur_color, 0, 0, 0);
  1885. X            need_devcolor = NO;
  1886. X            }
  1887. X            dev.vector (xstr, y, xend, y, 0, 0);
  1888. X        }
  1889. X        else
  1890. X        {
  1891. X            for (ii = xstr; ii <= xend; ii++)
  1892. X            {
  1893. X            rasline[ii - xstr] =
  1894. X             pat[ipat] .patbits[
  1895. X                        ((pat[ipat] .ydim - 1) - (MODULO (y, pat[ipat] .ydim))) * pat[ipat] .xdim
  1896. X                        + MODULO (ii, pat[ipat] .xdim)
  1897. X             ];
  1898. X            }
  1899. X            if (xstr <= xend)
  1900. X            dev.raster (0, 1, xstr, y, xend - xstr + 1, 0, rasline, 0, 0);
  1901. X        }
  1902. X        }
  1903. X    }
  1904. X    /* shrink in y */
  1905. X    v = yhead;
  1906. X    do
  1907. X    {
  1908. X        v->y = ((v->y - 1) / 2);
  1909. X        v = v->next;
  1910. X    } while (v != yhead);
  1911. X    }
  1912. X
  1913. X    free ((char *) rasline);
  1914. X    free ((char *) crosses);
  1915. X
  1916. X    if (cur_color != cur_color_save)
  1917. X    {
  1918. X    cur_color = cur_color_save;
  1919. X    need_devcolor = YES;
  1920. X    }
  1921. X}
  1922. END_OF_FILE
  1923. if test 4233 -ne `wc -c <'Vplot_Kernel/filters/genlib/genpatarea.c'`; then
  1924.     echo shar: \"'Vplot_Kernel/filters/genlib/genpatarea.c'\" unpacked with wrong size!
  1925. fi
  1926. # end of 'Vplot_Kernel/filters/genlib/genpatarea.c'
  1927. fi
  1928. if test -f 'Vplot_Kernel/filters/genlib/genraster1.c' -a "${1}" != "-c" ; then 
  1929.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/genlib/genraster1.c'\"
  1930. else
  1931. echo shar: Extracting \"'Vplot_Kernel/filters/genlib/genraster1.c'\" \(4682 characters\)
  1932. sed "s/^X//" >'Vplot_Kernel/filters/genlib/genraster1.c' <<'END_OF_FILE'
  1933. X/*
  1934. X * Copyright 1987 the Board of Trustees of the Leland Stanford Junior
  1935. X * University. Official permission to use this software is included in
  1936. X * the documentation. It authorizes you to use this file for any
  1937. X * non-commercial purpose, provided that this copyright notice is not
  1938. X * removed and that any modifications made to this file are commented
  1939. X * and dated in the style of my example below.
  1940. X */
  1941. X
  1942. X/*
  1943. X *
  1944. X *  source file:   ./filters/genlib/genraster1.c
  1945. X *
  1946. X * Joe Dellinger (SEP), June 11 1987
  1947. X *    Inserted this sample edit history entry.
  1948. X *    Please log any further modifications made to this file:
  1949. X * Joe Dellinger Feb 16 1988
  1950. X *    Make number of arguments consistent between smart and dumb forms
  1951. X *    of dev.raster.
  1952. X */
  1953. X
  1954. X#include <stdio.h>
  1955. X#include "../include/extern.h"
  1956. X#include "../include/enum.h"
  1957. X#include "../include/attrcom.h"
  1958. X#include "../include/params.h"
  1959. X
  1960. X#define    MAXMEM 200000
  1961. X#define OFF 0
  1962. X#define ON 1
  1963. X
  1964. extern int      overlay, cur_color, need_devcolor, num_col_8;
  1965. extern char    *malloc ();
  1966. X/*
  1967. X * Less than or equal to this, better to use point mode 
  1968. X */
  1969. int             break_point = 4;
  1970. X
  1971. X/*
  1972. X * A more efficient genraster version for devices that can draw a
  1973. X * string of points quickly. Break the plot up by color, and by
  1974. X * points and vectors.
  1975. X */
  1976. X
  1977. genraster1 (count, out_of, xpos, ypos, length, orient, raster, dummy1, dummy2)
  1978. X    int             count, out_of, xpos, ypos, length, orient, dummy1, dummy2;
  1979. X    unsigned char  *raster;
  1980. X{
  1981. int             ii, jj, yy, kk, ll;
  1982. int             xstart, state;
  1983. static int      cur_color_save;
  1984. static int      num_lines;
  1985. static unsigned char *array;
  1986. static int      ylength, ystart, jstart;
  1987. static int      color_used[MAX_COL + 1];
  1988. int             xsign, ysign, xy, xrpos, yrpos;
  1989. X
  1990. X    switch (orient)
  1991. X    {
  1992. X    case 0:
  1993. X    xrpos = xpos;
  1994. X    yrpos = ypos;
  1995. X    xsign = 1;
  1996. X    ysign = 1;
  1997. X    xy = 0;
  1998. X    break;
  1999. X    case 1:
  2000. X    xrpos = ypos;
  2001. X    yrpos = xpos;
  2002. X    xsign = -1;
  2003. X    ysign = 1;
  2004. X    xy = 1;
  2005. X    break;
  2006. X    case 2:
  2007. X    xrpos = xpos;
  2008. X    yrpos = ypos;
  2009. X    xsign = -1;
  2010. X    ysign = -1;
  2011. X    xy = 0;
  2012. X    break;
  2013. X    case 3:
  2014. X    xrpos = ypos;
  2015. X    yrpos = xpos;
  2016. X    xsign = 1;
  2017. X    ysign = -1;
  2018. X    xy = 1;
  2019. X    break;
  2020. X    }
  2021. X
  2022. X    if (count == 0)
  2023. X    {
  2024. X    /*
  2025. X     * First time remember the color so we can restore it the last time. 
  2026. X     */
  2027. X    cur_color_save = cur_color;
  2028. X
  2029. X    /*
  2030. X     * Also find out how many lines we can do at once. 
  2031. X     */
  2032. X    num_lines = MAXMEM / length;
  2033. X    if (num_lines < 1)
  2034. X        num_lines = 1;
  2035. X    array = (unsigned char *) malloc ((unsigned) num_lines * length * sizeof (unsigned char));
  2036. X    /*
  2037. X     * See whether we need to do color 0 or not 
  2038. X     */
  2039. X    jstart = 0;
  2040. X    if (overlay == 1)
  2041. X        jstart = 1;
  2042. X    }
  2043. X
  2044. X    if (ylength == 0)
  2045. X    {
  2046. X    /*
  2047. X     * Just starting a block. Remember where it is. 
  2048. X     */
  2049. X    ystart = yrpos;
  2050. X    for (ii = 0; ii <= num_col_8; ii++)
  2051. X    {
  2052. X        color_used[ii] = 0;
  2053. X    }
  2054. X    }
  2055. X
  2056. X/*
  2057. X * Save it.
  2058. X */
  2059. X    for (ii = 0; ii < length; ii++)
  2060. X    {
  2061. X    array[length * ylength + ii] = raster[ii];
  2062. X    color_used[raster[ii]] = 1;
  2063. X    }
  2064. X    ylength++;
  2065. X
  2066. X    if (ylength >= num_lines || count == out_of - 1)
  2067. X    {
  2068. X/*
  2069. X * Plot it. Loop by color
  2070. X */
  2071. X
  2072. X    need_devcolor = NO;
  2073. X
  2074. X    for (kk = 0; kk < 2; kk++)
  2075. X    {
  2076. X/*
  2077. X * For maximum efficiency of output, better to have the kk loop
  2078. X * inside the jj loop. However, while watching on the screen better
  2079. X * to have "most important" stuff come out first.
  2080. X */
  2081. X        for (jj = jstart; jj < num_col_8; jj++)
  2082. X        {
  2083. X        if (color_used[jj] == 0)
  2084. X            continue;
  2085. X
  2086. X        cur_color = jj;
  2087. X        dev.attributes (SET_COLOR, cur_color, 0, 0, 0);
  2088. X
  2089. X        for (yy = 0; yy < ylength; yy++)
  2090. X        {
  2091. X            state = OFF;
  2092. X            for (ii = 0; ii <= length; ii++)
  2093. X            {
  2094. X            if (ii != length && array[length * yy + ii] == jj && state == OFF)
  2095. X            {
  2096. X                xstart = xrpos + xsign * ii;
  2097. X                state = ON;
  2098. X                continue;
  2099. X            }
  2100. X            if ((ii == length || array[length * yy + ii] != jj) && state == ON)
  2101. X            {
  2102. X                switch (kk)
  2103. X                {
  2104. X                case 0:
  2105. X                if (xsign * (xrpos + xsign * ii - xstart) > break_point)
  2106. X                {
  2107. X                    if (xy)
  2108. X                    dev.vector (ystart - ysign * yy, xstart, ystart - ysign * yy, xrpos + xsign * (ii - 1), 0, 0);
  2109. X                    else
  2110. X                    dev.vector (xstart, ystart - ysign * yy, xrpos + xsign * (ii - 1), ystart - ysign * yy, 0, 0);
  2111. X                }
  2112. X                break;
  2113. X                case 1:
  2114. X                if (xsign * (xrpos + xsign * ii - xstart) <= break_point)
  2115. X                {
  2116. X                    for (ll = 0; ll < xsign * (xrpos + xsign * ii - xstart); ll++)
  2117. X                    {
  2118. X                    if (xy)
  2119. X                        dev.point (ystart - ysign * yy, xstart + xsign * ll);
  2120. X                    else
  2121. X                        dev.point (xstart + xsign * ll, ystart - ysign * yy);
  2122. X                    }
  2123. X                }
  2124. X                break;
  2125. X                }
  2126. X                state = OFF;
  2127. X            }
  2128. X            }
  2129. X        }
  2130. X
  2131. X        }
  2132. X    }
  2133. X    ylength = 0;
  2134. X    if (count == out_of - 1)
  2135. X    {
  2136. X        free ((char *) array);
  2137. X        if (cur_color != cur_color_save)
  2138. X        {
  2139. X        cur_color = cur_color_save;
  2140. X        need_devcolor = YES;
  2141. X        }
  2142. X    }
  2143. X    }
  2144. X}
  2145. END_OF_FILE
  2146. if test 4682 -ne `wc -c <'Vplot_Kernel/filters/genlib/genraster1.c'`; then
  2147.     echo shar: \"'Vplot_Kernel/filters/genlib/genraster1.c'\" unpacked with wrong size!
  2148. fi
  2149. # end of 'Vplot_Kernel/filters/genlib/genraster1.c'
  2150. fi
  2151. if test -f 'Vplot_Kernel/filters/loclib/getpar.mn' -a "${1}" != "-c" ; then 
  2152.   echo shar: Will not clobber existing file \"'Vplot_Kernel/filters/loclib/getpar.mn'\"
  2153. else
  2154. echo shar: Extracting \"'Vplot_Kernel/filters/loclib/getpar.mn'\" \(4757 characters\)
  2155. sed "s/^X//" >'Vplot_Kernel/filters/loclib/getpar.mn' <<'END_OF_FILE'
  2156. X.TH GETPAR 9
  2157. X.SH NAME
  2158. getpar \-  parse input parameters
  2159. X.SH SYNOPSIS
  2160. X.B "C Version"
  2161. X.br
  2162. X.sp
  2163. X.B "getpar(name,type,ptr)"
  2164. X.br
  2165. X.B "char *name;"
  2166. X.br
  2167. X.B "char *type;"
  2168. X.br
  2169. X.B "union { char *s; int  *i; float *f; } ptr;"
  2170. X.br
  2171. X.sp
  2172. X.B "F77 Version"
  2173. X.br
  2174. X.sp
  2175. X.B "getpar(name,type,var)"
  2176. X.br
  2177. X.B "character*1 name()"
  2178. X.br
  2179. X.B "character*1 type"
  2180. X.br
  2181. X.B "real var"
  2182. or
  2183. X.B "integer var"
  2184. or
  2185. X.B "character*1 var()"
  2186. X.SH DESCRIPTION
  2187. X.I Getpar
  2188. is a routine to handle input parameters in a manner which is similar to
  2189. X(but not the same as) the old Fortran namelists.
  2190. The arguments, in the form
  2191. X.B name=value,
  2192. are normally taken from the command line.
  2193. If in the command line the argument
  2194. X.I "par=filename"
  2195. is encountered, then
  2196. X.I filename
  2197. is searched in addition.
  2198. Any number of such diversions may occur on a given command line.
  2199. X.PP
  2200. On the first invocation of
  2201. X.B getpar(),
  2202. all
  2203. X.B name=value
  2204. pairs are read from the command line and from par files
  2205. and stored in a hashed list, and the requested value is returned.
  2206. Subsequent calls return the values directly from the hashed list.
  2207. X.PP
  2208. The typical use of getpar is given by the following example
  2209. X.RS
  2210. X.PP
  2211. X.nf
  2212. X/* set defaults */
  2213. float x = 1.2345;
  2214. int ix  = 7;
  2215. char title[25] = "no title";
  2216. int xargc; char **xargv;
  2217. main(ac,av)
  2218. int ac; char **av;
  2219. X   {
  2220. X    /* set up external values */
  2221. X    xargc= ac; xargv= av;
  2222. X    /* get args (if any) */
  2223. X    getpar("title","s",title);
  2224. X    getpar("x","f",&x);
  2225. X    getpar("ix","d",&ix);
  2226. X    etc.....
  2227. X   }
  2228. X
  2229. X
  2230. X    real x/1.2345/
  2231. X    integer ix/7/
  2232. X    character*1 title(25)/'no title'/
  2233. X    character*1 str/'s'/, int/'i'/, flt/'f'/
  2234. X    call getpar('title',str,title);
  2235. X    call getpar('x',flt,x)
  2236. X    call getpar('ix',int,ix)
  2237. X    etc....
  2238. X.fi
  2239. X.RE
  2240. The argument
  2241. X.I name
  2242. is the name the variable is known by externally (i.e., on the command line).
  2243. The user also has the option of giving more than one name for a variable.
  2244. For example,
  2245. X.RS
  2246. X.nf
  2247. X    getpar("in input infile", "s", file)
  2248. X.fi
  2249. X.RE
  2250. will search for the variables "in", "input", and "infile" on the
  2251. command line.
  2252. If the command line has any of these variables list in name,
  2253. then it will return the string.
  2254. The variables are searched in the order they are listed in the string
  2255. X.I name.
  2256. If the variable is listed twice
  2257. on the command line, only the last instance will be returned by a call to
  2258. X.I getpar().
  2259. For example, if the command line had
  2260. X.RS
  2261. X.nf
  2262. X    in=temp n1=65 n4=901 data=s input=test
  2263. X.fi
  2264. X.RE
  2265. and the
  2266. X.I getpar
  2267. listed above were used, then
  2268. X.I file
  2269. would be set to
  2270. X.I test.
  2271. This is because the
  2272. X.I input
  2273. on a command line has priority over the
  2274. X.I in
  2275. because the
  2276. X.I input
  2277. comes after the
  2278. X.I in
  2279. in the command line.
  2280. The order of variables in the
  2281. X.I name
  2282. string does not affect the priority.
  2283. The variables in the string
  2284. X.I name
  2285. can be separated by blanks, commas, colons, or semicolons.
  2286. X.I Type
  2287. specifies the interpretation to be applied to the value of the
  2288. variable.
  2289. The following types are currently defined
  2290. X.RS
  2291. X.PP
  2292. X.nf
  2293. X"s" - string
  2294. X"d" - integer (long)
  2295. X"f" - float
  2296. X"g" - double
  2297. X"1" - boolean (accepts y/n or 1/0 and returns an int)
  2298. X.fi
  2299. X.RE
  2300. The variable
  2301. X.I ptr
  2302. is a pointer to the location of the parameter value.
  2303. If no occurrence of the parameter is found then the contents of
  2304. X.I ptr
  2305. are unchanged.
  2306. Thus defaults can be set in advance of parsing.
  2307. X.PP
  2308. X.I Getpar
  2309. returns the number of occurrences of the variable found.
  2310. Thus if a particular variable must be assigned then the
  2311. appropriate usage is
  2312. X.RS
  2313. X.nf
  2314. if(getpar("title","s",title)==0) {
  2315. X    fprintf(stderr,"must specify title\\n");
  2316. X    exit(-1);
  2317. X}
  2318. X.fi
  2319. X.RE
  2320. X.PP
  2321. The format for a parameter is
  2322. X.I "name=value".
  2323. X.I Name
  2324. is the name of the variable and
  2325. X.I value
  2326. is its value in one of the formats mentioned above.
  2327. No interbedded blanks are allowed.
  2328. The arguments may be in any order.
  2329. X.PP
  2330. Integer and floating point vectors may also be input by the construction
  2331. X.I "name=value1,value2,value3,...".
  2332. Only use this form of input if the program is expecting a vector or else
  2333. you will probably overwrite some variable or cause a memory fault.
  2334. X.PP
  2335. In the parameter files individual parameter specifications
  2336. are separated from each other by any number of blanks, tabs, or
  2337. newlines.
  2338. Any line that begins with a # is a comment line, and is ignored.
  2339. Character strings with blanks or tabs can be delimited with
  2340. quotes (') or double quotes (").
  2341. X.SH BUGS
  2342. The current implementation is complicated.
  2343. It is, however, well structured and easily extensible.
  2344. X.SH "AUTHOR"
  2345. Robert W. Clayton developed getpar while in the
  2346. Geophysics Department at Stanford University.
  2347. He was last seen at Cal Tech.
  2348. He welcomes free and widespread distribution. -JFC
  2349. The option of having multiple variables in the
  2350. X.I name
  2351. string was added by Ron Ullmann, Dec. 2, 1982.
  2352. More thanks to R. W. Clayton for the fast, hashed version of
  2353. X.B getpar.
  2354. X.SH "SEE ALSO"
  2355. seplib(9), fetch(9s), getch(9s), getch2(9s), hetch(9s)
  2356. END_OF_FILE
  2357. if test 4757 -ne `wc -c <'Vplot_Kernel/filters/loclib/getpar.mn'`; then
  2358.     echo shar: \"'Vplot_Kernel/filters/loclib/getpar.mn'\" unpacked with wrong size!
  2359. fi
  2360. # end of 'Vplot_Kernel/filters/loclib/getpar.mn'
  2361. fi
  2362. echo shar: End of archive 12 \(of 24\).
  2363. cp /dev/null ark12isdone
  2364. MISSING=""
  2365. 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
  2366.     if test ! -f ark${I}isdone ; then
  2367.     MISSING="${MISSING} ${I}"
  2368.     fi
  2369. done
  2370. if test "${MISSING}" = "" ; then
  2371.     echo You have unpacked all 24 archives.
  2372.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2373. else
  2374.     echo You still need to unpack the following archives:
  2375.     echo "        " ${MISSING}
  2376. fi
  2377. ##  End of shell archive.
  2378. exit 0
  2379.