home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume19 / pixmon / part03 < prev    next >
Encoding:
Text File  |  1993-04-27  |  49.2 KB  |  1,852 lines

  1. Newsgroups: comp.sources.x
  2. From: sprave@gonzo.informatik.uni-dortmund.de (Joachim Sprave)
  3. Subject: v19i052:  pixmon - a pixel graphics backend, Part03/03
  4. Message-ID: <1993Mar25.151545.14951@sparky.imd.sterling.com>
  5. X-Md4-Signature: 6318a686aad3808a2efa278ec526e7d8
  6. Date: Thu, 25 Mar 1993 15:15:45 GMT
  7. Approved: chris@sparky.imd.sterling.com
  8.  
  9. Submitted-by: sprave@gonzo.informatik.uni-dortmund.de (Joachim Sprave)
  10. Posting-number: Volume 19, Issue 52
  11. Archive-name: pixmon/part03
  12. Environment: X11, gcc
  13.  
  14. #!/bin/sh
  15. # this is pixmon.03 (part 3 of a multipart archive)
  16. # do not concatenate these parts, unpack them in order with /bin/sh
  17. # file pixmon-0.3/COPYING continued
  18. #
  19. if test ! -r _shar_seq_.tmp; then
  20.     echo 'Please unpack part 1 first!'
  21.     exit 1
  22. fi
  23. (read Scheck
  24.  if test "$Scheck" != 3; then
  25.     echo Please unpack part "$Scheck" next!
  26.     exit 1
  27.  else
  28.     exit 0
  29.  fi
  30. ) < _shar_seq_.tmp || exit 1
  31. if test ! -f _shar_wnt_.tmp; then
  32.     echo 'x - still skipping pixmon-0.3/COPYING'
  33. else
  34. echo 'x - continuing file pixmon-0.3/COPYING'
  35. sed 's/^X//' << 'SHAR_EOF' >> 'pixmon-0.3/COPYING' &&
  36. sections when you distribute them as separate works.  But when you
  37. distribute the same sections as part of a whole which is a work based
  38. on the Program, the distribution of the whole must be on the terms of
  39. this License, whose permissions for other licensees extend to the
  40. entire whole, and thus to each and every part regardless of who wrote it.
  41. X
  42. Thus, it is not the intent of this section to claim rights or contest
  43. your rights to work written entirely by you; rather, the intent is to
  44. exercise the right to control the distribution of derivative or
  45. collective works based on the Program.
  46. X
  47. In addition, mere aggregation of another work not based on the Program
  48. with the Program (or with a work based on the Program) on a volume of
  49. a storage or distribution medium does not bring the other work under
  50. the scope of this License.
  51. X
  52. X  3. You may copy and distribute the Program (or a work based on it,
  53. under Section 2) in object code or executable form under the terms of
  54. Sections 1 and 2 above provided that you also do one of the following:
  55. X
  56. X    a) Accompany it with the complete corresponding machine-readable
  57. X    source code, which must be distributed under the terms of Sections
  58. X    1 and 2 above on a medium customarily used for software interchange; or,
  59. X
  60. X    b) Accompany it with a written offer, valid for at least three
  61. X    years, to give any third party, for a charge no more than your
  62. X    cost of physically performing source distribution, a complete
  63. X    machine-readable copy of the corresponding source code, to be
  64. X    distributed under the terms of Sections 1 and 2 above on a medium
  65. X    customarily used for software interchange; or,
  66. X
  67. X    c) Accompany it with the information you received as to the offer
  68. X    to distribute corresponding source code.  (This alternative is
  69. X    allowed only for noncommercial distribution and only if you
  70. X    received the program in object code or executable form with such
  71. X    an offer, in accord with Subsection b above.)
  72. X
  73. The source code for a work means the preferred form of the work for
  74. making modifications to it.  For an executable work, complete source
  75. code means all the source code for all modules it contains, plus any
  76. associated interface definition files, plus the scripts used to
  77. control compilation and installation of the executable.  However, as a
  78. special exception, the source code distributed need not include
  79. anything that is normally distributed (in either source or binary
  80. form) with the major components (compiler, kernel, and so on) of the
  81. operating system on which the executable runs, unless that component
  82. itself accompanies the executable.
  83. X
  84. If distribution of executable or object code is made by offering
  85. access to copy from a designated place, then offering equivalent
  86. access to copy the source code from the same place counts as
  87. distribution of the source code, even though third parties are not
  88. compelled to copy the source along with the object code.
  89. X
  90. X  4. You may not copy, modify, sublicense, or distribute the Program
  91. except as expressly provided under this License.  Any attempt
  92. otherwise to copy, modify, sublicense or distribute the Program is
  93. void, and will automatically terminate your rights under this License.
  94. However, parties who have received copies, or rights, from you under
  95. this License will not have their licenses terminated so long as such
  96. parties remain in full compliance.
  97. X
  98. X  5. You are not required to accept this License, since you have not
  99. signed it.  However, nothing else grants you permission to modify or
  100. distribute the Program or its derivative works.  These actions are
  101. prohibited by law if you do not accept this License.  Therefore, by
  102. modifying or distributing the Program (or any work based on the
  103. Program), you indicate your acceptance of this License to do so, and
  104. all its terms and conditions for copying, distributing or modifying
  105. the Program or works based on it.
  106. X
  107. X  6. Each time you redistribute the Program (or any work based on the
  108. Program), the recipient automatically receives a license from the
  109. original licensor to copy, distribute or modify the Program subject to
  110. these terms and conditions.  You may not impose any further
  111. restrictions on the recipients' exercise of the rights granted herein.
  112. You are not responsible for enforcing compliance by third parties to
  113. this License.
  114. X
  115. X  7. If, as a consequence of a court judgment or allegation of patent
  116. infringement or for any other reason (not limited to patent issues),
  117. conditions are imposed on you (whether by court order, agreement or
  118. otherwise) that contradict the conditions of this License, they do not
  119. excuse you from the conditions of this License.  If you cannot
  120. distribute so as to satisfy simultaneously your obligations under this
  121. License and any other pertinent obligations, then as a consequence you
  122. may not distribute the Program at all.  For example, if a patent
  123. license would not permit royalty-free redistribution of the Program by
  124. all those who receive copies directly or indirectly through you, then
  125. the only way you could satisfy both it and this License would be to
  126. refrain entirely from distribution of the Program.
  127. X
  128. If any portion of this section is held invalid or unenforceable under
  129. any particular circumstance, the balance of the section is intended to
  130. apply and the section as a whole is intended to apply in other
  131. circumstances.
  132. X
  133. It is not the purpose of this section to induce you to infringe any
  134. patents or other property right claims or to contest validity of any
  135. such claims; this section has the sole purpose of protecting the
  136. integrity of the free software distribution system, which is
  137. implemented by public license practices.  Many people have made
  138. generous contributions to the wide range of software distributed
  139. through that system in reliance on consistent application of that
  140. system; it is up to the author/donor to decide if he or she is willing
  141. to distribute software through any other system and a licensee cannot
  142. impose that choice.
  143. X
  144. This section is intended to make thoroughly clear what is believed to
  145. be a consequence of the rest of this License.
  146. X
  147. X  8. If the distribution and/or use of the Program is restricted in
  148. certain countries either by patents or by copyrighted interfaces, the
  149. original copyright holder who places the Program under this License
  150. may add an explicit geographical distribution limitation excluding
  151. those countries, so that distribution is permitted only in or among
  152. countries not thus excluded.  In such case, this License incorporates
  153. the limitation as if written in the body of this License.
  154. X
  155. X  9. The Free Software Foundation may publish revised and/or new versions
  156. of the General Public License from time to time.  Such new versions will
  157. be similar in spirit to the present version, but may differ in detail to
  158. address new problems or concerns.
  159. X
  160. Each version is given a distinguishing version number.  If the Program
  161. specifies a version number of this License which applies to it and "any
  162. later version", you have the option of following the terms and conditions
  163. either of that version or of any later version published by the Free
  164. Software Foundation.  If the Program does not specify a version number of
  165. this License, you may choose any version ever published by the Free Software
  166. Foundation.
  167. X
  168. X  10. If you wish to incorporate parts of the Program into other free
  169. programs whose distribution conditions are different, write to the author
  170. to ask for permission.  For software which is copyrighted by the Free
  171. Software Foundation, write to the Free Software Foundation; we sometimes
  172. make exceptions for this.  Our decision will be guided by the two goals
  173. of preserving the free status of all derivatives of our free software and
  174. of promoting the sharing and reuse of software generally.
  175. X
  176. X                NO WARRANTY
  177. X
  178. X  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  179. FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
  180. OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  181. PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  182. OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  183. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
  184. TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  185. PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  186. REPAIR OR CORRECTION.
  187. X
  188. X  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  189. WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  190. REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  191. INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  192. OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  193. TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  194. YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  195. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  196. POSSIBILITY OF SUCH DAMAGES.
  197. X
  198. X             END OF TERMS AND CONDITIONS
  199. X
  200. X    Appendix: How to Apply These Terms to Your New Programs
  201. X
  202. X  If you develop a new program, and you want it to be of the greatest
  203. possible use to the public, the best way to achieve this is to make it
  204. free software which everyone can redistribute and change under these terms.
  205. X
  206. X  To do so, attach the following notices to the program.  It is safest
  207. to attach them to the start of each source file to most effectively
  208. convey the exclusion of warranty; and each file should have at least
  209. the "copyright" line and a pointer to where the full notice is found.
  210. X
  211. X    <one line to give the program's name and a brief idea of what it does.>
  212. X    Copyright (C) 19yy  <name of author>
  213. X
  214. X    This program is free software; you can redistribute it and/or modify
  215. X    it under the terms of the GNU General Public License as published by
  216. X    the Free Software Foundation; either version 2 of the License, or
  217. X    (at your option) any later version.
  218. X
  219. X    This program is distributed in the hope that it will be useful,
  220. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  221. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  222. X    GNU General Public License for more details.
  223. X
  224. X    You should have received a copy of the GNU General Public License
  225. X    along with this program; if not, write to the Free Software
  226. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  227. X
  228. Also add information on how to contact you by electronic and paper mail.
  229. X
  230. If the program is interactive, make it output a short notice like this
  231. when it starts in an interactive mode:
  232. X
  233. X    Gnomovision version 69, Copyright (C) 19yy name of author
  234. X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  235. X    This is free software, and you are welcome to redistribute it
  236. X    under certain conditions; type `show c' for details.
  237. X
  238. The hypothetical commands `show w' and `show c' should show the appropriate
  239. parts of the General Public License.  Of course, the commands you use may
  240. be called something other than `show w' and `show c'; they could even be
  241. mouse-clicks or menu items--whatever suits your program.
  242. X
  243. You should also get your employer (if you work as a programmer) or your
  244. school, if any, to sign a "copyright disclaimer" for the program, if
  245. necessary.  Here is a sample; alter the names:
  246. X
  247. X  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  248. X  `Gnomovision' (which makes passes at compilers) written by James Hacker.
  249. X
  250. X  <signature of Ty Coon>, 1 April 1989
  251. X  Ty Coon, President of Vice
  252. X
  253. This General Public License does not permit incorporating your program into
  254. proprietary programs.  If your program is a subroutine library, you may
  255. consider it more useful to permit linking proprietary applications with the
  256. library.  If this is what you want to do, use the GNU Library General
  257. Public License instead of this License.
  258. SHAR_EOF
  259. echo 'File pixmon-0.3/COPYING is complete' &&
  260. chmod 0640 pixmon-0.3/COPYING ||
  261. echo 'restore of pixmon-0.3/COPYING failed'
  262. Wc_c="`wc -c < 'pixmon-0.3/COPYING'`"
  263. test 17982 -eq "$Wc_c" ||
  264.     echo 'pixmon-0.3/COPYING: original size 17982, current size' "$Wc_c"
  265. rm -f _shar_wnt_.tmp
  266. fi
  267. # ============= pixmon-0.3/pixmon.1 ==============
  268. if test -f 'pixmon-0.3/pixmon.1' -a X"$1" != X"-c"; then
  269.     echo 'x - skipping pixmon-0.3/pixmon.1 (File already exists)'
  270.     rm -f _shar_wnt_.tmp
  271. else
  272. > _shar_wnt_.tmp
  273. echo 'x - extracting pixmon-0.3/pixmon.1 (Text)'
  274. sed 's/^X//' << 'SHAR_EOF' > 'pixmon-0.3/pixmon.1' &&
  275. .\" $Id$
  276. .TH PIXMON 1 "16 March 1993" "Version 0.3"
  277. .ta 0.5i +0.5i +0.5i +0.5i +0.5i +0.5i +0.5i +0.5i +0.5i +0.5i +0.5i +0.5i +0.5i +0.5i +0.5i
  278. X
  279. \" this noise gets my name right!
  280. .nr 99 \n(.s
  281. .nr 98 \n(.f
  282. .ds 11 "\fRo
  283. .nr 11 \w'\s10\*(11'
  284. .nr 10 0u
  285. .if \n(ct>1 .nr 10 \n(10+\s10.25m\s0
  286. .nr 13 \s10.1m\s0
  287. .if \n(ct>1 .nr 13 \s10.15m\s0
  288. .ds 12 \s10\v'-.67m'..\v'.67m\s0'
  289. .nr 12 \w'\s10\*(12'
  290. .as 11 \h'-\n(11u-\n(12u/2u+\n(13u'\v'0-\n(10u'\*(12\v'\n(10u'\h'-\n(12u+\n(11u/2u-\n(13u'
  291. .ds o \x'0'\f1\s10\*(11\s\n(99\f\n(98
  292. X
  293. .SH NAME
  294. .B pixmon
  295. \- a simple pixel monitor for X11
  296. X
  297. .SH SYNOPSIS
  298. .LP
  299. .B pixmon
  300. [
  301. .I -Xt-options ...
  302. ]
  303. [
  304. .I -options ...
  305. ]
  306. .TP
  307. X        [\fB-dx \fI<pixel-data-size>\fR]
  308. .TP
  309. X        [\fB-dy \fI<pixel-data-size>\fR]
  310. .TP
  311. X        [\fB-width \fI<window-size>\fR]
  312. .TP
  313. X        [\fB-height \fI<window-size>\fR]
  314. .TP
  315. X        [\fB-scale \fI<float-value>\fR]
  316. .TP
  317. X        [\fB-cmap \fI<filename>[.cmap]\fR]
  318. .TP
  319. X        [\fB-dither\fR]
  320. X
  321. .SH DESCRIPTION
  322. .B pixmon
  323. implements a simple 
  324. .I pixel data monitor
  325. for use with the
  326. .I X11
  327. window system. It comes with the following features:
  328. .TP \w'\(bu'u+2n
  329. \(bu
  330. Auto-rescale when changing the window size
  331. .TP
  332. \(bu
  333. Loadable colormaps, you can display the same data with
  334. different colors
  335. .TP
  336. \(bu
  337. Autodetect mono servers, using dithering
  338. .I (ordered dither)
  339. instead of colors
  340. .TP
  341. \(bu
  342. Run length encoding support.
  343. X
  344. .SH OPTIONS
  345. .TP
  346. .B \-dx \fIpixel-data-size\fR
  347. Set the horizontal size of expected
  348. .I pixel data image.
  349. (Defaults to \fI100\fR.)
  350. .TP
  351. .B \-dy \fIpixel-data-size\fR
  352. Set the vertical size of expected
  353. .I pixel data image.
  354. (Defaults to \fI100\fR.)
  355. .TP
  356. .B \-width \fIwindow-size\fR
  357. Set the horizontal size of
  358. .I pixmon
  359. window in screen coordinates
  360. (Defaults to \fIdx * scale\fR.)
  361. .TP
  362. .B \-height \fIwindow-size\fR
  363. Set the vertical size of
  364. .I pixmon
  365. window in screen coordinates
  366. (Defaults to \fIdy * scale\fR.)
  367. .TP
  368. .B \-scale \fIfloat-value\fR
  369. Scale the window's size to
  370. .I width = dx * float-value
  371. and
  372. .I height = dy * float-value
  373. (Defaults to \fI2\fR.)
  374. .TP
  375. .B \-cmap \fIfilename[.cmap]\fR
  376. Read in \fIfilename[.cmap]\fR on program start, and use the
  377. colors when generating the pixmaps. The use of the
  378. suffix `.cmap' is encouraged, but not enforced.
  379. .TP
  380. .B \-dither
  381. Use an
  382. .I ordered dither
  383. for pseudo color representation on low bitplane devices,
  384. eg.
  385. .I monochrome
  386. XX servers.
  387. when used on a color device, a two color dithering generates
  388. some interesting effects.
  389. .PP
  390. The following standard X Toolkit command line arguments are commonly used 
  391. with
  392. .BR pixmon :
  393. .TP
  394. .B \-bg \fIcolor\fP
  395. This option specifies the color to use for the background of the window.  
  396. The default is ``white.''
  397. .TP
  398. .B \-bd \fIcolor\fP
  399. This option specifies the color to use for the border of the window.
  400. The default is ``black.''
  401. .TP
  402. .B \-bw \fInumber\fP
  403. This option specifies the width in pixels of the border surrounding the window.
  404. .TP
  405. .B \-fg \fIcolor\fP
  406. This option specifies the color to use for displaying pixels.  The default is 
  407. ``black.''
  408. .TP
  409. .B \-name \fIname\fP
  410. This option specifies the application name under which resources are to be
  411. obtained, rather than the default executable file name.
  412. \fIName\fP should not contain ``.'' or ``*'' characters. (Defaults to
  413. .B ``PixMon.'')
  414. .TP
  415. .B \-title \fIstring\fP
  416. This option specifies the window title string, which may be displayed by
  417. window managers if the user so chooses.  The default title is `pixmon'.
  418. .TP
  419. .B \-rv
  420. This option indicates that reverse video should be simulated by swapping
  421. the foreground and background colors.
  422. .TP
  423. .B \-geometry \fIgeometry\fP
  424. This option specifies the preferred size and position of the
  425. .B pixmon window;
  426. see \fIX(1)\fP.
  427. .TP
  428. .B \-display \fIdisplay\fP
  429. This option specifies the X server to contact; see \fIX(1)\fP.
  430. .TP
  431. .B \-xrm \fIresourcestring\fP
  432. This option specifies a resource string to be used.  This is especially
  433. useful for setting resources that do not have separate command line options.
  434. .TP
  435. .B \-iconic
  436. This option indicates that
  437. .B pixmon
  438. should ask the window manager to 
  439. start it as an icon rather than as the normal window.
  440. X
  441. .SH OPTION SUMMARY
  442. To give no option at all is the same as to give the following options:
  443. .TP
  444. -dx 100 -dy 100 -scale 2 -cmap default.cmap
  445. X
  446. .SH FORMATS
  447. .TP \w'\(bu'u+2n
  448. \(bu
  449. .I Color map file(s), recognised by
  450. .B pixmon
  451. have the following
  452. .SM ASCII
  453. layout:
  454. .LP
  455. .nf
  456. .DT
  457. .ft B
  458. X    #     File:        demo.map
  459. X    #    Creator:    Joachim Sprave (sprave@gonzo)
  460. X    # <- this is a comment line: '#' in the 1st column
  461. X    <red intensity 0>    <green intensity 0>    <blue intensity 0>
  462. X    <red intensity 1>    <green intensity 1>    <blue intensity 1>
  463. X    <red intensity 2>    <green intensity 2>    <blue intensity 2>
  464. X                \&.\&.\&.
  465. X    <red intensity 255>    <green intensity 255>    <blue intensity 255>
  466. .ft R
  467. .fi
  468. X
  469. Thus a color map file consist of 256 lines each one containing such a
  470. color description. Eg. to get a greyscale `color' map, simply
  471. use the same intensities for all colors (see
  472. .SM EXAMPLES
  473. below).
  474. .TP \w'\(bu'u+2n
  475. \(bu
  476. A package header is defined as:
  477. .LP
  478. .nf
  479. .DT
  480. .ft B
  481. X    typedef struct {
  482. X        unsigned short    magic;
  483. X        unsigned short    type;
  484. X        short        x;
  485. X        short        y;
  486. X        unsigned short    dx;
  487. X        unsigned short    dy;
  488. X        unsigned short    sizelo;
  489. X        unsigned short    sizehi;
  490. X    } ImgHdr;
  491. .ft R
  492. .fi
  493. X
  494. With the following semantics:
  495. .TP
  496. .I magic
  497. used to determine byte sex, must
  498. be initialized to PIX_MAGIC
  499. .TP
  500. .I type
  501. one of:
  502. .RS
  503. .TP
  504. .SM PIX_DATA
  505. Include the pixel data following 
  506. the header into the picture 
  507. (without displaying instantly).
  508. .TP
  509. .SM PIX_FLUSH
  510. Display the internal pixmap.
  511. .TP
  512. .SM PIX_DATA | PIX_FLUSH
  513. Include the pixel data following 
  514. the header into the picture 
  515. and display it instantly.
  516. .TP
  517. .SM PIX_KILL
  518. Tells
  519. .B pixmon
  520. to exit, when button 1 is pressed.
  521. .RE
  522. .TP
  523. .I x, y
  524. Position of this package relative to
  525. the upper-left corner of the window.
  526. .TP
  527. .I dx, dy
  528. Width and height (in dots, not in pixels)
  529. of this package.
  530. .TP
  531. .I sizelo, sizehi            
  532. Size of the following pixel data. If
  533. .I sizehi * 0x10000 + sizelo
  534. .I < dx * dy,
  535. .B pixmon
  536. expects run length encoded data.
  537. X
  538. .SH ENCODING
  539. If
  540. .SM RUN LENGTH ENCODING (RLE)
  541. is detected (see above), the value
  542. .BR PIX_RLE (0xFF)
  543. is treated as an escape value,
  544. so the number of colors is reduced by one.
  545. To encode your data, use the function
  546. .B rle_encode
  547. from
  548. .I rle.c.
  549. X
  550. .SH EXAMPLES
  551. .TP \w'\(bu'u+2n
  552. \(bu
  553. A
  554. .I greyscale
  555. color map looks like:
  556. .LP
  557. .nf
  558. .DT
  559. .ft R
  560. X    0    0    0
  561. X    1    1    1
  562. X    2    2    2
  563. X    3    3    3
  564. X        \&.\&.\&.
  565. X    255    255    255
  566. .fi
  567. .TP \w'\(bu'u+2n
  568. \(bu
  569. To use run length encoding of your pixel data, write:
  570. .LP
  571. .nf
  572. .DT
  573. .ft B
  574. X    my_encode ()
  575. X    {
  576. X        char mybuffer[MBSIZE];
  577. X        \&.\&.\&.
  578. X        rle_encode (mybuffer, MBSIZE, PIX_RLE);
  579. X        \&.\&.\&.
  580. X    }
  581. .ft R
  582. .fi
  583. X
  584. .SH FILES
  585. .LP
  586. .nf
  587. .DT
  588. .ft R
  589. pixmon/default.cmap        \fIdefault color map\fR
  590. pixmon/cmaps/*.cmap        \fIexample color maps\fR
  591. X
  592. pixmon/examples/README    \fIguiding instructions\fR
  593. pixmon/examples/mbx        \fIshell script that runs mbs\fR
  594. pixmon/examples/mbs.c        \fIgenerates a mandelbrot set\fR
  595. pixmon/examples/showpal.c    \fIgenerates a color palette\fR
  596. .ft R
  597. .fi
  598. X
  599. .SH ANIMATION
  600. An animation companion to
  601. .B pixmon
  602. called
  603. .BR playmate (1)
  604. is also in the making, and will be distributed in near future
  605. (refer to the
  606. .SM AVAILABILITY
  607. section below).
  608. Its application is rather simple: all there is to do is to
  609. include a ``tee-log'' in the `pixel generating pipe' eg.:
  610. .PP
  611. .RS
  612. .I example%
  613. .B mbs ... | tee >pmdata.pix
  614. .B | pixmon ...
  615. .RE
  616. .PP
  617. to collect
  618. .B pixmon
  619. data, that is later turned into animated pixmaps by
  620. .BR playmate (1).
  621. (See the
  622. .B pixmon/examples
  623. folder for more.)
  624. X
  625. .SH BUGS
  626. The known `bugs' of
  627. .B pixmon
  628. are:
  629. .TP \w'\(bu'u+2n
  630. \(bu
  631. `No' interaction
  632. .TP
  633. \(bu
  634. Could be faster
  635. .TP
  636. \(bu
  637. No private color maps
  638. .TP
  639. \(bu
  640. My first
  641. .I X11
  642. program, ugly code :-(
  643. X
  644. .SH SEE ALSO
  645. .BR X (1),
  646. .BR hodge (1),
  647. .BR imagemagick (1),
  648. .BR playmate (1)
  649. X
  650. .SH AUTHOR
  651. Copyright 
  652. .if t \(co 
  653. .if n (C)
  654. 1992, 1993 by
  655. .if n Joachim Sprave
  656. .if t Joachim Sprave
  657. .nf
  658. Systems Analysis Group, University of Dortmund, Germany.
  659. .nf
  660. Send bugs, comments, etc., to (sprave@ls11.informatik.uni-dortmund.de).
  661. .fi
  662. X
  663. .SH CREDITS
  664. .if n Joerg Heitkoetter
  665. .if t J\*org Heitk\*otter
  666. (joke@ls11.informatik.uni-dortmund.de) wrote the manual page.
  667. .fi
  668. X
  669. .SH AVAILABILITY
  670. .LP
  671. This work is protected by the terms of the
  672. .SM GNU
  673. General Public License. Please refer to the
  674. .SM COPYING
  675. file accompanying the sources of this software package for a lengthy, boring,
  676. but absolute complete description.
  677. X
  678. .SM PIXMON
  679. is available via anonymous ftp from the group's server
  680. .B lumpi.informatik.uni-dortmunde.de
  681. (129.217.36.140)
  682. as file `pixmon-0.3.tar.Z' in /pub/CA/src.
  683. X
  684. .SH WARRANTY
  685. .LP
  686. This program is free software; you can redistribute it and/or modify
  687. it under the terms of the
  688. .SM GNU
  689. General Public License as published by
  690. the Free Software Foundation; either version 2 of the License, or
  691. (at your option) any later version.
  692. X
  693. This program is distributed in the hope that it will be useful,
  694. but
  695. .SM WITHOUT ANY WARRANTY;
  696. without even the implied warranty of
  697. .SM MERCHANTABILITY
  698. or
  699. .SM FITNESS FOR A PARTICULAR PURPOSE.
  700. See the
  701. .SM GNU
  702. General Public License for more details.
  703. X
  704. You should have received a copy of the
  705. .SM GNU
  706. General Public License
  707. along with this program; if not, write to the Free Software
  708. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  709. SHAR_EOF
  710. chmod 0600 pixmon-0.3/pixmon.1 ||
  711. echo 'restore of pixmon-0.3/pixmon.1 failed'
  712. Wc_c="`wc -c < 'pixmon-0.3/pixmon.1'`"
  713. test 9181 -eq "$Wc_c" ||
  714.     echo 'pixmon-0.3/pixmon.1: original size 9181, current size' "$Wc_c"
  715. rm -f _shar_wnt_.tmp
  716. fi
  717. # ============= pixmon-0.3/rle.kr.c ==============
  718. if test -f 'pixmon-0.3/rle.kr.c' -a X"$1" != X"-c"; then
  719.     echo 'x - skipping pixmon-0.3/rle.kr.c (File already exists)'
  720.     rm -f _shar_wnt_.tmp
  721. else
  722. > _shar_wnt_.tmp
  723. echo 'x - extracting pixmon-0.3/rle.kr.c (Text)'
  724. sed 's/^X//' << 'SHAR_EOF' > 'pixmon-0.3/rle.kr.c' &&
  725. #include <stdlib.h>
  726. #include "rle.h"
  727. X
  728. static unsigned char *rl_src_buffer;
  729. static unsigned char rl_escape;
  730. static unsigned long rl_src;
  731. static unsigned long rl_src_size;
  732. static unsigned long rl_count;
  733. static unsigned char rl_current;
  734. X
  735. X
  736. #define COUNT_MAX    0x10000
  737. #define LO(k)        ((k) & (unsigned long)0xFF)
  738. #define HI(k)        (((k) & (unsigned long)0xFF00)>>8)
  739. #define UNLO(c)        (c)
  740. #define UNHI(c)        ((c) << 8)
  741. X
  742. X
  743. X
  744. /*
  745. X *    RL-encode a buffer in-place
  746. X *    returns:    no. of bytes after encoding
  747. X */
  748. unsigned long
  749. rl_encode(buffer, size, escape)
  750. unsigned char *buffer;        /* data to encode            */
  751. unsigned long size;        /* no. of bytes in buffer        */
  752. unsigned char escape;        /* esc. byte preceding a count        */
  753. {
  754. X    unsigned long src, dst;
  755. X    unsigned long count;
  756. X    unsigned char current;
  757. X
  758. X    src = dst = 0;
  759. X    while (src < size) {
  760. X    count = 1;
  761. X    current = buffer[src];
  762. X    while (++src < size && buffer[src] == current && count < COUNT_MAX)
  763. X        count++;
  764. X    if (count > 3 || current == escape) {
  765. X        buffer[dst++] = escape;
  766. X        buffer[dst++] = (char) LO(count);
  767. X        buffer[dst++] = (char) HI(count);
  768. X        buffer[dst++] = current;
  769. X    }
  770. X    else {
  771. X        while (count--)
  772. X        buffer[dst++] = current;
  773. X    }
  774. X    }
  775. X    return dst;
  776. }
  777. X
  778. /*
  779. X *    RL-decode a buffer into another one
  780. X *    returns:    no. of bytes after decoding
  781. X *
  782. X *    Caution: dst_buffer must be large enough to
  783. X *             hold the decoded data
  784. X */
  785. unsigned long
  786. rl_decode(src_buffer, dst_buffer, src_size, escape)
  787. unsigned char *src_buffer;    /* source buffer    */
  788. unsigned char *dst_buffer;    /* destination buffer    */
  789. unsigned long src_size;        /* no. of encoded bytes    */
  790. unsigned char escape;        /* escape code        */
  791. {
  792. X    unsigned long src, dst;
  793. X    unsigned long count;
  794. X    unsigned char current;
  795. X
  796. X    src = dst = 0;
  797. X    while (src < src_size) {
  798. X    if (src_buffer[src] == escape) {
  799. X        src++;
  800. X        count = UNLO(src_buffer[src++]);
  801. X        count |= UNHI(src_buffer[src++]);
  802. X        current = src_buffer[src++];
  803. X        while (count--)
  804. X        dst_buffer[dst++] = current;
  805. X    }
  806. X    else {
  807. X        dst_buffer[dst++] = src_buffer[src++];
  808. X    }
  809. X    }
  810. X    return dst;
  811. }
  812. X
  813. /*
  814. X *    Determine the size needed for decoding
  815. X */
  816. unsigned long
  817. rl_decode_length(src_buffer, src_size, escape)
  818. unsigned char *src_buffer;    /* buffer        */
  819. unsigned long src_size;        /* size encoded        */
  820. unsigned char escape;        /* escape code        */
  821. {
  822. X    unsigned long src, dst;
  823. X    unsigned long count;
  824. X
  825. X    src = dst = 0;
  826. X    while (src < src_size) {
  827. X    if (src_buffer[src] == escape) {
  828. X        src++;
  829. X        count = UNLO(src_buffer[src++]);
  830. X        count |= UNHI(src_buffer[src++]);
  831. X        src++;
  832. X        dst += count;
  833. X    }
  834. X    else {
  835. X        src++;
  836. X        dst++;
  837. X    }
  838. X    }
  839. X    return (dst);
  840. }                /* end rl_decode_length */
  841. X
  842. X
  843. /*
  844. X *    To avoid needing a buffer to hold the entire
  845. X *    decoded data, buffers can be decoded in pieces
  846. X */
  847. X
  848. /*
  849. X *    Initialize for decoding in pieces
  850. X */
  851. void
  852. rl_decode_init(src_buffer, src_size, escape)
  853. unsigned char *src_buffer;    /* buffer        */
  854. unsigned long src_size;        /* size encoded        */
  855. unsigned char escape;        /* esc. code        */
  856. {
  857. X    rl_src_buffer = src_buffer;
  858. X    rl_src_size = src_size;
  859. X    rl_escape = escape;
  860. X    rl_src = (unsigned long)0;
  861. X    rl_count = (unsigned long)0;
  862. }
  863. X
  864. X
  865. /*
  866. X *    Decode the next dst_size bytes from the buffer
  867. X *    initialized before. If dst_buffer is NULL, dst_size
  868. X *    bytes are skipped.
  869. X *    returns:    no. of bytes written to dst_buffer
  870. X */
  871. X
  872. unsigned long
  873. rl_decode_next(dst_buffer, dst_size)
  874. unsigned char *dst_buffer;    /* destination buffer    */
  875. unsigned long dst_size;        /* no. bytes to decode    */
  876. {
  877. X    unsigned long dst;
  878. X
  879. X    dst = 0;
  880. X    while (rl_src <= rl_src_size && dst < dst_size) {
  881. X    while (rl_count && dst < dst_size) {
  882. X        if (dst_buffer != (unsigned char *) 0)    /* skip */
  883. X        dst_buffer[dst] = rl_current;
  884. X        dst++;
  885. X        rl_count--;
  886. X    }
  887. X    if (rl_count == 0) {
  888. X        if (rl_src_buffer[rl_src] == rl_escape) {
  889. X        rl_src++;
  890. X        rl_count  = UNLO(rl_src_buffer[rl_src++]);
  891. X        rl_count |= UNHI(rl_src_buffer[rl_src++]);
  892. X        }
  893. X        else {
  894. X        rl_count = 1;
  895. X        }
  896. X        rl_current = rl_src_buffer[rl_src++];
  897. X    }
  898. X    }
  899. X    return dst;
  900. }
  901. SHAR_EOF
  902. chmod 0640 pixmon-0.3/rle.kr.c ||
  903. echo 'restore of pixmon-0.3/rle.kr.c failed'
  904. Wc_c="`wc -c < 'pixmon-0.3/rle.kr.c'`"
  905. test 3989 -eq "$Wc_c" ||
  906.     echo 'pixmon-0.3/rle.kr.c: original size 3989, current size' "$Wc_c"
  907. rm -f _shar_wnt_.tmp
  908. fi
  909. # ============= pixmon-0.3/README.rle ==============
  910. if test -f 'pixmon-0.3/README.rle' -a X"$1" != X"-c"; then
  911.     echo 'x - skipping pixmon-0.3/README.rle (File already exists)'
  912.     rm -f _shar_wnt_.tmp
  913. else
  914. > _shar_wnt_.tmp
  915. echo 'x - extracting pixmon-0.3/README.rle (Text)'
  916. sed 's/^X//' << 'SHAR_EOF' > 'pixmon-0.3/README.rle' &&
  917. X
  918. This small RLE-package has been written for pixmon. It is more
  919. or less ANSI-C. If your compiler is not ANSI, type
  920. X
  921. X    mv rle.c rle.ansi.c
  922. X    mv rle.kr.c rle.c
  923. X
  924. and try again.
  925. SHAR_EOF
  926. chmod 0640 pixmon-0.3/README.rle ||
  927. echo 'restore of pixmon-0.3/README.rle failed'
  928. Wc_c="`wc -c < 'pixmon-0.3/README.rle'`"
  929. test 172 -eq "$Wc_c" ||
  930.     echo 'pixmon-0.3/README.rle: original size 172, current size' "$Wc_c"
  931. rm -f _shar_wnt_.tmp
  932. fi
  933. # ============= pixmon-0.3/pixmon.c ==============
  934. if test -f 'pixmon-0.3/pixmon.c' -a X"$1" != X"-c"; then
  935.     echo 'x - skipping pixmon-0.3/pixmon.c (File already exists)'
  936.     rm -f _shar_wnt_.tmp
  937. else
  938. > _shar_wnt_.tmp
  939. echo 'x - extracting pixmon-0.3/pixmon.c (Text)'
  940. sed 's/^X//' << 'SHAR_EOF' > 'pixmon-0.3/pixmon.c' &&
  941. /*
  942. X *    pixmon - a PIXel oriented graphics MONitor
  943. X *    (c) Joachim Sprave 1992
  944. X */
  945. X
  946. /*
  947. X *    C-lib headers
  948. X */
  949. #include <stdio.h>
  950. #include <stdlib.h>
  951. X
  952. /*
  953. X *    Various X headers
  954. X */
  955. #include <X11/Intrinsic.h>
  956. #include <X11/StringDefs.h>
  957. #include <X11/Xos.h>
  958. #include <X11/cursorfont.h>
  959. #include <X11/Xutil.h>
  960. X
  961. /*
  962. X *    Application headers
  963. X */
  964. #include "pixmon.h"
  965. #include "defcmap.h"
  966. #include "dither.h"
  967. #include "rle.h"
  968. X
  969. void get_coor();
  970. void get_colors();
  971. void repaint();
  972. void mapped();
  973. void mouseinput();
  974. void flushMap();
  975. void dots2map();
  976. X
  977. /*
  978. X *    Some X macros
  979. X */
  980. #define APPNAME            "pixmon"
  981. #define APPCLASS        "PixMon"
  982. X
  983. /*
  984. X *    Maximum number of colors used by PixMon
  985. X */
  986. #define MAX_COLORS        256
  987. X
  988. /*
  989. X *    Scaling macros
  990. X */ 
  991. #define X_OM2WI(x)    ((int)((x)*MyData.Xfactor+0.99))
  992. #define Y_OM2WI(y)    ((int)((y)*MyData.Yfactor+0.99))
  993. #define X_WI2OM(x)    ((int)((x)/MyData.Xfactor+0.5))
  994. #define Y_WI2OM(y)    ((int)((y)/MyData.Yfactor+0.5))
  995. X
  996. #define MIN(a,b)    ((a)<(b)?(a):(b))
  997. #define MAX(a,b)    ((a)<(b)?(b):(a))
  998. X
  999. X
  1000. typedef struct {
  1001. X
  1002. X      int Om_width;
  1003. X      int Om_height;
  1004. X      int Wi_width;
  1005. X      int Wi_height;
  1006. X      int Wi_xpos;
  1007. X      int Wi_ypos;
  1008. X      float Scale;
  1009. X      float Xfactor;
  1010. X      float Yfactor;
  1011. X      char *Colormap;
  1012. X      Boolean Dither;
  1013. X      char *Butrep;
  1014. X      Pixel Fg, Bg;
  1015. X      char *Progname;
  1016. X  }
  1017. ApplData;
  1018. typedef ApplData *ApplDataPtr;
  1019. X
  1020. /*
  1021. X *    Default values
  1022. X */
  1023. static int def_wi_width = 0;
  1024. static int def_wi_height = 0;
  1025. static int def_wi_xpos = 10;
  1026. static int def_wi_ypos = 10;
  1027. static int def_om_width = 100;
  1028. static int def_om_height = 100;
  1029. static float def_scale = 2.0;
  1030. static int no_of_colors = 2;
  1031. X
  1032. /*
  1033. X *    Global definitions
  1034. X */
  1035. static Pixmap stipple[N_PAT];
  1036. static Pixmap MyMap;
  1037. static unsigned long pixels[MAX_COLORS];
  1038. static Colormap cmap;
  1039. X
  1040. static int nargs;
  1041. static Arg wargs[32];
  1042. static Cursor WorkingCursor;
  1043. static Display *dpy;
  1044. static Window win;
  1045. static GC gc;
  1046. static GC cleargc;
  1047. X
  1048. static int isMapped = 0;
  1049. static int Ready2Exit = 0;
  1050. X
  1051. static Widget toplevel;
  1052. static Widget w;
  1053. X
  1054. /*
  1055. X *    buffer to hold the original dotmap
  1056. X */
  1057. static unsigned char *dotbuf;
  1058. X
  1059. /*
  1060. X *    buffer to read incoming packages
  1061. X */
  1062. static unsigned char *inpbuf;
  1063. X
  1064. /*
  1065. X * Application Data
  1066. X */
  1067. static ApplData MyData;
  1068. X
  1069. static IMGHDR fullhdr;
  1070. X
  1071. static XtResource application_resources[] =
  1072. {
  1073. X    {"name", "Name", XtRString, sizeof(char *),
  1074. X     XtOffset(ApplDataPtr, Progname), XtRString, APPNAME},
  1075. X    {"width", "Width", XtRInt, sizeof(int),
  1076. X     XtOffset(ApplDataPtr, Wi_width), XtRInt, (caddr_t) & def_wi_width},
  1077. X    {"height", "Height", XtRInt, sizeof(int),
  1078. X       XtOffset(ApplDataPtr, Wi_height), XtRInt, (caddr_t) & def_wi_height},
  1079. X    {"xpos", "Xpos", XtRInt, sizeof(int),
  1080. X     XtOffset(ApplDataPtr, Wi_xpos), XtRInt, (caddr_t) & def_wi_xpos},
  1081. X    {"ypos", "Ypos", XtRInt, sizeof(int),
  1082. X     XtOffset(ApplDataPtr, Wi_ypos), XtRInt, (caddr_t) & def_wi_ypos},
  1083. X    {"scale", "Scale", XtRFloat, sizeof(float),
  1084. X     XtOffset(ApplDataPtr, Scale), XtRFloat, (caddr_t) & def_scale},
  1085. X    {"dx", "DeltaX", XtRInt, sizeof(int),
  1086. X     XtOffset(ApplDataPtr, Om_width), XtRInt, (caddr_t) & def_om_width},
  1087. X    {"dy", "DeltaY", XtRInt, sizeof(int),
  1088. X       XtOffset(ApplDataPtr, Om_height), XtRInt, (caddr_t) & def_om_height},
  1089. X    {"foreground", "Foreground", XtRPixel, sizeof(Pixel),
  1090. X     XtOffset(ApplDataPtr, Fg), XtRString, (caddr_t) "Black"},
  1091. X    {"background", "Background", XtRPixel, sizeof(Pixel),
  1092. X     XtOffset(ApplDataPtr, Bg), XtRString, (caddr_t) "White"},
  1093. X    {"cmap", "Cmap", XtRString, sizeof(char *),
  1094. X     XtOffset(ApplDataPtr, Colormap), XtRString, (caddr_t) "default"},
  1095. X    {"dither", "Dither", XtRBoolean, sizeof(Boolean),
  1096. X     XtOffset(ApplDataPtr, Dither), XtRString, (caddr_t) "False"},
  1097. X    {"butrep", "ButRep", XtRString, sizeof(char *),
  1098. X     XtOffset(ApplDataPtr, Butrep), XtRString, (caddr_t) 0},
  1099. };
  1100. X
  1101. static XrmOptionDescRec optionDescList[] =
  1102. {
  1103. X    {"-width", "*width", XrmoptionSepArg, (caddr_t) & def_om_width},
  1104. X    {"-height", "*height", XrmoptionSepArg, (caddr_t) & def_om_height},
  1105. X    {"-scale", "*scale", XrmoptionSepArg, (caddr_t) & def_scale},
  1106. X    {"-fg", "*foreground", XrmoptionSepArg, (caddr_t) NULL},
  1107. X    {"-bg", "*background", XrmoptionSepArg, (caddr_t) NULL},
  1108. X    {"-dx", "*dx", XrmoptionSepArg, (caddr_t) & def_om_width},
  1109. X    {"-dy", "*dy", XrmoptionSepArg, (caddr_t) & def_om_height},
  1110. X    {"-x", "*x", XrmoptionSepArg, (caddr_t) & def_wi_xpos},
  1111. X    {"-y", "*y", XrmoptionSepArg, (caddr_t) & def_wi_ypos},
  1112. X    {"-cmap", "*cmap", XrmoptionSepArg, (caddr_t) "default"},
  1113. X    {"-dither", "*dither", XrmoptionNoArg, (caddr_t) "True"},
  1114. X    {"-butrep", "*butrep", XrmoptionSepArg, (caddr_t) NULL},
  1115. };
  1116. X
  1117. X
  1118. X
  1119. int main(argc, argv)
  1120. int argc;
  1121. char *argv[];
  1122. {
  1123. X    int i;
  1124. X    XGCValues gcv;
  1125. X
  1126. X    toplevel = XtInitialize(argv[0], APPCLASS,
  1127. X          optionDescList, XtNumber(optionDescList), & argc,
  1128. X                argv);
  1129. X
  1130. X    XtGetApplicationResources(toplevel, &MyData, application_resources,
  1131. X         XtNumber(application_resources), (ArgList) NULL, (Cardinal) 0);
  1132. X
  1133. X    if (argc != 1) {
  1134. X        (void) fprintf(stderr, "Usage: %s [Xt options]\n", argv[0]);
  1135. X        exit(1);
  1136. X    }
  1137. X    fullhdr.x = fullhdr.y = 0;
  1138. X    fullhdr.dx = MyData.Om_width;
  1139. X    fullhdr.dy = MyData.Om_height;
  1140. X
  1141. X    if (MyData.Wi_width == 0) {
  1142. X        MyData.Wi_width = MyData.Om_width * MyData.Scale;
  1143. X    }
  1144. X    if (MyData.Wi_height == 0) {
  1145. X        MyData.Wi_height = MyData.Om_height * MyData.Scale;
  1146. X    }
  1147. X    MyData.Xfactor = (float) MyData.Wi_width / MyData.Om_width;
  1148. X    MyData.Yfactor = (float) MyData.Wi_height / MyData.Om_height;
  1149. X
  1150. X    nargs = 0;
  1151. X    XtSetArg(wargs[nargs], XtNwidth, MyData.Wi_width ? MyData.Wi_width : MyData.Om_width);
  1152. X    nargs++;
  1153. X    XtSetArg(wargs[nargs], XtNheight, MyData.Wi_height ? MyData.Wi_height : MyData.Om_height);
  1154. X    nargs++;
  1155. X
  1156. X    w = XtCreateManagedWidget(argv[0], widgetClass, toplevel,
  1157. X                  wargs, XtNumber(wargs));
  1158. X
  1159. X    dotbuf = (unsigned char *) calloc(MyData.Om_width * MyData.Om_height, sizeof(char));
  1160. X    inpbuf = (unsigned char *) calloc(MyData.Om_width * MyData.Om_height, sizeof(char));
  1161. X
  1162. X    if (dotbuf == NULL || inpbuf == NULL) {
  1163. X        fprintf(stderr, "%s: cannot allocate enough memory...\n", MyData.Progname);
  1164. X        exit(1);
  1165. X    }
  1166. X
  1167. X    XtAddEventHandler(w, (EventMask) (StructureNotifyMask | ExposureMask), False,
  1168. X              repaint, "repaint");
  1169. X    XtAddEventHandler(w, (EventMask) ButtonPressMask, False,
  1170. X              mouseinput, "input_data");
  1171. X
  1172. X    XtAddInput(fileno(stdin), XtInputReadMask, get_coor, w);
  1173. X
  1174. X    XtRealizeWidget(toplevel);
  1175. X
  1176. X    win = XtWindow(w);
  1177. X    dpy = XtDisplay(w);
  1178. X    cmap = DefaultColormap(dpy, DefaultScreen(dpy));
  1179. X
  1180. X    MyMap = XCreatePixmap(dpy, win, MyData.Wi_width, MyData.Wi_height,
  1181. X                  DefaultDepthOfScreen(XtScreen(w)));
  1182. X
  1183. X    if (strcmp(MyData.Colormap, "raster") == 0) {
  1184. X        no_of_colors = 2;
  1185. X    } else {
  1186. X        no_of_colors = DisplayCells(dpy, DefaultScreen(dpy));
  1187. X    }
  1188. X
  1189. X    WorkingCursor = XCreateFontCursor(dpy, XC_top_left_arrow);
  1190. X    XDefineCursor(dpy, win, WorkingCursor);
  1191. X
  1192. X    gcv.foreground = MyData.Fg;
  1193. X    gcv.background = MyData.Bg;
  1194. X    gcv.function = GXcopy;
  1195. X    gc = XCreateGC(dpy, win, GCForeground | GCBackground
  1196. X               | GCFunction, &gcv);
  1197. X    gcv.foreground = MyData.Bg;
  1198. X    cleargc = XCreateGC(dpy, win, GCForeground | GCBackground
  1199. X                | GCFunction, &gcv);
  1200. X
  1201. X    if (MyData.Dither) {
  1202. X        no_of_colors = 2;
  1203. X    }
  1204. X    if (no_of_colors == 2) {
  1205. X        XSetFillStyle(dpy, gc, FillOpaqueStippled);
  1206. X        for (i = 0; i < N_PAT; i++) {
  1207. X            stipple[i] = XCreateBitmapFromData(
  1208. X                              dpy, win, fill_pat[i],
  1209. X                             PAT_WIDTH, PAT_HEIGHT);
  1210. X        }
  1211. X    } else {
  1212. X        if (no_of_colors > MAX_COLORS)
  1213. X            no_of_colors = MAX_COLORS;
  1214. X        get_colors();
  1215. X    }
  1216. X    dots2map(&fullhdr);
  1217. X    flushMap(&fullhdr);
  1218. X
  1219. X    XtMainLoop();
  1220. }
  1221. X
  1222. X
  1223. X
  1224. void
  1225. get_colors()
  1226. {
  1227. X    int color, r, g, b;
  1228. X    XColor xcolor;
  1229. X    char cmapfile[256];
  1230. X    char line[BUFSIZ];
  1231. X    FILE *f;
  1232. X
  1233. X    color = 0;
  1234. X    f = fopen(MyData.Colormap, "r");
  1235. X    if (f == NULL) {
  1236. X        sprintf(cmapfile, "%s.cmap", MyData.Colormap);
  1237. X        f = fopen(cmapfile, "r");
  1238. X    }
  1239. X    if (f != NULL) {
  1240. X        while (color < MAX_COLORS
  1241. X               && fgets(line, BUFSIZ, f) != NULL) {
  1242. X            if (*line != '#' && sscanf(line, "%d %d %d", &r, &g, &b) == 3) {
  1243. X                rgb_default[color].red = r;
  1244. X                rgb_default[color].green = g;
  1245. X                rgb_default[color].blue = b;
  1246. X                color++;
  1247. X            }
  1248. X        }
  1249. X        fclose(f);
  1250. X    }
  1251. X    if (color < 256) {
  1252. X        fprintf(stderr, "Color map '%s' contains %d colors.\n", cmapfile, color);
  1253. X        fprintf(stderr, "PIXMON will use defaults for %d missing colors.\n", MAX_COLORS - color);
  1254. X    }
  1255. X    for (color = 0; color < MAX_COLORS; color++) {
  1256. X        xcolor.red    = rgb_default[color].red << 8;
  1257. X        xcolor.green    = rgb_default[color].green << 8;
  1258. X        xcolor.blue    = rgb_default[color].blue << 8;
  1259. X        xcolor.flags    = DoRed | DoGreen | DoBlue;
  1260. X        XAllocColor(dpy, cmap, &xcolor);
  1261. X        pixels[color]    = xcolor.pixel;
  1262. X    }
  1263. }
  1264. X
  1265. void
  1266. setdots(x, y, dx, color)
  1267. int x, y, dx;
  1268. unsigned char color;
  1269. {
  1270. X
  1271. X
  1272. X    if (no_of_colors > 2) {
  1273. X        color = color % MAX_COLORS;
  1274. X        XSetForeground(dpy, gc, pixels[color]);
  1275. X    } else {
  1276. X        color = color % N_PAT;
  1277. X        XSetStipple(dpy, gc, stipple[color]);
  1278. X    }
  1279. X    XFillRectangle(dpy, MyMap, gc,
  1280. X               X_OM2WI(x), Y_OM2WI(y),
  1281. X               X_OM2WI(dx), Y_OM2WI(1));
  1282. X
  1283. }
  1284. X
  1285. X
  1286. void
  1287. dots2map(hdrp)
  1288. IMGHDR *hdrp;
  1289. {
  1290. X    int x1, x, y, x2, y2;
  1291. X    unsigned char *p, color;
  1292. X
  1293. X    x2 = hdrp->x + hdrp->dx - 1;
  1294. X    y2 = hdrp->y + hdrp->dy - 1;
  1295. X    for (y = hdrp->y; y <= y2; y++) {
  1296. X        p = dotbuf + (y * MyData.Om_width);
  1297. X        x = hdrp->x;
  1298. X        while (x <= x2) {
  1299. X            x1 = x++;
  1300. X            color = p[x1];
  1301. X            while (x <= x2 && color == p[x])
  1302. X                x++;
  1303. X            setdots(x1, y, x - x1, color);
  1304. X        }
  1305. X    }
  1306. }
  1307. X
  1308. void
  1309. flushMap(hdrp)
  1310. IMGHDR *hdrp;
  1311. {
  1312. X    XCopyArea(dpy, MyMap, win, gc,
  1313. X          X_OM2WI(hdrp->x), Y_OM2WI(hdrp->y),
  1314. X          X_OM2WI(hdrp->dx), Y_OM2WI(hdrp->dy),
  1315. X          X_OM2WI(hdrp->x), Y_OM2WI(hdrp->y));
  1316. X
  1317. }
  1318. X
  1319. X
  1320. unsigned short
  1321. swapbytes(x)
  1322. unsigned short x;
  1323. {
  1324. X    unsigned short ret;
  1325. X
  1326. X    ret = (x & 0x00FF) << 8;
  1327. X    ret = ret | ((x & 0xFF00) >> 8);
  1328. X    return ret;
  1329. }
  1330. X
  1331. X
  1332. void
  1333. get_coor(data, source, id)
  1334. caddr_t data;
  1335. int *source;
  1336. XXtInputId id;
  1337. {
  1338. X    int i;
  1339. X    unsigned short magic, cigam;
  1340. X    IMGHDR inp_hdr;
  1341. X    int inp_hdr_size;
  1342. X    int line;
  1343. X    int size;
  1344. X
  1345. X    unsigned char *dotptr, *inpptr;
  1346. X    static XtWidgetGeometry xtgeom;
  1347. X    static int dirty = 1;
  1348. X
  1349. X    i = 50;
  1350. X    magic = cigam = 0;
  1351. X    while (fread(&magic, 1, sizeof(magic), stdin) == sizeof(magic)
  1352. X           && (magic != PIX_MAGIC && (cigam = swapbytes(magic)) != PIX_MAGIC) && --i);
  1353. X
  1354. X    if (magic != PIX_MAGIC && cigam != PIX_MAGIC)
  1355. X        return;
  1356. X
  1357. X    size = fread(&inp_hdr, 1, sizeof(IMGHDR), stdin);
  1358. X
  1359. X    if (cigam == PIX_MAGIC) {
  1360. X        inp_hdr.type = swapbytes(inp_hdr.type);
  1361. X        inp_hdr.x = swapbytes(inp_hdr.x);
  1362. X        inp_hdr.y = swapbytes(inp_hdr.y);
  1363. X        inp_hdr.dx = swapbytes(inp_hdr.dx);
  1364. X        inp_hdr.dy = swapbytes(inp_hdr.dy);
  1365. X        inp_hdr.sizelo = swapbytes(inp_hdr.sizelo);
  1366. X        inp_hdr.sizehi = swapbytes(inp_hdr.sizehi);
  1367. X    }
  1368. X    inp_hdr_size = (inp_hdr.sizehi << (sizeof(short) * 8)) | inp_hdr.sizelo;
  1369. X
  1370. X    if (size != sizeof(IMGHDR)) {
  1371. X        fprintf(stderr, "%s: incomplete header received\n", MyData.Progname);
  1372. X        return;
  1373. X    }
  1374. X    if (inp_hdr.type & PIX_KILL) {
  1375. X        Ready2Exit = 1;
  1376. X        return;
  1377. X    }
  1378. X    if (inp_hdr.type & PIX_DATA && inp_hdr.x + inp_hdr.dx > MyData.Om_width
  1379. X        || inp_hdr.y + inp_hdr.dy > MyData.Om_height) {
  1380. X        fprintf(stderr, "%s: package doesn't fit --- ignored\n", MyData.Progname);
  1381. X        return;
  1382. X    }
  1383. X    /*
  1384. X     * Read all color values
  1385. X     */
  1386. X    if (inp_hdr.type & PIX_DATA) {
  1387. X        if (inp_hdr_size < inp_hdr.dx * inp_hdr.dy) {
  1388. X            fread(inpbuf, sizeof(char), inp_hdr_size, stdin);
  1389. X
  1390. X            rl_decode_init(inpbuf, inp_hdr_size, PIX_RLE);
  1391. X
  1392. X            dotptr = dotbuf + inp_hdr.y * MyData.Om_width + inp_hdr.x;
  1393. X            for (line = inp_hdr.y; line < inp_hdr.y + inp_hdr.dy; line++) {
  1394. X                rl_decode_next(dotptr, inp_hdr.dx);
  1395. X                dotptr += MyData.Om_width;
  1396. X            }
  1397. X        } else {
  1398. X            fread(inpbuf, sizeof(char), inp_hdr_size, stdin);
  1399. X
  1400. X            dotptr = dotbuf + inp_hdr.y * MyData.Om_width + inp_hdr.x;
  1401. X            inpptr = inpbuf;
  1402. X
  1403. X            for (line = inp_hdr.y; line < inp_hdr.y + inp_hdr.dy; line++) {
  1404. X                memcpy(dotptr, inpptr, inp_hdr.dx);
  1405. X                dotptr += MyData.Om_width;
  1406. X                inpptr += inp_hdr.dx;
  1407. X            }
  1408. X
  1409. X        }
  1410. X        dots2map(&inp_hdr);
  1411. X        if (!(inp_hdr.type & PIX_FLUSH))
  1412. X            dirty = 1;
  1413. X    }
  1414. X    if (inp_hdr.type & PIX_FLUSH) {
  1415. X        if (dirty)
  1416. X            flushMap(&fullhdr);
  1417. X        else
  1418. X            flushMap(&inp_hdr);
  1419. X        dirty = 0;
  1420. X    }
  1421. }
  1422. X
  1423. X
  1424. X
  1425. X
  1426. void
  1427. repaint(w, data, ev)
  1428. Widget w;
  1429. caddr_t data;
  1430. XXEvent *ev;
  1431. {
  1432. X
  1433. X    XEvent event;
  1434. X
  1435. X    if (ev->type == MapNotify) {
  1436. X        isMapped = TRUE;
  1437. X        return;
  1438. X    }
  1439. X    if (ev->type == UnmapNotify) {
  1440. X        isMapped = FALSE;
  1441. X        return;
  1442. X    }
  1443. X    if (ev->type == ConfigureNotify) {
  1444. X
  1445. X        MyData.Wi_width = ev->xconfigure.width;
  1446. X        MyData.Wi_height = ev->xconfigure.height;
  1447. X        MyData.Xfactor = MyData.Wi_width / (double) MyData.Om_width;
  1448. X        MyData.Yfactor = MyData.Wi_height / (double) MyData.Om_height;
  1449. X
  1450. X        XFreePixmap(dpy, MyMap);
  1451. X        MyMap = XCreatePixmap(dpy, win, MyData.Wi_width, MyData.Wi_height,
  1452. X                      DefaultDepthOfScreen(XtScreen(w)));
  1453. X
  1454. X        dots2map(&fullhdr);
  1455. X
  1456. X    } else if (ev->type == Expose) {
  1457. X
  1458. X        if (!isMapped)
  1459. X            return;
  1460. X    }
  1461. X    while (XCheckTypedEvent(dpy, Expose, &event));
  1462. X
  1463. X    flushMap(&fullhdr);
  1464. }
  1465. X
  1466. X
  1467. void
  1468. mouseinput(w, data, ev)
  1469. Widget w;
  1470. caddr_t data;
  1471. XXEvent *ev;
  1472. {
  1473. X    int fd = 0;
  1474. X    FILE *f;
  1475. X
  1476. X    switch (ev->xany.type) {
  1477. X    case ButtonPress:
  1478. X        fputc('b', stderr);
  1479. X        if (ev->xbutton.button == Button1) {
  1480. X            if (Ready2Exit) {
  1481. X                exit(0); /* brute force */
  1482. X            }
  1483. X        }
  1484. X        break;
  1485. X    default:
  1486. X        break;
  1487. X    }
  1488. }
  1489. X
  1490. X
  1491. X
  1492. /*** EOF ***/
  1493. SHAR_EOF
  1494. chmod 0640 pixmon-0.3/pixmon.c ||
  1495. echo 'restore of pixmon-0.3/pixmon.c failed'
  1496. Wc_c="`wc -c < 'pixmon-0.3/pixmon.c'`"
  1497. test 12750 -eq "$Wc_c" ||
  1498.     echo 'pixmon-0.3/pixmon.c: original size 12750, current size' "$Wc_c"
  1499. rm -f _shar_wnt_.tmp
  1500. fi
  1501. # ============= pixmon-0.3/pixmon.h ==============
  1502. if test -f 'pixmon-0.3/pixmon.h' -a X"$1" != X"-c"; then
  1503.     echo 'x - skipping pixmon-0.3/pixmon.h (File already exists)'
  1504.     rm -f _shar_wnt_.tmp
  1505. else
  1506. > _shar_wnt_.tmp
  1507. echo 'x - extracting pixmon-0.3/pixmon.h (Text)'
  1508. sed 's/^X//' << 'SHAR_EOF' > 'pixmon-0.3/pixmon.h' &&
  1509. X
  1510. /*
  1511. X *    header types:
  1512. X *        PIX_FLUSH:    draw (or redraw) given area
  1513. X *        PIX_DATA:    color data for given area follows
  1514. X *        PIX_KILL:    quit PixMon
  1515. X *
  1516. X */
  1517. X
  1518. #ifndef    __PIXMON__
  1519. #define    __PIXMON__
  1520. X
  1521. X
  1522. #define PIX_FLUSH    0x1
  1523. #define PIX_DATA    0x2
  1524. #define PIX_KILL    0x4
  1525. X
  1526. #define PIX_UNKNOWN    (~(PIX_FLUSH | PIX_DATA))
  1527. X
  1528. #define PIX_MAGIC    0x2308
  1529. #define    PIX_RLE        0xFF
  1530. X
  1531. #define INIT_IMGHDR(hdr) ((hdr).type=(PIX_DATA|PIX_FLUSH),\
  1532. X              (hdr).magic=PIX_MAGIC,\
  1533. X              (hdr).x=(hdr).y=(hdr).dx=(hdr).dy=0,\
  1534. X              (hdr).sizelo=(hdr).sizehi=0)
  1535. X
  1536. #define EXIT_IMGHDR(hdr) ((hdr).type=PIX_KILL,\
  1537. X              (hdr).magic=PIX_MAGIC,\
  1538. X              (hdr).x=(hdr).y=(hdr).dx=(hdr).dy=0,\
  1539. X              (hdr).sizelo=(hdr).sizehi=0)
  1540. X
  1541. #define    PIX_SIZE(hdr)    (int)((hdr).sizelo | (int)(hdr).sizehi << 16)
  1542. X
  1543. #define PIX_LO(val)    (unsigned short)(((val) & 0xffff))
  1544. #define PIX_HI(val)    (unsigned short)(((val) >> 16) & 0xffff)
  1545. X
  1546. typedef struct {
  1547. X    unsigned short    magic;
  1548. X    unsigned short  type;
  1549. X    short        x;
  1550. X    short        y;
  1551. X    unsigned short    dx;
  1552. X    unsigned short    dy;
  1553. X    unsigned short    sizelo;
  1554. X    unsigned short    sizehi;
  1555. } ImgHdr;
  1556. X
  1557. typedef struct {
  1558. X    unsigned short  type;
  1559. X    short        x;
  1560. X    short        y;
  1561. X    unsigned short    dx;
  1562. X    unsigned short    dy;
  1563. X    unsigned short    sizelo;
  1564. X    unsigned short    sizehi;
  1565. } IMGHDR;
  1566. X
  1567. X
  1568. #endif    /*PIXMON*/
  1569. SHAR_EOF
  1570. chmod 0640 pixmon-0.3/pixmon.h ||
  1571. echo 'restore of pixmon-0.3/pixmon.h failed'
  1572. Wc_c="`wc -c < 'pixmon-0.3/pixmon.h'`"
  1573. test 1218 -eq "$Wc_c" ||
  1574.     echo 'pixmon-0.3/pixmon.h: original size 1218, current size' "$Wc_c"
  1575. rm -f _shar_wnt_.tmp
  1576. fi
  1577. # ============= pixmon-0.3/rle.c ==============
  1578. if test -f 'pixmon-0.3/rle.c' -a X"$1" != X"-c"; then
  1579.     echo 'x - skipping pixmon-0.3/rle.c (File already exists)'
  1580.     rm -f _shar_wnt_.tmp
  1581. else
  1582. > _shar_wnt_.tmp
  1583. echo 'x - extracting pixmon-0.3/rle.c (Text)'
  1584. sed 's/^X//' << 'SHAR_EOF' > 'pixmon-0.3/rle.c' &&
  1585. /*
  1586. X *    Simple run-length-encoding
  1587. X *    (c) Joachim Sprave 1992, 1993
  1588. X *    
  1589. X */
  1590. X
  1591. #include <stdlib.h>
  1592. #include "rle.h"
  1593. X
  1594. static unsigned char *rl_src_buffer;
  1595. static unsigned char rl_escape;
  1596. static unsigned long rl_src;
  1597. static unsigned long rl_src_size;
  1598. static unsigned long rl_count;
  1599. static unsigned char rl_current;
  1600. X
  1601. X
  1602. #define COUNT_MAX    0x10000
  1603. #define LO(k)        ((k) & (unsigned long)0xFF)
  1604. #define HI(k)        (((k) & (unsigned long)0xFF00)>>8)
  1605. #define UNLO(c)        (c)
  1606. #define UNHI(c)        ((c) << 8)
  1607. X
  1608. X
  1609. X
  1610. /*
  1611. X *    RL-encode a buffer in-place
  1612. X *    returns:    no. of bytes after encoding
  1613. X */
  1614. unsigned long
  1615. rl_encode(
  1616. unsigned char *buffer,        /* data to encode            */
  1617. unsigned long size,        /* no. of bytes in buffer        */
  1618. unsigned char escape)         /* esc. byte preceding a count        */
  1619. {
  1620. X    unsigned long src, dst;
  1621. X    unsigned long count;
  1622. X    unsigned char current;
  1623. X
  1624. X    src = dst = 0;
  1625. X    while (src < size) {
  1626. X    count = 1;
  1627. X    current = buffer[src];
  1628. X    while (++src < size && buffer[src] == current && count < COUNT_MAX)
  1629. X        count++;
  1630. X    if (count > 3 || current == escape) {
  1631. X        buffer[dst++] = escape;
  1632. X        buffer[dst++] = (char) LO(count);
  1633. X        buffer[dst++] = (char) HI(count);
  1634. X        buffer[dst++] = current;
  1635. X    }
  1636. X    else {
  1637. X        while (count--)
  1638. X        buffer[dst++] = current;
  1639. X    }
  1640. X    }
  1641. X    return dst;
  1642. }
  1643. X
  1644. /*
  1645. X *    RL-decode a buffer into another one
  1646. X *    returns:    no. of bytes after decoding
  1647. X *
  1648. X *    Caution: dst_buffer must be large enough to
  1649. X *             hold the decoded data
  1650. X */
  1651. unsigned long
  1652. rl_decode(
  1653. unsigned char *src_buffer,    /* source buffer    */
  1654. unsigned char *dst_buffer,    /* destination buffer    */
  1655. unsigned long src_size,        /* no. of encoded bytes    */
  1656. unsigned char escape)        /* escape code        */
  1657. {
  1658. X    unsigned long src, dst;
  1659. X    unsigned long count;
  1660. X    unsigned char current;
  1661. X
  1662. X    src = dst = 0;
  1663. X    while (src < src_size) {
  1664. X    if (src_buffer[src] == escape) {
  1665. X        src++;
  1666. X        count = UNLO(src_buffer[src++]);
  1667. X        count |= UNHI(src_buffer[src++]);
  1668. X        current = src_buffer[src++];
  1669. X        while (count--)
  1670. X        dst_buffer[dst++] = current;
  1671. X    }
  1672. X    else {
  1673. X        dst_buffer[dst++] = src_buffer[src++];
  1674. X    }
  1675. X    }
  1676. X    return dst;
  1677. }
  1678. X
  1679. /*
  1680. X *    Determine the size needed for decoding
  1681. X */
  1682. unsigned long
  1683. rl_decode_length(
  1684. unsigned char *src_buffer,    /* buffer        */
  1685. unsigned long src_size,        /* size encoded        */
  1686. unsigned char escape)        /* escape code        */
  1687. {
  1688. X    unsigned long src, dst;
  1689. X    unsigned long count;
  1690. X
  1691. X    src = dst = 0;
  1692. X    while (src < src_size) {
  1693. X    if (src_buffer[src] == escape) {
  1694. X        src++;
  1695. X        count = UNLO(src_buffer[src++]);
  1696. X        count |= UNHI(src_buffer[src++]);
  1697. X        src++;
  1698. X        dst += count;
  1699. X    }
  1700. X    else {
  1701. X        src++;
  1702. X        dst++;
  1703. X    }
  1704. X    }
  1705. X    return (dst);
  1706. }                /* end rl_decode_length */
  1707. X
  1708. X
  1709. /*
  1710. X *    To avoid needing a buffer to hold the entire
  1711. X *    decoded data, buffers can be decoded in pieces
  1712. X */
  1713. X
  1714. /*
  1715. X *    Initialize for decoding in pieces
  1716. X */
  1717. void
  1718. rl_decode_init(
  1719. unsigned char *src_buffer,    /* buffer        */
  1720. unsigned long src_size,        /* size encoded        */
  1721. unsigned char escape)        /* esc. code        */
  1722. {
  1723. X    rl_src_buffer = src_buffer;
  1724. X    rl_src_size = src_size;
  1725. X    rl_escape = escape;
  1726. X    rl_src = (unsigned long)0;
  1727. X    rl_count = (unsigned long)0;
  1728. }
  1729. X
  1730. X
  1731. /*
  1732. X *    Decode the next dst_size bytes from the buffer
  1733. X *    initialized before. If dst_buffer is NULL, dst_size
  1734. X *    bytes are skipped.
  1735. X *    returns:    no. of bytes written to dst_buffer
  1736. X */
  1737. X
  1738. unsigned long
  1739. rl_decode_next(
  1740. unsigned char *dst_buffer,    /* destination buffer    */
  1741. unsigned long dst_size)        /* no. bytes to decode    */
  1742. {
  1743. X    unsigned long dst;
  1744. X
  1745. X    dst = 0;
  1746. X    while (rl_src <= rl_src_size && dst < dst_size) {
  1747. X    while (rl_count && dst < dst_size) {
  1748. X        if (dst_buffer != (unsigned char *) 0)    /* skip */
  1749. X        dst_buffer[dst] = rl_current;
  1750. X        dst++;
  1751. X        rl_count--;
  1752. X    }
  1753. X    if (rl_count == 0) {
  1754. X        if (rl_src_buffer[rl_src] == rl_escape) {
  1755. X        rl_src++;
  1756. X        rl_count  = UNLO(rl_src_buffer[rl_src++]);
  1757. X        rl_count |= UNHI(rl_src_buffer[rl_src++]);
  1758. X        }
  1759. X        else {
  1760. X        rl_count = 1;
  1761. X        }
  1762. X        rl_current = rl_src_buffer[rl_src++];
  1763. X    }
  1764. X    }
  1765. X    return dst;
  1766. }
  1767. SHAR_EOF
  1768. chmod 0640 pixmon-0.3/rle.c ||
  1769. echo 'restore of pixmon-0.3/rle.c failed'
  1770. Wc_c="`wc -c < 'pixmon-0.3/rle.c'`"
  1771. test 3924 -eq "$Wc_c" ||
  1772.     echo 'pixmon-0.3/rle.c: original size 3924, current size' "$Wc_c"
  1773. rm -f _shar_wnt_.tmp
  1774. fi
  1775. # ============= pixmon-0.3/rle.h ==============
  1776. if test -f 'pixmon-0.3/rle.h' -a X"$1" != X"-c"; then
  1777.     echo 'x - skipping pixmon-0.3/rle.h (File already exists)'
  1778.     rm -f _shar_wnt_.tmp
  1779. else
  1780. > _shar_wnt_.tmp
  1781. echo 'x - extracting pixmon-0.3/rle.h (Text)'
  1782. sed 's/^X//' << 'SHAR_EOF' > 'pixmon-0.3/rle.h' &&
  1783. #ifdef __STDC__
  1784. X
  1785. extern
  1786. unsigned long 
  1787. rl_encode(
  1788. X    unsigned char    *buffer, 
  1789. X    unsigned long    size, 
  1790. X    unsigned char    escape
  1791. );
  1792. X
  1793. extern
  1794. unsigned long 
  1795. rl_decode (
  1796. X    unsigned char    *src_buffer, 
  1797. X    unsigned char    *dst_buffer, 
  1798. X    unsigned long    src_size, 
  1799. X    unsigned char    escape
  1800. );
  1801. X
  1802. extern
  1803. unsigned long 
  1804. rl_decode_length (
  1805. X    unsigned char    *src_buffer, 
  1806. X    unsigned long    src_size, 
  1807. X    unsigned char    escape
  1808. );
  1809. X
  1810. extern
  1811. void 
  1812. rl_decode_init(
  1813. X        unsigned char    *src_buffer, 
  1814. X        unsigned long    src_size,
  1815. X        unsigned char    escape
  1816. );
  1817. X
  1818. extern
  1819. unsigned long 
  1820. rl_decode_next(
  1821. X            unsigned char    *dst_buffer, 
  1822. X            unsigned long    dst_size
  1823. );
  1824. X
  1825. #else
  1826. X
  1827. extern unsigned long rl_encode();
  1828. extern unsigned long rl_decode ();
  1829. extern unsigned long rl_decode_length ();
  1830. extern void rl_decode_init();
  1831. extern unsigned long rl_decode_next();
  1832. X
  1833. #endif
  1834. SHAR_EOF
  1835. chmod 0640 pixmon-0.3/rle.h ||
  1836. echo 'restore of pixmon-0.3/rle.h failed'
  1837. Wc_c="`wc -c < 'pixmon-0.3/rle.h'`"
  1838. test 807 -eq "$Wc_c" ||
  1839.     echo 'pixmon-0.3/rle.h: original size 807, current size' "$Wc_c"
  1840. rm -f _shar_wnt_.tmp
  1841. fi
  1842. rm -f _shar_seq_.tmp
  1843. echo You have unpacked the last part
  1844. exit 0
  1845.  
  1846. exit 0 # Just in case...
  1847. -- 
  1848.   // chris@IMD.Sterling.COM            | Send comp.sources.x submissions to:
  1849. \X/  Amiga - The only way to fly!      |
  1850.  "It's intuitively obvious to the most |    sources-x@imd.sterling.com
  1851.   casual observer..."                  |
  1852.