home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume02 / sunplot < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  30.5 KB

  1. From mipos3!omepd!intelisc!littlei!uunet!husc6!mit-eddie!ll-xn!ames!necntc!ncoast!allbery Tue Feb  9 21:18:37 PST 1988
  2. Article 294 of comp.sources.misc:
  3. Path: td2cad!mipos3!omepd!intelisc!littlei!uunet!husc6!mit-eddie!ll-xn!ames!necntc!ncoast!allbery
  4. From: sjoerd@cs.vu.nl (Sjoerd Mullender)
  5. Newsgroups: comp.sources.misc
  6. Subject: v02i047: sunplot - Unix plot backend for Sun
  7. Message-ID: <7195@ncoast.UUCP>
  8. Date: 6 Feb 88 01:29:14 GMT
  9. Sender: allbery@ncoast.UUCP
  10. Organization: V.U. Informatica, Amsterdam, the Netherlands
  11. Lines: 1250
  12. Approved: allbery@ncoast.UUCP
  13. X-Archive: comp.sources.misc/8802/10
  14. Comp.sources.misc: Volume 2, Issue 47
  15. Submitted-By: "Sjoerd Mullender" <sjoerd@cs.vu.nl>
  16. Archive-Name: sunplot
  17.  
  18. Comp.sources.misc: Volume 2, Issue 47
  19. Submitted-By: "Sjoerd Mullender" <sjoerd@cs.vu.nl>
  20. Archive-Name: sunplot
  21.  
  22. This is a backend for Unix plot code (see plot(5)) for the Sun workstation.
  23. It creates a window in which the plot is displayed.
  24.  
  25. : This is a shar archive.  Extract with sh, not csh.
  26. : This archive ends with exit, so do not worry about trailing junk.
  27. : --------------------------- cut here --------------------------
  28. PATH=/bin:/usr/bin:/usr/ucb
  29. echo Extracting 'README'
  30. sed 's/^X//' > 'README' << '+ END-OF-FILE ''README'
  31. XThis program was written on a Sun 3/50 running SunOS 3.2.
  32. XIt also compiles and runs on a Sun 3/50 running SunOS 3.4.
  33. X
  34. XTo make simply type ``make''.
  35. XTo install, check the Makefile to see if all the names are correct.  Then
  36. Xtype ``make install''.
  37. X
  38. XIf you find any bugs or if you have any suggestions or improvements, please
  39. Xdrop me a note at the address below.
  40. X
  41. XYou might try the command
  42. X    echo 0 0 1 1 2 4 3 9 4 16 | spline | graph | sunplot
  43. Xafter which a window pops up.  Then click the ``Next Page'' button.
  44. X
  45. XSjoerd Mullender
  46. XDept. of Mathematics and Computer Science
  47. XFree University
  48. XAmsterdam
  49. XNetherlands
  50. X
  51. XEmail: sjoerd@cs.vu.nl
  52. XIf this doesn't work, try ...!seismo!mcvax!cs.vu.nl!sjoerd or
  53. X...!seismo!mcvax!vu44!sjoerd or sjoerd%cs.vu.nl@seismo.css.gov.
  54. + END-OF-FILE README
  55. chmod 'u=rw,g=r,o=r' 'README'
  56. set `wc -c 'README'`
  57. count=$1
  58. case $count in
  59. 756)    :;;
  60. *)    echo 'Bad character count in ''README' >&2
  61.         echo 'Count should be 756' >&2
  62. esac
  63. echo Extracting 'Makefile'
  64. sed 's/^X//' > 'Makefile' << '+ END-OF-FILE ''Makefile'
  65. X# The names of the installed binary and manual page.
  66. X# Feel free to change.
  67. XBINARY    = /usr/local/sunplot
  68. XMANUAL    = /usr/man/manl/sunplot.l
  69. X
  70. XCFLAGS    = -O
  71. X
  72. Xsunplot:    sunplot.o
  73. X        $(CC) -o sunplot sunplot.o -lsuntool -lsunwindow -lpixrect
  74. X
  75. Xinstall:    sunplot
  76. X        cp sunplot $(BINARY)
  77. X        cp sunplot.1 $(MANUAL)
  78. X
  79. Xclean:
  80. X        rm -f sunplot *.o core make.out
  81. X
  82. Xsunplot.o:    sunplot.icon
  83. + END-OF-FILE Makefile
  84. chmod 'u=rw,g=r,o=r' 'Makefile'
  85. set `wc -c 'Makefile'`
  86. count=$1
  87. case $count in
  88. 364)    :;;
  89. *)    echo 'Bad character count in ''Makefile' >&2
  90.         echo 'Count should be 364' >&2
  91. esac
  92. echo Extracting 'sunplot.1'
  93. sed 's/^X//' > 'sunplot.1' << '+ END-OF-FILE ''sunplot.1'
  94. X.TH SUNPLOT 1
  95. X.SH NAME
  96. Xsunplot \- plotter backend for Sun workstation
  97. X.SH SYNOPSIS
  98. X.B sunplot
  99. X[
  100. X.B \-c
  101. X.I canvas_size
  102. X] [
  103. X.B \-h
  104. X.I horizontal_size
  105. X] [
  106. X.B \-v
  107. X.I vertical_size
  108. X] [
  109. X.B \-f
  110. X.I font_name
  111. X] [
  112. X.B \-r
  113. X] [
  114. X.B \-x
  115. X] [
  116. X.B \-y
  117. X] [
  118. X.B \-l
  119. X] [
  120. X.B \-s
  121. X]
  122. X.SH DESCRIPTION
  123. X.I Sunplot
  124. Xreads UNIX plotter code (see
  125. X.IR plot (5))
  126. Xfrom standard input and displays it in a Sun window.
  127. XThe window consists of two subwindows.
  128. XAt the top is a control panel with a number of buttons and below it is
  129. Xa window with a canvas on which
  130. X.I sunplot
  131. Xdraws and a horizontal and a vertical scrollbar with which you can select
  132. Xwhich part of the canvas you want to see in the window.
  133. XThe buttons in the control panel have the following functions:
  134. X.TP
  135. X.B "Next Page"
  136. XDraw the next page.
  137. XPages are separated by an
  138. X.B e
  139. X(the
  140. X.I erase
  141. Xfunction in the
  142. X.IR plot (3X)
  143. Xlibrary).
  144. XWhile
  145. X.I sunplot
  146. Xis still reading a page this button is not displayed.
  147. X.TP
  148. X.B Redraw
  149. XRedraw the current page.
  150. X.TP
  151. X.B Zoom
  152. XZoom the current page.
  153. X.I Sunplot
  154. Xfinds the most extreme x- and y-coordinates in the current page and uses
  155. Xthose values in stead of the values given by the
  156. X.B s
  157. Xcommand (the
  158. X.I space
  159. Xfunction) for scaling.
  160. X.TP
  161. X.B Options
  162. X.I Sunplot
  163. Xdisplays a window where you can set certain options.
  164. XSee the description below.
  165. X.TP
  166. X.B Dump
  167. X.I Sunplot
  168. Xdisplays a window with three items.
  169. XYou should type a file name after the string
  170. X.B Dump to file:
  171. Xand then press the
  172. X.B Done
  173. Xbutton.
  174. X.I Sunplot
  175. Xwill then dump the plot into the named file in the format chosen with the
  176. X.B Dump format
  177. Xitem.
  178. XThe dump can be in either
  179. X.IR rasterfile (5)
  180. Xor
  181. X.I icon
  182. Xformat.
  183. XIf the file name is empty,
  184. X.I sunplot
  185. Xwill do nothing.
  186. X.TP
  187. X.B "Fit Screen"
  188. XResize the window so that the canvas fits.
  189. X.TP
  190. X.B Quit
  191. XExit
  192. X.IR sunplot .
  193. X.SH OPTIONS
  194. XWhen the
  195. X.B Options
  196. Xbutton is pressed
  197. X.I sunplot
  198. Xwill display a window with the following items.
  199. X.TP
  200. X.B Done
  201. XDone setting options.
  202. X.I Sunplot
  203. Xwill automatically do a redraw of the page with the new settings.
  204. X.TP
  205. X.B Rotate
  206. XRotate the plot by 90 degrees counter-clockwise.
  207. X.TP
  208. X.B "X Mirror"
  209. XMirror the plot in the x-axis.
  210. X.TP
  211. X.B "Y Mirror"
  212. XMirror the plot in the y-axis.
  213. X.TP
  214. X.B Label
  215. XIf on, display labels.
  216. X.TP
  217. X.B Square
  218. XIf on, the canvas is square, otherwise you can set the horizontal and vertical
  219. Xsizes of the canvas separately.
  220. X.TP
  221. X.B Reverse
  222. XDisplay the canvas in reverse video.
  223. X.TP
  224. X.B "Font name"
  225. XThe name of the font to be used for the labels.
  226. XIf the name is not absolute it is taken to be relative to the system's fonts
  227. Xdirectory /usr/lib/fonts/fixedwidthfonts.
  228. XIf no name is given or the named file does not contain a font, the default
  229. Xfont is used.
  230. X.TP
  231. X.B "Canvas size"
  232. XThe size of the canvas.
  233. XThe size of the canvas is measured in pixels.
  234. XThis is only displayed when the
  235. X.B Square
  236. Xtoggle is on.
  237. X.TP
  238. X.B "Horizontal size"
  239. XThe horizontal size of the canvas.
  240. XThis is only displayed when the
  241. X.B Square
  242. Xtoggle is off.
  243. X.TP
  244. X.B "Vertical size"
  245. XThe vertical size of the canvas.
  246. XThis is only displayed when the
  247. X.B Square
  248. Xtoggle is off.
  249. X.PP
  250. XThe following command line options are recognized.
  251. X.IP "\f3\-c\fP \f2canvas_size\fP"
  252. XSet the canvas size.
  253. X.I Canvas_size
  254. Xmust be between 64 and 2048.
  255. XThis also switches on the
  256. X.B Square
  257. Xtoggle.
  258. X.IP "\f3\-h\fP \f2horizontal_size\fP"
  259. XSet the horizontal size.
  260. X.I Horizontal_size
  261. Xmust be between 64 and 2048.
  262. XThis also switches off the
  263. X.B Square
  264. Xtoggle.
  265. X.IP "\f3\-v\fP \f2vertical_size\fP"
  266. XSet the vertical size.
  267. X.I Vertical_size
  268. Xmust be between 64 and 2048.
  269. XThis also switches off the
  270. X.B Square
  271. Xtoggle.
  272. X.IP "\f3\-f\fP \f2font_name\fP"
  273. XSet the font to be used for labels.
  274. XThis is independent from the font that is used for the text in the control
  275. Xpanel and the options and dump windows.
  276. XA name not starting with ``/'' is taken to be relative to the system's font
  277. Xdirectory /usr/lib/fonts/fixedwidthfonts.
  278. X.IP \f3\-r\fP
  279. XRotate the plot by 90 degrees counter-clockwise.
  280. X.IP \f3\-x\fP
  281. XMirror the plot in the x-axis.
  282. X.IP \f3\-y\fP
  283. XMirror the plot in the y-axis.
  284. X.IP \f3\-l\fP
  285. XToggle labeling.
  286. X.IP \f3\-s\fP
  287. XToggle square mode.
  288. X.PP
  289. XThe
  290. X.BR \-r ,
  291. X.B \-x
  292. Xand
  293. X.B \-y
  294. Xoptions are evaluated left to right and can be repeated to get cumulative
  295. Xeffect.
  296. X.I Sunplot
  297. Xalso recognizes the generic tool arguments; see
  298. X.IR suntools (1)
  299. Xfor a list of these arguments.
  300. X.PP
  301. XThe defaults are: batching on, labels printed, square canvas, canvas is 512
  302. Xby 512 pixels, the point
  303. X.I "(0,\ 0)"
  304. Xis in the lower left-hand corner.
  305. X.SH BUGS
  306. XThe
  307. X.I linemod
  308. Xfunction is not implemented.
  309. X.PP
  310. XThe
  311. X.B zoom
  312. Xcommand doesn't take the height of labels into account.
  313. X.SH "SEE ALSO"
  314. X.IR plot (3X),
  315. X.IR plot (5),
  316. Xand
  317. X.IR rasterfile (5).
  318. X.SH AUTHOR
  319. XSjoerd Mullender, Free University, Amsterdam <sjoerd@cs.vu.nl>
  320. + END-OF-FILE sunplot.1
  321. chmod 'u=rw,g=r,o=r' 'sunplot.1'
  322. set `wc -c 'sunplot.1'`
  323. count=$1
  324. case $count in
  325. 4672)    :;;
  326. *)    echo 'Bad character count in ''sunplot.1' >&2
  327.         echo 'Count should be 4672' >&2
  328. esac
  329. echo Extracting 'sunplot.c'
  330. sed 's/^X//' > 'sunplot.c' << '+ END-OF-FILE ''sunplot.c'
  331. X/*
  332. X * Sunplot - plotter backend for Sun workstation
  333. X *
  334. X * Copyright (c) 1987 by Sjoerd Mullender, Vrije Universiteit, Amsterdam.
  335. X *
  336. X * This program may be redistributed without fee as long as this copyright
  337. X * notice is in tact.
  338. X * Any commercial use is strictly prohibited.
  339. X */
  340. X
  341. X#include <stdio.h>
  342. X#include <suntool/sunview.h>
  343. X#include <suntool/scrollbar.h>
  344. X#include <suntool/panel.h>
  345. X#include <suntool/canvas.h>
  346. X
  347. X/*
  348. X * Configurable definitions
  349. X */
  350. X#define INIT_CANVAS_SIZE    512
  351. X#define DEFAULT_SPACE        4096
  352. X#define MAX_NAME_LENGTH        128
  353. X
  354. X/*
  355. X * Unconfigurable definitions
  356. X */
  357. X#define BIG            0x7FFFFFFF
  358. X
  359. X#define FORMAT_RASTER        0
  360. X#define FORMAT_ICON        1
  361. X
  362. X#define LABEL            0
  363. X#define SQUARE            1
  364. X#define REVERSE            2
  365. X
  366. Xint client_object;        /* used for notifier */
  367. Xint *me = &client_object;    /* idem */
  368. X
  369. Xint curx, cury;            /* current position on plot */
  370. Xint lox, loy, hix = DEFAULT_SPACE, hiy = DEFAULT_SPACE;    /* current space */
  371. Xint slox, shix, sloy, shiy;    /* saved space settings for zooming */
  372. Xint minx, maxx, miny, maxy;    /* minimum and maximum values encountered */
  373. Xint hor_size, ver_size;        /* canvas size */
  374. Xint turned, xmirror, ymirror;    /* orientation of plot */
  375. Xint zooming;
  376. Xint make_label = TRUE;        /* print labels */
  377. Xint square = TRUE;        /* canvas is square */
  378. Xint reverse = FALSE;        /* reverse video */
  379. XFrame frame, dump_frame, options_frame;
  380. XPanel panel, dump_panel, options_panel;
  381. XPanel_item next_page_item;
  382. XPanel_item hor_size_item, ver_size_item, toggle_item, font_item;
  383. XPanel_item dump_format, dump_file_item;
  384. XCanvas canvas;
  385. XPixwin *pw;
  386. XPixfont *font;
  387. Xchar font_name[MAX_NAME_LENGTH];
  388. Xchar font_dir[] = "/usr/lib/fonts/fixedwidthfonts/";
  389. X
  390. Xshort sunplot_icon_image[] = {
  391. X#include "sunplot.icon"
  392. X};
  393. Xmpr_static(sunplot_icon, 64, 64, 1, sunplot_icon_image);
  394. X
  395. Xchar *malloc(), *realloc();
  396. X
  397. X/*
  398. X *  input module
  399. X */
  400. X
  401. Xstatic char *plotcommands, *plptr;
  402. Xstatic int plotlength;
  403. Xstatic int maxplotlength;
  404. Xstatic int eof_seen;
  405. X
  406. Xgetchr()
  407. X{
  408. X    register c;
  409. X
  410. X    if (plptr < plotcommands + plotlength)
  411. X        return *plptr++ & 0xFF;
  412. X    if (eof_seen || (c = getchar()) == EOF) {
  413. X        eof_seen = 1;
  414. X        return EOF;
  415. X    }
  416. X    if (plotlength >= maxplotlength) {
  417. X        plotcommands = realloc(plotcommands, maxplotlength *= 2);
  418. X        plptr = plotcommands + plotlength;
  419. X    }
  420. X    *plptr++ = c;
  421. X    plotlength++;
  422. X    return c;
  423. X}
  424. X
  425. Xgetint()
  426. X{
  427. X    register n;
  428. X
  429. X    n = getchr();
  430. X    n = n | getchr() << 8;
  431. X    if (n & 0x8000)            /* sign extend */
  432. X        n |= ~0x7FFF;
  433. X    return n;
  434. X}
  435. X
  436. Xchar *getstr()
  437. X{
  438. X    register i = plptr - plotcommands;
  439. X    register c;
  440. X
  441. X    while ((c = getchr()) != EOF && c != '\0' && c != '\n')
  442. X        ;
  443. X    plptr[-1] = 0;
  444. X    return plotcommands + i;
  445. X}
  446. X
  447. X/*
  448. X * plot module
  449. X */
  450. X
  451. X#define point(x,y)    pw_put(pw, plotx(x, y), ploty(x, y), !reverse)
  452. X
  453. X#define line(x0,y0,x1,y1)    pw_vector(pw,plotx(x0,y0),ploty(x0,y0),plotx(x1,y1),ploty(x1,y1),PIX_SRC,!reverse)
  454. X
  455. X#define convx(x,s)    (((x) - lox) * (s) / (hix - lox))
  456. X#define convy(y,s)    (((y) - loy) * (s) / (hiy - loy))
  457. X
  458. Xinitplot()
  459. X{
  460. X    plptr = plotcommands = malloc(maxplotlength = 1024);
  461. X    plotlength = 0;
  462. X}
  463. X
  464. Xplotx(x, y)
  465. X{
  466. X    register a;
  467. X
  468. X    switch (turned) {
  469. X    case 0: a = convx(x, hor_size); break;
  470. X    case 1: a = hor_size - 1 - convy(y, hor_size); break;
  471. X    case 2: a = hor_size - 1 - convx(x, hor_size); break;
  472. X    case 3: a = convy(y, hor_size); break;
  473. X    }
  474. X    return xmirror ? hor_size - 1 - a : a;
  475. X}
  476. X
  477. Xploty(x, y)
  478. X{
  479. X    register a;
  480. X
  481. X    switch (turned) {
  482. X    case 0: a = ver_size - 1 - convy(y, ver_size); break;
  483. X    case 1: a = ver_size - 1 - convx(x, ver_size); break;
  484. X    case 2: a = convy(y, ver_size); break;
  485. X    case 3: a = convx(x, ver_size); break;
  486. X    }
  487. X    a = ymirror ? ver_size - 1 - a : a;
  488. X    return zooming ? a+1 : a;
  489. X}
  490. X
  491. Xlabel(s)
  492. Xchar *s;
  493. X{
  494. X    struct pr_size pr_size;
  495. X
  496. X    if (!make_label)
  497. X        return 0;
  498. X    pw_text(pw, plotx(curx, cury), ploty(curx, cury), reverse ? PIX_NOT(PIX_SRC)&PIX_DST : PIX_SRC|PIX_DST, font, s);
  499. X    pr_size = pf_textwidth(strlen(s), font, s);
  500. X    return pr_size.x * (hix - lox) / hor_size;
  501. X}
  502. X
  503. Xisqrt(n)
  504. X{
  505. X    int a, b, c;
  506. X
  507. X    a = n;
  508. X    b = n;
  509. X    if (n > 1) {
  510. X        while (a > 0) {
  511. X            a = a >> 2;
  512. X            b = b >> 1;
  513. X        }
  514. X        do {
  515. X            a = b;
  516. X            c = n / b;
  517. X            b = (c + a) >> 1;
  518. X        } while ((a - c) < -1 || (a - c) > 1);
  519. X    }
  520. X    return b;
  521. X}
  522. X
  523. Xstatic setcir(x, y, a1, b1, c1, a2, b2, c2)
  524. X{
  525. X    if (a1 * y - b1 * x >= c1 && a2 * y - b2 * x <= c2)
  526. X        point(x, y);
  527. X}
  528. X
  529. Xarc(x, y, x1, y1, x2, y2)
  530. X{
  531. X    register a1 = x1 - x, b1 = y1 - y, a2 = x2 - x, b2 = y2 - y;
  532. X    register c1 = a1 * y - b1 * x, c2 = a2 * y - b2 * x;
  533. X    register r2 = a1 * a1 + b1 * b1;
  534. X    register i, di, sqrt, dx, dy;
  535. X
  536. X    dx = (hix - lox) / hor_size;
  537. X    dy = (hiy - loy) / ver_size;
  538. X    di = dx < dy ? dx : dy;
  539. X    if (di <= 0)
  540. X        di = 1;
  541. X    for (i = isqrt(r2 >> 1); i >= 0; i -= di) {
  542. X        sqrt = isqrt(r2 - i * i);
  543. X        setcir(x + i, y + sqrt, a1, b1, c1, a2, b2, c2);
  544. X        setcir(x + i, y - sqrt, a1, b1, c1, a2, b2, c2);
  545. X        setcir(x - i, y + sqrt, a1, b1, c1, a2, b2, c2);
  546. X        setcir(x - i, y - sqrt, a1, b1, c1, a2, b2, c2);
  547. X        setcir(x + sqrt, y + i, a1, b1, c1, a2, b2, c2);
  548. X        setcir(x + sqrt, y - i, a1, b1, c1, a2, b2, c2);
  549. X        setcir(x - sqrt, y + i, a1, b1, c1, a2, b2, c2);
  550. X        setcir(x - sqrt, y - i, a1, b1, c1, a2, b2, c2);
  551. X    }
  552. X}
  553. X
  554. Xcircle(x, y, r)
  555. X{
  556. X    arc(x, y, x + r, y, x - r, y);
  557. X    arc(x, y, x - r, y, x + r, y);
  558. X}
  559. X
  560. XNotify_value input_reader(me, fd)
  561. Xint *me;
  562. Xint fd;
  563. X{
  564. X    int newx, newy, x, y, r;
  565. X    register char *p;
  566. X
  567. X    do {
  568. X        switch (getchr()) {
  569. X        case 'm':                /* move */
  570. X            curx = getint();
  571. X            cury = getint();
  572. X            if (curx < minx) minx = curx;
  573. X            if (curx > maxx) maxx = curx;
  574. X            if (cury < miny) miny = cury;
  575. X            if (cury > maxy) maxy = cury;
  576. X            break;
  577. X        case 'n':                /* cont */
  578. X            newx = getint();
  579. X            newy = getint();
  580. X            line(curx, cury, newx, newy);
  581. X            curx = newx;
  582. X            cury = newy;
  583. X            if (curx < minx) minx = curx;
  584. X            if (curx > maxx) maxx = curx;
  585. X            if (cury < miny) miny = cury;
  586. X            if (cury > maxy) maxy = cury;
  587. X            break;
  588. X        case 'p':                /* point */
  589. X            curx = getint();
  590. X            cury = getint();
  591. X            point(curx, cury);
  592. X            if (curx < minx) minx = curx;
  593. X            if (curx > maxx) maxx = curx;
  594. X            if (cury < miny) miny = cury;
  595. X            if (cury > maxy) maxy = cury;
  596. X            break;
  597. X        case 'l':                /* line */
  598. X            newx = getint();
  599. X            newy = getint();
  600. X            curx = getint();
  601. X            cury = getint();
  602. X            line(newx, newy, curx, cury);
  603. X            if (newx < minx) minx = newx;
  604. X            if (newx > maxx) maxx = newx;
  605. X            if (newy < miny) miny = newy;
  606. X            if (newy > maxy) maxy = newy;
  607. X            if (curx < minx) minx = curx;
  608. X            if (curx > maxx) maxx = curx;
  609. X            if (cury < miny) miny = cury;
  610. X            if (cury > maxy) maxy = cury;
  611. X            break;
  612. X        case 't':                /* label */
  613. X            p = getstr();
  614. X            curx += label(p);
  615. X            if (curx < minx) minx = curx;
  616. X            if (curx > maxx) maxx = curx;
  617. X            break;
  618. X        case 'a':                /* arc */
  619. X            x = getint();
  620. X            y = getint();
  621. X            newx = getint();
  622. X            newy = getint();
  623. X            curx = getint();
  624. X            cury = getint();
  625. X            arc(x, y, newx, newy, curx, cury);
  626. X            if (x < minx) minx = x;
  627. X            if (x > maxx) maxx = x;
  628. X            if (y < miny) miny = y;
  629. X            if (y > maxy) maxy = y;
  630. X            if (newx < minx) minx = newx;
  631. X            if (newx > maxx) maxx = newx;
  632. X            if (newy < miny) miny = newy;
  633. X            if (newy > maxy) maxy = newy;
  634. X            if (curx < minx) minx = curx;
  635. X            if (curx > maxx) maxx = curx;
  636. X            if (cury < miny) miny = cury;
  637. X            if (cury > maxy) maxy = cury;
  638. X            break;
  639. X        case 'c':                /* circle */
  640. X            curx = getint();
  641. X            cury = getint();
  642. X            r = getint();
  643. X            circle(curx, cury, r);
  644. X            if (curx - r < minx) minx = curx - r;
  645. X            if (curx + r > maxx) maxx = curx + r;
  646. X            if (cury - r < miny) miny = cury - r;
  647. X            if (cury + r > maxy) maxy = cury + r;
  648. X            break;
  649. X        case 'e':                /* erase */
  650. X            panel_set(next_page_item, PANEL_SHOW_ITEM, TRUE, 0);
  651. X            /* fall through */
  652. X        case EOF:
  653. X            notify_set_input_func(me, NOTIFY_FUNC_NULL, fd);
  654. X            if (zooming) {
  655. X                lox = slox;
  656. X                hix = shix;
  657. X                loy = sloy;
  658. X                hiy = shiy;
  659. X                zooming = 0;
  660. X            }
  661. X            return NOTIFY_DONE;
  662. X        case 'f':                /* linemod */
  663. X            getstr();
  664. X            break;
  665. X        case 's':                /* space */
  666. X            if (zooming) {
  667. X                slox = getint();
  668. X                sloy = getint();
  669. X                shix = getint();
  670. X                shiy = getint();
  671. X            } else {
  672. X                lox = getint();
  673. X                loy = getint();
  674. X                hix = getint();
  675. X                hiy = getint();
  676. X            }
  677. X            break;
  678. X        }
  679. X    } while (plptr < plotcommands + plotlength || stdin->_cnt > 0);
  680. X    return NOTIFY_DONE;
  681. X}
  682. X
  683. X/*
  684. X * button routines
  685. X */
  686. X
  687. Xrestartplot()
  688. X{
  689. X    minx = BIG;
  690. X    maxx = -BIG;
  691. X    miny = BIG;
  692. X    maxy = -BIG;
  693. X    plptr = plotcommands;
  694. X
  695. X    /* clear the canvas */
  696. X    pw_writebackground(pw, 0, 0, (int) window_get(canvas, CANVAS_WIDTH),
  697. X                (int) window_get(canvas, CANVAS_HEIGHT),
  698. X                reverse ? PIX_SET : PIX_CLR);
  699. X}
  700. X
  701. Xresetplot()
  702. X{
  703. X    restartplot();
  704. X    plotlength = 0;
  705. X}
  706. X
  707. Xvoid redraw()
  708. X{
  709. X    if (zooming) {
  710. X        lox = slox;
  711. X        hix = shix;
  712. X        loy = sloy;
  713. X        hiy = shiy;
  714. X        zooming = 0;
  715. X    }
  716. X    restartplot();
  717. X    input_reader(me, fileno(stdin));
  718. X}
  719. X
  720. Xvoid nextpage()
  721. X{
  722. X    resetplot();
  723. X    panel_set(next_page_item, PANEL_SHOW_ITEM, FALSE, 0);
  724. X    notify_set_input_func(me, input_reader, fileno(stdin));
  725. X    if (stdin->_cnt > 0)
  726. X        input_reader(me, fileno(stdin));
  727. X}
  728. X
  729. Xvoid zoom()
  730. X{
  731. X    int a;
  732. X
  733. X    if (!zooming) {
  734. X        slox = lox;
  735. X        shix = hix;
  736. X        sloy = loy;
  737. X        shiy = hiy;
  738. X        zooming = 1;
  739. X    }
  740. X    if (maxx == minx) {
  741. X        maxx++;
  742. X        minx--;
  743. X    }
  744. X    if (maxy == miny) {
  745. X        maxy++;
  746. X        miny--;
  747. X    }
  748. X    if ((a = (maxx-minx) * (shiy-sloy) / (shix-slox)) >= maxy-miny) {
  749. X        loy = miny - (a - maxy + miny) / 2;
  750. X        hiy = loy + a;
  751. X        lox = minx;
  752. X        hix = maxx;
  753. X    } else {
  754. X        a = (maxy - miny) * (shix - slox) / (shiy - sloy);
  755. X        lox = minx - (a - maxx + minx) / 2;
  756. X        hix = lox + a;
  757. X        loy = miny;
  758. X        hiy = maxy;
  759. X    }
  760. X    hix++;
  761. X    hiy++;
  762. X    restartplot();
  763. X    input_reader(me, fileno(stdin));
  764. X}
  765. X
  766. Xvoid quit()
  767. X{
  768. X    /* don't ask for confirmation */
  769. X    if (font)
  770. X        pf_close(font);
  771. X    window_set(frame, FRAME_NO_CONFIRM, TRUE, 0);
  772. X    window_destroy(frame);
  773. X}
  774. X
  775. Xvoid turn()
  776. X{
  777. X    int tmp;
  778. X
  779. X    turned = (turned + 1) & 3;
  780. X    tmp = xmirror;
  781. X    xmirror = ymirror;
  782. X    ymirror = tmp;
  783. X}
  784. X
  785. Xvoid mirrorx()
  786. X{
  787. X    xmirror ^= 1;
  788. X}
  789. X
  790. Xvoid mirrory()
  791. X{
  792. X    ymirror ^= 1;
  793. X}
  794. X
  795. Xvoid toggle_proc()
  796. X{
  797. X    if ((int) panel_get(toggle_item, PANEL_TOGGLE_VALUE, SQUARE)) {
  798. X        panel_set(ver_size_item,
  799. X            PANEL_SHOW_ITEM,    FALSE,
  800. X            0);
  801. X        panel_set(hor_size_item,
  802. X            PANEL_LABEL_STRING,    "Canvas size:     ",
  803. X            0);
  804. X    } else {
  805. X        panel_set(ver_size_item,
  806. X            PANEL_SHOW_ITEM,    TRUE,
  807. X            0);
  808. X        panel_set(hor_size_item,
  809. X            PANEL_LABEL_STRING,    "Horizontal size: ",
  810. X            0);
  811. X    }
  812. X}
  813. X
  814. Xvoid options()
  815. X{
  816. X    window_set(options_frame, WIN_SHOW, TRUE, 0);
  817. X}
  818. X
  819. Xvoid options_done()
  820. X{
  821. X    register int r;
  822. X    char *f;
  823. X    Cursor cursor;
  824. X
  825. X    window_set(options_frame, WIN_SHOW, FALSE, 0);
  826. X    r = (int) panel_get(hor_size_item, PANEL_VALUE);
  827. X    if (r != hor_size) {
  828. X        window_set(canvas, CANVAS_WIDTH, r, 0);
  829. X        hor_size = r;
  830. X    }
  831. X    if (square)
  832. X        r = hor_size;
  833. X    else
  834. X        r = (int) panel_get(ver_size_item, PANEL_VALUE);
  835. X    if (r != ver_size) {
  836. X        window_set(canvas, CANVAS_HEIGHT, r, 0);
  837. X        ver_size = r;
  838. X    }
  839. X    f = (char *) panel_get_value(font_item);
  840. X    if (f == 0 || *f == 0) {
  841. X        if (font_name[0] != 0) {
  842. X            font_name[0] = 0;
  843. X            if (font)
  844. X                pf_close(font);
  845. X            font = pf_default();
  846. X        }
  847. X    } else {
  848. X        if (font_name[0] == 0 || strcmp(f, font_name) != 0) {
  849. X            strcpy(font_name, f);
  850. X            f = font_name;
  851. X            if (*f != '/') {
  852. X                f = malloc(strlen(font_dir)+strlen(font_name)+1);
  853. X                strcpy(f, font_dir);
  854. X                strcat(f, font_name);
  855. X            }
  856. X            if (font)
  857. X                pf_close(font);
  858. X            font = pf_open(f);
  859. X            if (f != font_name)
  860. X                free(f);
  861. X        }
  862. X    }
  863. X    if (font == 0) {
  864. X        font_name[0] = 0;
  865. X        font = pf_default();
  866. X    }
  867. X    make_label = (int) panel_get(toggle_item, PANEL_TOGGLE_VALUE, LABEL);
  868. X    square = (int) panel_get(toggle_item, PANEL_TOGGLE_VALUE, SQUARE);
  869. X    reverse = (int) panel_get(toggle_item, PANEL_TOGGLE_VALUE, REVERSE);
  870. X    cursor = (Cursor) window_get(canvas, WIN_CURSOR);
  871. X    cursor_set(cursor,
  872. X            CURSOR_OP, reverse ? PIX_SRC^PIX_DST : PIX_SRC|PIX_DST,
  873. X            0);
  874. X    window_set(canvas, WIN_CURSOR, cursor, 0);
  875. X    redraw();
  876. X}
  877. X
  878. Xvoid dump()
  879. X{
  880. X    window_set(dump_frame, WIN_SHOW, TRUE, 0);
  881. X}
  882. X
  883. Xvoid dump_done()
  884. X{
  885. X    char *file;
  886. X    int width, height;
  887. X    register int x, y;
  888. X    register char *s;
  889. X    register short *p;
  890. X    FILE *f;
  891. X
  892. X    /* we use the fact that the canvas is retained */
  893. X    file = (char *) panel_get_value(dump_file_item);
  894. X    if (file != 0 && *file != 0 && (f = fopen(file, "w")) != 0) {
  895. X        width = (int) window_get(canvas, CANVAS_WIDTH);
  896. X        height = (int) window_get(canvas, CANVAS_HEIGHT);
  897. X        switch ((int) panel_get_value(dump_format)) {
  898. X        case FORMAT_RASTER:
  899. X            pr_dump(pw->pw_prretained, f, (colormap_t *) 0,
  900. X                            RT_STANDARD, 0);
  901. X            break;
  902. X        case FORMAT_ICON:
  903. X            p = mpr_d(pw->pw_prretained)->md_image;
  904. X            fprintf(f, "\
  905. X/* Format_version=1, Width=%d, Height=%d, Depth=1, Valid_bits_per_item=16\n\
  906. X */\n", (width+15) & ~15, height);
  907. X            for (y = 0; y < height; y++) {
  908. X                s = "\t";
  909. X                for (x = 0; x < width; x += 16) {
  910. X                    fprintf(f, "%s0x%04x,", s, *p & 0xFFFF);
  911. X                    p++;
  912. X                    s = "";
  913. X                }
  914. X                fprintf(f, "\n");
  915. X            }
  916. X            break;
  917. X        }
  918. X        fclose(f);
  919. X    }
  920. X    window_set(dump_frame, WIN_SHOW, FALSE, 0);
  921. X}
  922. X
  923. Xvoid fit_screen()
  924. X{
  925. X    register int w, h;
  926. X    
  927. X    w = hor_size + (int) scrollbar_get((Scrollbar) window_get(canvas, WIN_VERTICAL_SCROLLBAR), SCROLL_THICKNESS);
  928. X    h = ver_size + (int) scrollbar_get((Scrollbar) window_get(canvas, WIN_HORIZONTAL_SCROLLBAR), SCROLL_THICKNESS);
  929. X    window_set(canvas, WIN_WIDTH, w, WIN_HEIGHT, h, 0);
  930. X    window_set(canvas, CANVAS_WIDTH, hor_size, CANVAS_HEIGHT, ver_size, 0);
  931. X    window_set(panel, WIN_WIDTH, w, 0);
  932. X    window_fit(frame);
  933. X}
  934. X
  935. X/*
  936. X * initialization
  937. X */
  938. X
  939. Xvoid dump_init()
  940. X{
  941. X    register Pixrect *pr;
  942. X
  943. X    dump_frame = window_create(frame, FRAME,
  944. X            FRAME_DONE_PROC,    dump_done,
  945. X            0);
  946. X    dump_panel = window_create(dump_frame, PANEL, 0);
  947. X    pr = panel_button_image(dump_panel, "Done", 0, (Pixfont *) 0);
  948. X    (void) panel_create_item(dump_panel, PANEL_BUTTON,
  949. X            PANEL_LABEL_IMAGE,    pr,
  950. X            PANEL_NOTIFY_PROC,    dump_done,
  951. X            0);
  952. X    /* order of strings is important (see definitions of FORMAT_*) */
  953. X    dump_format = panel_create_item(dump_panel, PANEL_CYCLE,
  954. X            PANEL_LABEL_STRING,    "Dump format:",
  955. X            PANEL_CHOICE_STRINGS,    "Rasterfile format",
  956. X                        "Icon format",
  957. X                        (char *) 0,
  958. X            0);
  959. X    dump_file_item = panel_create_item(dump_panel, PANEL_TEXT,
  960. X            PANEL_LABEL_X,        ATTR_COL(0),
  961. X            PANEL_LABEL_Y,        ATTR_ROW(1),
  962. X            PANEL_VALUE_DISPLAY_LENGTH, 25,
  963. X            PANEL_LABEL_STRING,    "Dump to file:",
  964. X            0);
  965. X    window_fit(dump_panel);
  966. X    window_fit(dump_frame);
  967. X}
  968. X
  969. Xvoid options_init()
  970. X{
  971. X    register Pixrect *pr;
  972. X
  973. X    options_frame = window_create(frame, FRAME,
  974. X            FRAME_DONE_PROC,    options_done,
  975. X            0);
  976. X    options_panel = window_create(options_frame, PANEL, 0);
  977. X
  978. X    pr = panel_button_image(options_panel, "Done", 0, (Pixfont *) 0);
  979. X    (void) panel_create_item(options_panel, PANEL_BUTTON,
  980. X            PANEL_LABEL_IMAGE,    pr,
  981. X            PANEL_NOTIFY_PROC,    options_done,
  982. X            0);
  983. X    pr = panel_button_image(options_panel, "Rotate", 0, (Pixfont*) 0);
  984. X    (void) panel_create_item(options_panel, PANEL_BUTTON,
  985. X            PANEL_NOTIFY_PROC,    turn,
  986. X            PANEL_LABEL_IMAGE,    pr,
  987. X            0);
  988. X    pr = panel_button_image(options_panel, "X Mirror", 0, (Pixfont*) 0);
  989. X    (void) panel_create_item(options_panel, PANEL_BUTTON,
  990. X            PANEL_NOTIFY_PROC,    mirrorx,
  991. X            PANEL_LABEL_IMAGE,    pr,
  992. X            0);
  993. X    pr = panel_button_image(options_panel, "Y Mirror", 0, (Pixfont*) 0);
  994. X    (void) panel_create_item(options_panel, PANEL_BUTTON,
  995. X            PANEL_NOTIFY_PROC,    mirrory,
  996. X            PANEL_LABEL_IMAGE,    pr,
  997. X            0);
  998. X    toggle_item = panel_create_item(options_panel, PANEL_TOGGLE,
  999. X            PANEL_LAYOUT,        PANEL_HORIZONTAL,
  1000. X            PANEL_CHOICE_STRINGS,    "Label",
  1001. X                        "Square",
  1002. X                        "Reverse",
  1003. X                        (char *) 0,
  1004. X            PANEL_TOGGLE_VALUE,    LABEL, make_label,
  1005. X            PANEL_TOGGLE_VALUE,    SQUARE, square,
  1006. X            PANEL_TOGGLE_VALUE,    REVERSE, reverse,
  1007. X            PANEL_NOTIFY_PROC,    toggle_proc,
  1008. X            0);
  1009. X    font_item = panel_create_item(options_panel, PANEL_TEXT,
  1010. X            PANEL_VALUE_DISPLAY_LENGTH, 51,
  1011. X            PANEL_VALUE_STORED_LENGTH, MAX_NAME_LENGTH,
  1012. X            PANEL_LABEL_STRING,    "Font name:",
  1013. X            PANEL_VALUE,        font_name,
  1014. X            0);
  1015. X    hor_size_item = panel_create_item(options_panel, PANEL_SLIDER,
  1016. X            PANEL_LABEL_STRING,    "Horizontal size: ",
  1017. X            PANEL_VALUE,        hor_size,
  1018. X            PANEL_MIN_VALUE,    64,
  1019. X            PANEL_MAX_VALUE,    2048,
  1020. X            PANEL_SLIDER_WIDTH,    200,
  1021. X            0);
  1022. X    ver_size_item = panel_create_item(options_panel, PANEL_SLIDER,
  1023. X            PANEL_LABEL_STRING,    "Vertical size:   ",
  1024. X            PANEL_VALUE,        ver_size,
  1025. X            PANEL_MIN_VALUE,    64,
  1026. X            PANEL_MAX_VALUE,    2048,
  1027. X            PANEL_SLIDER_WIDTH,    200,
  1028. X            0);
  1029. X    window_fit(options_panel);
  1030. X    window_fit(options_frame);
  1031. X    if (square) {
  1032. X        panel_set(ver_size_item,
  1033. X            PANEL_SHOW_ITEM,    FALSE,
  1034. X            0);
  1035. X        panel_set(hor_size_item,
  1036. X            PANEL_LABEL_STRING,    "Canvas size:     ",
  1037. X            0);
  1038. X    }
  1039. X}
  1040. X
  1041. Xvoid panel_init()
  1042. X{
  1043. X    register Pixrect *pr;
  1044. X
  1045. X    panel = window_create(frame, PANEL, 0);
  1046. X    pr = panel_button_image(panel, "Next Page", 0, (Pixfont *) 0);
  1047. X    next_page_item = panel_create_item(panel, PANEL_BUTTON,
  1048. X            PANEL_NOTIFY_PROC,    nextpage,
  1049. X            PANEL_LABEL_IMAGE,    pr,
  1050. X            0);
  1051. X    pr = panel_button_image(panel, "Redraw", 0, (Pixfont *) 0);
  1052. X    (void) panel_create_item(panel, PANEL_BUTTON,
  1053. X            PANEL_NOTIFY_PROC,    redraw,
  1054. X            PANEL_LABEL_IMAGE,    pr,
  1055. X            0);
  1056. X    pr = panel_button_image(panel, "Zoom", 0, (Pixfont *) 0);
  1057. X    (void) panel_create_item(panel, PANEL_BUTTON,
  1058. X            PANEL_NOTIFY_PROC,    zoom,
  1059. X            PANEL_LABEL_IMAGE,    pr,
  1060. X            0);
  1061. X    pr = panel_button_image(panel, "Options", 0, (Pixfont *) 0);
  1062. X    (void) panel_create_item(panel, PANEL_BUTTON,
  1063. X            PANEL_NOTIFY_PROC,    options,
  1064. X            PANEL_LABEL_IMAGE,    pr,
  1065. X            0);
  1066. X    pr = panel_button_image(panel, "Dump", 0, (Pixfont *) 0);
  1067. X    (void) panel_create_item(panel, PANEL_BUTTON,
  1068. X            PANEL_NOTIFY_PROC,    dump,
  1069. X            PANEL_LABEL_IMAGE,    pr,
  1070. X            0);
  1071. X    pr = panel_button_image(panel, "Fit Screen", 0, (Pixfont *) 0);
  1072. X    (void) panel_create_item(panel, PANEL_BUTTON,
  1073. X            PANEL_NOTIFY_PROC,    fit_screen,
  1074. X            PANEL_LABEL_IMAGE,    pr,
  1075. X            0);
  1076. X    pr = panel_button_image(panel, "Quit", 0, (Pixfont *) 0);
  1077. X    (void) panel_create_item(panel, PANEL_BUTTON,
  1078. X            PANEL_NOTIFY_PROC,    quit,
  1079. X            PANEL_LABEL_IMAGE,    pr,
  1080. X            0);
  1081. X    window_fit_height(panel);
  1082. X}
  1083. X
  1084. Xcanvas_init()
  1085. X{
  1086. X    canvas = window_create(frame, CANVAS,
  1087. X            CANVAS_AUTO_SHRINK,    FALSE,
  1088. X            CANVAS_WIDTH,        hor_size,
  1089. X            CANVAS_HEIGHT,        ver_size,
  1090. X            CANVAS_RETAINED,    TRUE,
  1091. X            WIN_VERTICAL_SCROLLBAR,    scrollbar_create(0),
  1092. X            WIN_HORIZONTAL_SCROLLBAR, scrollbar_create(0),
  1093. X            0);
  1094. X    pw = canvas_pixwin(canvas);
  1095. X}
  1096. X
  1097. Xmain(argc, argv)
  1098. Xchar **argv;
  1099. X{
  1100. X    initplot();
  1101. X
  1102. X    hor_size = ver_size = INIT_CANVAS_SIZE;
  1103. X    frame = window_create(NULL, FRAME,
  1104. X            FRAME_LABEL,        "Sunplot",
  1105. X            FRAME_SUBWINDOWS_ADJUSTABLE, FALSE,
  1106. X            FRAME_ICON, icon_create(ICON_IMAGE, &sunplot_icon, 0),
  1107. X            FRAME_ARGC_PTR_ARGV,    &argc, argv,
  1108. X            0);
  1109. X    while (argc > 1 && argv[1][0] == '-') {
  1110. X        switch (argv[1][1]) {
  1111. X        case 'c':
  1112. X            if (argv[1][2])
  1113. X                hor_size = atoi(&argv[1][2]);
  1114. X            else if (argc > 2) {
  1115. X                hor_size = atoi(argv[2]);
  1116. X                argv[1] = argv[0];
  1117. X                argv++;
  1118. X                argc--;
  1119. X            }
  1120. X            if (hor_size < 64)
  1121. X                hor_size = 64;
  1122. X            ver_size = hor_size;
  1123. X            square = TRUE;
  1124. X            break;
  1125. X        case 'h':
  1126. X            if (argv[1][2])
  1127. X                hor_size = atoi(&argv[1][2]);
  1128. X            else if (argc > 2) {
  1129. X                hor_size = atoi(argv[2]);
  1130. X                argv[1] = argv[0];
  1131. X                argv++;
  1132. X                argc--;
  1133. X            }
  1134. X            if (hor_size < 64)
  1135. X                hor_size = 64;
  1136. X            square = FALSE;
  1137. X            break;
  1138. X        case 'v':
  1139. X            if (argv[1][2])
  1140. X                ver_size = atoi(&argv[1][2]);
  1141. X            else if (argc > 2) {
  1142. X                ver_size = atoi(argv[2]);
  1143. X                argv[1] = argv[0];
  1144. X                argv++;
  1145. X                argc--;
  1146. X            }
  1147. X            if (ver_size < 64)
  1148. X                ver_size = 64;
  1149. X            square = FALSE;
  1150. X            break;
  1151. X        case 'l':
  1152. X            make_label = !make_label;
  1153. X            break;
  1154. X        case 's':
  1155. X            square = !square;
  1156. X            break;
  1157. X        case 'r':
  1158. X            turn();
  1159. X            break;
  1160. X        case 'x':
  1161. X            mirrorx();
  1162. X            break;
  1163. X        case 'y':
  1164. X            mirrory();
  1165. X            break;
  1166. X        case 'f':
  1167. X            if (argv[1][2])
  1168. X                strcpy(font_name, &argv[1][2]);
  1169. X            else if (argc > 2) {
  1170. X                strcpy(font_name, argv[2]);
  1171. X                argv[1] = argv[0];
  1172. X                argv++;
  1173. X                argc--;
  1174. X            }
  1175. X            break;
  1176. X        }
  1177. X        argc--;
  1178. X        argv[1] = argv[0];
  1179. X        argv++;
  1180. X    }
  1181. X    dump_init();
  1182. X    options_init();
  1183. X    panel_init();
  1184. X    canvas_init();
  1185. X    if (font_name[0]) {
  1186. X        register char *f = font_name;
  1187. X
  1188. X        if (*f != '/') {
  1189. X            f = malloc(strlen(font_dir)+strlen(font_name)+1);
  1190. X            strcpy(f, font_dir);
  1191. X            strcat(f, font_name);
  1192. X        }
  1193. X        font = pf_open(f);
  1194. X        if (f != font_name)
  1195. X            free(f);
  1196. X    }
  1197. X    if (font == 0) {
  1198. X        font = pf_default();
  1199. X        font_name[0] = 0;
  1200. X    }
  1201. X
  1202. X    fit_screen();
  1203. X
  1204. X    notify_set_input_func(me, input_reader, fileno(stdin));
  1205. X
  1206. X    window_main_loop(frame);
  1207. X
  1208. X    exit(0);
  1209. X}
  1210. + END-OF-FILE sunplot.c
  1211. chmod 'u=rw,g=r,o=r' 'sunplot.c'
  1212. set `wc -c 'sunplot.c'`
  1213. count=$1
  1214. case $count in
  1215. 19634)    :;;
  1216. *)    echo 'Bad character count in ''sunplot.c' >&2
  1217.         echo 'Count should be 19634' >&2
  1218. esac
  1219. echo Extracting 'sunplot.icon'
  1220. sed 's/^X//' > 'sunplot.icon' << '+ END-OF-FILE ''sunplot.icon'
  1221. X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  1222. X */
  1223. X    0x0000,0x0000,0x0000,0x0400,0x0000,0x0000,0x0000,0x0400,
  1224. X    0x0000,0x0000,0x0000,0x0800,0x0000,0x0000,0x0000,0x0800,
  1225. X    0x0000,0x0000,0x0000,0x1000,0x0000,0x0000,0x7FF0,0x1000,
  1226. X    0x0000,0x0007,0x800F,0x1000,0x0000,0x0038,0x0000,0xE000,
  1227. X    0x0000,0x00C0,0x0000,0x3800,0x2000,0x0300,0x0000,0x4600,
  1228. X    0x1800,0x0400,0x0000,0x4100,0x07FF,0x0800,0x0000,0x8080,
  1229. X    0x03FF,0xFFFC,0x0000,0x8060,0x01C1,0xFFFF,0xFFF0,0x8010,
  1230. X    0x00E0,0x8037,0xFFFF,0xF008,0x0071,0x0030,0x001F,0xFE04,
  1231. X    0x003A,0x0030,0x0002,0x0002,0x001E,0x0060,0x0002,0x0002,
  1232. X    0x000F,0x0060,0x0002,0x0001,0x000F,0x8060,0x0004,0x0000,
  1233. X    0x0011,0xC0C0,0x0004,0x0000,0x0010,0xE0C0,0x0008,0x0000,
  1234. X    0x0020,0x7180,0x0008,0x0000,0x0020,0x3B80,0x0008,0x0000,
  1235. X    0x0040,0x1F00,0x0010,0x0000,0x0040,0x0E00,0x0010,0x0000,
  1236. X    0x0040,0x1F80,0x0020,0x0000,0x0080,0x3BC0,0x0020,0x0000,
  1237. X    0x0080,0x70E0,0x0040,0x0000,0x0081,0xE070,0x0040,0x0000,
  1238. X    0x0081,0xC038,0x0040,0x0000,0x0100,0x001C,0x0080,0x0000,
  1239. X    0x0100,0x000E,0x0080,0x0000,0x0100,0x0007,0x0100,0x0000,
  1240. X    0x0100,0x0003,0x8100,0x0000,0x0100,0x0001,0xE100,0x0000,
  1241. X    0x0100,0x0000,0xF200,0x0000,0x0100,0x0000,0x3A00,0x0000,
  1242. X    0x0100,0x0000,0x1C00,0x0000,0x0100,0x0000,0x0E00,0x0000,
  1243. X    0x0100,0x0000,0x0F00,0x0000,0x0100,0x0000,0x0B80,0x0000,
  1244. X    0x0080,0x0000,0x0980,0x0000,0x0080,0x0000,0x1040,0x0000,
  1245. X    0x0080,0x0000,0x1020,0x0000,0x0080,0x0000,0x2000,0x0000,
  1246. X    0x0040,0x0000,0x2000,0x0000,0x0040,0x0000,0x2000,0x0000,
  1247. X    0x0FFF,0xFFFF,0xFFFF,0xFFE0,0x0924,0x9249,0x2492,0x4920,
  1248. X    0x0924,0x9249,0x2492,0x4920,0x0924,0x9249,0x2492,0x4920,
  1249. X    0x0800,0x0000,0x0000,0x0020,0x0800,0x0000,0x0000,0x0020,
  1250. X    0x0800,0x0000,0x0000,0x0021,0x0800,0x0000,0x0000,0x0022,
  1251. X    0x0800,0x0000,0x0000,0x0022,0x0800,0x0000,0x0000,0x0024,
  1252. X    0x0FFF,0xFFFF,0xFFFF,0xFFE8,0x0000,0x4004,0x0000,0x0010,
  1253. X    0x0000,0x3008,0x0000,0x0060,0x0000,0x0808,0x0000,0x0080,
  1254. X    0x0000,0x0410,0x0000,0x0100,0x0000,0x0310,0x0000,0x0600
  1255. + END-OF-FILE sunplot.icon
  1256. chmod 'u=rw,g=r,o=r' 'sunplot.icon'
  1257. set `wc -c 'sunplot.icon'`
  1258. count=$1
  1259. case $count in
  1260. 1933)    :;;
  1261. *)    echo 'Bad character count in ''sunplot.icon' >&2
  1262.         echo 'Count should be 1933' >&2
  1263. esac
  1264. exit 0
  1265. -- 
  1266. Sjoerd Mullender
  1267. sjoerd@cs.vu.nl
  1268.  
  1269.  
  1270.