home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume43 / hpcdtoppm / part03 < prev    next >
Internet Message Format  |  1994-06-10  |  61KB

  1. From: danisch@ira.uka.de (Hadmut Danisch)
  2. Newsgroups: comp.sources.misc
  3. Subject: v43i041:  hpcdtoppm - convert Photo-CD file into portable pixmap, v0.6, Part03/03
  4. Date: 10 Jun 1994 11:19:45 -0500
  5. Organization: Sterling Software
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <2ta3r1$fgb@sparky.sterling.com>
  9. X-Md4-Signature: 39fb4c6454a2ea685854ff27cf517d52
  10.  
  11. Submitted-by: danisch@ira.uka.de (Hadmut Danisch)
  12. Posting-number: Volume 43, Issue 41
  13. Archive-name: hpcdtoppm/part03
  14. Environment: Photo-CD
  15. Supersedes: hpcdtoppm: Volume 39, Issue 2-4
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  hpcdtoppm.0.6/Adding_code hpcdtoppm.0.6/Changes
  22. #   hpcdtoppm.0.6/Examples hpcdtoppm.0.6/Makefile hpcdtoppm.0.6/README
  23. #   hpcdtoppm.0.6/README.TOO hpcdtoppm.0.6/ReadMe.NeXT
  24. #   hpcdtoppm.0.6/ReadMe.SGI hpcdtoppm.0.6/TODO hpcdtoppm.0.6/color.c
  25. #   hpcdtoppm.0.6/config.h hpcdtoppm.0.6/hpcdtoppm.h
  26. #   hpcdtoppm.0.6/hpcdtoppm.man hpcdtoppm.0.6/pcdindex
  27. #   hpcdtoppm.0.6/tools.c
  28. # Wrapped by kent@sparky on Fri Jun 10 11:08:33 1994
  29. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  30. echo If this archive is complete, you will see the following message:
  31. echo '          "shar: End of archive 3 (of 3)."'
  32. if test -f 'hpcdtoppm.0.6/Adding_code' -a "${1}" != "-c" ; then 
  33.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/Adding_code'\"
  34. else
  35.   echo shar: Extracting \"'hpcdtoppm.0.6/Adding_code'\" \(2027 characters\)
  36.   sed "s/^X//" >'hpcdtoppm.0.6/Adding_code' <<'END_OF_FILE'
  37. XSeveral people were changing the output image format
  38. Xof the decoder or asked for a different output format.
  39. X
  40. Xpbmplus enables the transformation to every image
  41. Xformat, but sometimes it is better to have the
  42. Xformat "inside". Therefore v0.5 is able to keep several
  43. Xformat 'drivers'. 
  44. X
  45. X
  46. XTo add a new output format:
  47. X
  48. X- Append a new tag to the enum type OUTFOR in hpcdtoppm.h
  49. X
  50. X- change O_DEFAULT to this tag in config.h if you want to
  51. X  have this format as the default format.
  52. X
  53. X- Insert a new 'if(...){...}' contruct to the procedure
  54. X  parseargs in main.c after the comment "Output options".
  55. X
  56. X- Insert description text to error.c and hpcdtoppm.man.
  57. X
  58. X- If your format needs only grayscale data, append your
  59. X  tag to the line "monochrome=(outfor==O_PGM)|| ..."
  60. X  in the main procedure in main.c .
  61. X
  62. X- If your format uses the paper size values, append your
  63. X  tag to the line "paper=(outfor==O_PS)|| ..."
  64. X  in the main procedure in main.c .
  65. X
  66. X- Insert your tag into the switch-statement in the
  67. X  procedure colconvert in color.c. If you need a
  68. X  8-bit-grayscale or 24-bit-rgb model, you just
  69. X  have to insert a "case O_YourTag :" . Otherwise
  70. X  you have to write your own colorconversion.
  71. X
  72. X- Insert your tag and procedure name into the switch-
  73. X  statement in the procedure writepicture in output.c. 
  74. X  If you have a three-plane-image you can use the do_3plane
  75. X  procedure with a pointer to your format writing
  76. X  procedure as the first argument, if you have one 
  77. X  image plane, use the do_1plane. Otherwise write 
  78. X  a similar do_nplane  procedure.
  79. X
  80. X- Write a procedure, which produces your format. You
  81. X  should use the parameter scheme as defined for the
  82. X  driver types OUT3PL and OUT1PL in hpcdtoppm.h.
  83. X
  84. X  This means:
  85. X  - a FILE *pointer to the output file
  86. X  - image width and height.
  87. X  
  88. X  - for each image plane the triple:
  89. X    - a pointer to the upper left position
  90. X    - a relative row step    ( in bytes )
  91. X    - a relative column step ( in bytes )
  92. X
  93. X- If it works, let me know it. :-) Send mail to
  94. X  danisch@ira.uka.de .   
  95. X
  96. X
  97. X
  98. XHadmut
  99. X
  100. X
  101. X
  102. X
  103. END_OF_FILE
  104.   if test 2027 -ne `wc -c <'hpcdtoppm.0.6/Adding_code'`; then
  105.     echo shar: \"'hpcdtoppm.0.6/Adding_code'\" unpacked with wrong size!
  106.   fi
  107.   # end of 'hpcdtoppm.0.6/Adding_code'
  108. fi
  109. if test -f 'hpcdtoppm.0.6/Changes' -a "${1}" != "-c" ; then 
  110.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/Changes'\"
  111. else
  112.   echo shar: Extracting \"'hpcdtoppm.0.6/Changes'\" \(2166 characters\)
  113.   sed "s/^X//" >'hpcdtoppm.0.6/Changes' <<'END_OF_FILE'
  114. XChanges of hpcdtoppm:
  115. X
  116. Xv0.6:
  117. X
  118. X- hpcdtoppm now finds the 64Base extension files from the
  119. X  path given for the image-file name. 
  120. X
  121. X- small bug fixed.
  122. X
  123. Xv0.6 beta patch2:
  124. X
  125. X- bug fixed for images with more than one file for
  126. X  each 64base plane
  127. X
  128. Xv0.6 beta patch1:
  129. X
  130. X- bug fixed in opening the 64Base files.
  131. X
  132. X- a debugging printf removed.
  133. X
  134. Xv0.6 beta:
  135. X
  136. X- Code added to read 64Base
  137. X
  138. X
  139. Xv0.5 pl1:
  140. X
  141. X- Bug fixed in main.c, procedure f_ov. When writing all the
  142. X  images from overview files, a lot of file descriptors were
  143. X  opened, but never closed. This produced write errors if the
  144. X  machine has not enough file descriptors.
  145. X
  146. X- procedure clear renamed to clearimpl to avoid collision with
  147. X  other libraries
  148. X
  149. X- data types OUTGRAY and OUTRGB renamed to OUT1PL and OUT3PL,
  150. X  these data types are not bound to special color models.
  151. X
  152. X- gsave/grestore added to postscript output
  153. X
  154. Xv0.5:
  155. X
  156. X- Bug fixed in pgm writing procedure
  157. X
  158. X- Missing ':' added in BoundingBox line of encapsulated
  159. X  Postscript
  160. X
  161. X- postscript output with Floyd-Steinberg dithering added
  162. X
  163. X- orientation chooser for contact sheet option -C
  164. X
  165. X- accepts input from stdin (give '-' as filename)
  166. X
  167. X- -S option for subrectangles
  168. X
  169. X- procedure definitions in ANSI-C
  170. X
  171. X- "turn on head" added.
  172. X
  173. X
  174. Xv0.4:
  175. X
  176. X- Additional Options -m, -pos, -rep, -crop
  177. X
  178. X- pgm output added
  179. X
  180. X- postscript output added
  181. X
  182. X- Flip options
  183. X
  184. X- color corrections
  185. X
  186. X- primitive form of contact sheet
  187. X
  188. X- simple method of jumping over reading errors in
  189. X  Huffman code
  190. X
  191. X- optional Huffman-Lookuptable for speedup
  192. X
  193. X
  194. X
  195. Xv0.3:
  196. X- Additional Options -x, -a and -ycc
  197. X
  198. X- bcopy thrown out.
  199. X
  200. X- New datatype sBYTE for char. This fixes the problem with
  201. X  compilers which have the char unsigned. These got some
  202. X  'snow' in their pictures (merry christmas :-).
  203. X
  204. X- Address arithmetik bug fixed in writepicture
  205. X
  206. Xv0.2:
  207. X
  208. X- Small workaround for strange behavior of address-calculation
  209. X  of a c-compiler for NeXT.
  210. X
  211. X- Improved rounding for integer maths.
  212. X
  213. X- Thrown out floating arithmetic, changed color conversion to
  214. X  integer fixed point.
  215. X
  216. X- PPM-writing-routines added. You can choose whether you
  217. X  want to use pbmplus-routines or the included routines.
  218. X
  219. X- some ununused variables thrown out.
  220. X
  221. END_OF_FILE
  222.   if test 2166 -ne `wc -c <'hpcdtoppm.0.6/Changes'`; then
  223.     echo shar: \"'hpcdtoppm.0.6/Changes'\" unpacked with wrong size!
  224.   fi
  225.   # end of 'hpcdtoppm.0.6/Changes'
  226. fi
  227. if test -f 'hpcdtoppm.0.6/Examples' -a "${1}" != "-c" ; then 
  228.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/Examples'\"
  229. else
  230.   echo shar: Extracting \"'hpcdtoppm.0.6/Examples'\" \(1568 characters\)
  231.   sed "s/^X//" >'hpcdtoppm.0.6/Examples' <<'END_OF_FILE'
  232. XThis are some examples of the use of hpcdtoppm, insert one
  233. Xof your images where a filename as img0010.pcd is used.
  234. X
  235. X"postscriptprinter" means something on your machine, what
  236. Xprints postscript output on paper.
  237. X
  238. X"xv" is a program for viewing images on X11.
  239. X
  240. X
  241. X
  242. Xhpcdtoppm img0005.pcd img0005.ppm
  243. X
  244. X   converts the image img0005.pcd to the ppm-format with resolution
  245. X   128x192. Output into the file img0005.ppm
  246. X
  247. X
  248. Xhpcdtoppm -3 -crop img0005.pcd | xv -
  249. X
  250. X   removes a black frame (some images are scanned with a black frame) and
  251. X   displays the image with resolution 512x768 on a X11-display (24-bit if possible).
  252. X
  253. X
  254. Xhpcdtoppm -l -5 -s -pgm img0005.pcd img0005.pgm
  255. X
  256. X   turns the images counter-clockwise to portrait, converts to 
  257. X   the 2048x3072 resolution, applies a sharpness-operator and writes
  258. X   it as 8-Bit-grayscale pgm to the file img0005.pgm.
  259. X
  260. X
  261. Xhpcdtoppm -l -5 -c+ -psd img0005.pcd img0005.ps
  262. X
  263. X   corrects the images brighter and converts to a 2048x3072 dithered
  264. X   postscript image. Fits on a sheet of paper if used on a 300dpi printer.
  265. X
  266. Xhpcdtoppm -s -S 1300-1850 1000-1260 -5 img0010.pcd | xv -8 -
  267. X
  268. X   displays a small subrectangle of the high resolution an your x11 screen.
  269. X
  270. Xhpcdtoppm -c+ -l -s -S 1300-1850 1000-1260 -5 -psd -pw 500 -dpi 300 img0010.pcd | postscriptprinter
  271. X
  272. X   prints out a dithered small subrectangle of your image.
  273. X
  274. X
  275. Xhpcdtoppm  -c+ -C 6 l -psd -dpi 300 -pw 500 overview.pcd |postscriptprinter
  276. X
  277. X   prints an index print; play with the number 6.
  278. X
  279. X
  280. Xhpcdtoppm -c+ -C 4 n -psd -dpi 300 -pw 500 overview.pcd |postscriptprinter
  281. X
  282. X   something similar
  283. X
  284. END_OF_FILE
  285.   if test 1568 -ne `wc -c <'hpcdtoppm.0.6/Examples'`; then
  286.     echo shar: \"'hpcdtoppm.0.6/Examples'\" unpacked with wrong size!
  287.   fi
  288.   # end of 'hpcdtoppm.0.6/Examples'
  289. fi
  290. if test -f 'hpcdtoppm.0.6/Makefile' -a "${1}" != "-c" ; then 
  291.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/Makefile'\"
  292. else
  293.   echo shar: Extracting \"'hpcdtoppm.0.6/Makefile'\" \(471 characters\)
  294.   sed "s/^X//" >'hpcdtoppm.0.6/Makefile' <<'END_OF_FILE'
  295. X#
  296. X#
  297. X# Use the hpcdtoppm procedures for writing ppm and pgm
  298. XVFLAGS= -DOWN_WRITE
  299. XVLIBS=
  300. X# Use the pbmplus procedures for writing ppm and pgm
  301. X#VFLAGS=
  302. X#VLIBS= libpbm.a libpgm.a libppm.a
  303. X#
  304. X#
  305. XCC=    gcc 
  306. XCFLAGS=    -g -ansi -Wall ${VFLAGS} 
  307. XINCL=    hpcdtoppm.h config.h
  308. XOBJ=    main.o output.o color.o format.o tools.o error.o \
  309. X    ppm.o postscr.o const.o
  310. XCOMPILE=${CC} ${CFLAGS}  -c
  311. X#
  312. Xhpcdtoppm: ${OBJ}
  313. X    ${CC} -o hpcdtoppm ${OBJ} ${VLIBS}
  314. X#
  315. X${OBJ}: ${$@:.o=.c} ${INCL}
  316. X    ${COMPILE} ${*}.c
  317. END_OF_FILE
  318.   if test 471 -ne `wc -c <'hpcdtoppm.0.6/Makefile'`; then
  319.     echo shar: \"'hpcdtoppm.0.6/Makefile'\" unpacked with wrong size!
  320.   fi
  321.   # end of 'hpcdtoppm.0.6/Makefile'
  322. fi
  323. if test -f 'hpcdtoppm.0.6/README' -a "${1}" != "-c" ; then 
  324.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/README'\"
  325. else
  326.   echo shar: Extracting \"'hpcdtoppm.0.6/README'\" \(4172 characters\)
  327.   sed "s/^X//" >'hpcdtoppm.0.6/README' <<'END_OF_FILE'
  328. X
  329. XThis is Version 0.6 of hpcdtoppm, Hadmut's pcd to ppm converter.
  330. XIt has this name to be distinguishable in case someone
  331. Xelse is producing a program also called pcdtoppm.
  332. X
  333. XRead the README.TOO and edit the config.h and the Makefile !
  334. X
  335. XThis program converts Photo-CD-Images to the ppm-Format of
  336. Xpbmplus. You can compile the program in two ways:
  337. X
  338. X1. Use its own ppm-writing-routines. In this case
  339. X   you don't need ppm-includes or libraries. You
  340. X   have to define macro 'OWN_WRITE' in the source or
  341. X   by compiler-option. I am not sure, whether the
  342. X   format of the ppm-header is the same on non-unix
  343. X   machines. If you get problems with line-endings
  344. X   (things like CR, LF, CR/LF), modify the macro
  345. X   PPM_Header.
  346. X
  347. X2. You can use the pbmplus-routines. In this case
  348. X   you need some files from the pbmplus package to compile:
  349. X
  350. X   ppm.h pgm.h pbm.h pbmplus.h libppm.a libpgm.a libpbm.a
  351. X
  352. X
  353. XIMPORTANT: Some older versions of the gcc have problems with
  354. Xoptimization. They produce buggy code. This code will not
  355. Xdie with 'segmentation fault' or something like that, it 
  356. Xjust produces damaged images. 
  357. X
  358. XI did not have detailed information of the file-format and
  359. Xmost of my information I got by staring at the hex-dumps
  360. Xof an image file. So I am not absolutly sure, whether it
  361. Xworks on all Photo-CDs, because there are some bytes in
  362. Xthe header which I don't understand. But it works on
  363. Xmy Photo-CD.
  364. X
  365. XNote that you will get a 24 bit image. You can view these
  366. Xfiles with xv, but if you have an 8-bit-screen you will
  367. Xsometimes have some color-defects (if you have an 1-bit-screen
  368. Xyou will often have a lot of color-defects :-). 
  369. XIt will also take some time to show with xv.
  370. X
  371. XYou can produce nice overview prints if you get the icontact
  372. Xprogram of Mark B. Hanson and put something like
  373. X
  374. Xdecode    pcd    hpcdtoppm -1 -a
  375. X
  376. Xin your ~/.icrc 
  377. X
  378. Xor by use of the pcdindex script of Pieter S. van der
  379. XMeulen in this distribution.
  380. X
  381. X
  382. XIf you compile the program on a machine other than
  383. XSPARC please send me a short email which machine
  384. Xyou are using, whether you had problems or which
  385. Xchanges you have made.
  386. X
  387. XIf you port the program to any machine, please tell me,
  388. Xwhat you did and where to get the program. Within the
  389. Xlast weeks I got a lot of mail asking for the special
  390. XAmiga/NeXT/SGI/... version. Read the Special.* files.
  391. X
  392. X
  393. X
  394. XThanks to
  395. X
  396. X- James Pearson (jcpearso@ps.ucl.ac.uk) for giving debugging hints for 
  397. X  the 64Base code, for sending a 64Base image and the code to find the
  398. X  64Base files from the image file path.
  399. X
  400. X- R. P. Channing ["Rick"] Rodgers (rodgers@nlm.nih.gov) for improving the
  401. X  man page.
  402. X
  403. X
  404. X- Some people sending code for TIFF and GIF writing code. Sorry, I didn't
  405. X  have the time to implant the code yet. I don't know whether many people want
  406. X  to have such extensions, please send mail if so.
  407. X
  408. X- Adolf Mathias (mathias@ira.uka.de) for writing some of the
  409. X  postscript drivers.
  410. X
  411. X- Pieter S. van der Meulen for the contact sheet script.
  412. X
  413. X- Jeff for finding out how to detect the orientation of the 
  414. X  Overview thumbnails [ Hi Jeff, how are you? :-) ]
  415. X
  416. X- A lot of people for sending mail about
  417. X  compilation on MS-DOS and OS/2 and many other machines.
  418. X
  419. X- lots and lots of people for sending me their improvements of the code.
  420. X  Sorry, but I can not read and analyze them all. I do not have so
  421. X  much time for the decoder, its my hobby, not my job. Often I get
  422. X  mail with a complete source and "Hi Hadmut, I have improved your
  423. X  code. It is now faster/smaller/better/something_else." But I don't
  424. X  know, *what* is changed. A simple diff doesn't work, they all were
  425. X  reformatting my source completely and I do not have the time to
  426. X  read all sources to find the real changes. There are a lot
  427. X  of real good ideas, but *please* tell me, where is the beef.
  428. X
  429. X- lots of people sending me just a formatted version of my code.
  430. X  Thanks to them all, and yes, I have indent(1). I prefer
  431. X  this way of formatting C-source.
  432. X
  433. X
  434. X
  435. X
  436. XHadmut Danisch  (danisch@ira.uka.de , will change in future)
  437. XE.I.S.S.  (European Institute for System Security)
  438. XUniversitaet Karlsruhe
  439. XAm Fasanengarten 5
  440. X
  441. XD-76128 Karlsruhe  
  442. X
  443. XGermany
  444. X
  445. XFAX: +49 721 696893
  446. XTel./FAX privat: +49 721 607306  (will change in future)
  447. X
  448. X
  449. END_OF_FILE
  450.   if test 4172 -ne `wc -c <'hpcdtoppm.0.6/README'`; then
  451.     echo shar: \"'hpcdtoppm.0.6/README'\" unpacked with wrong size!
  452.   fi
  453.   # end of 'hpcdtoppm.0.6/README'
  454. fi
  455. if test -f 'hpcdtoppm.0.6/README.TOO' -a "${1}" != "-c" ; then 
  456.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/README.TOO'\"
  457. else
  458.   echo shar: Extracting \"'hpcdtoppm.0.6/README.TOO'\" \(1553 characters\)
  459.   sed "s/^X//" >'hpcdtoppm.0.6/README.TOO' <<'END_OF_FILE'
  460. XHere are some additional informations for installing and use:
  461. X
  462. XI.   Edit the config.h and the Makefile !
  463. X
  464. XII.  Several people had 'snowy' images with v0.1 and v0.2.
  465. X     This happens when the machine handles the standard
  466. X     type char unsigned. Therefore the datatype sBYTE
  467. X     was introduced as 'signed char'. If your compiler
  468. X     doesn't understand this, change sBYTE to such a datatype
  469. X     of your compiler or use a commandlineoption like
  470. X     -DsBYTE=char .
  471. XIII. Not every image contains all resolutions (especially images
  472. X     from demo disks). You can't extract resolutions which are
  473. X     not contained.
  474. X
  475. XIV.  Some cdrom drives read more than the data sectors of the 
  476. X     PhotoCD files. They read additional sector headers etc.
  477. X     In this case to have to write a little conversion tool.
  478. X
  479. X     E.g.: Sony NEWS, model NWS-3720
  480. X           Write a simple filter program, which takes the file,
  481. X           cuts in slices of 0x920 size, takes out 0x800 data 
  482. X           with offset 8 of each slice and write them out in a new file.
  483. X
  484. X
  485. XV.   There are some problems when compiling for MS-DOS or OS/2.
  486. X     I don't like this, i don't have this and i don't use this. 
  487. X     Several people sent mail with tricks for compiling.
  488. X     The important things are:
  489. X     - Use the gcc compiler and
  490. X
  491. X     - change the fopen parameters from "w" to "wb" and from "r" to "rb".
  492. X     - or use the binmode.o routines.
  493. X
  494. XVI.  On a Sun Workstation you can mount the Photo-CD as a high-sierra
  495. X     file system with the command
  496. X     mount -r -t hsfs /dev/sr0 /cdrom
  497. X
  498. X    
  499. END_OF_FILE
  500.   if test 1553 -ne `wc -c <'hpcdtoppm.0.6/README.TOO'`; then
  501.     echo shar: \"'hpcdtoppm.0.6/README.TOO'\" unpacked with wrong size!
  502.   fi
  503.   # end of 'hpcdtoppm.0.6/README.TOO'
  504. fi
  505. if test -f 'hpcdtoppm.0.6/ReadMe.NeXT' -a "${1}" != "-c" ; then 
  506.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/ReadMe.NeXT'\"
  507. else
  508.   echo shar: Extracting \"'hpcdtoppm.0.6/ReadMe.NeXT'\" \(244 characters\)
  509.   sed "s/^X//" >'hpcdtoppm.0.6/ReadMe.NeXT' <<'END_OF_FILE'
  510. X
  511. X
  512. XThere are at least two ports to the NeXT machine with
  513. Xgraphical user interface. One of them is called "pCD".
  514. XSince i do not get informed about these ports, i don't
  515. Xknow on which version of hpcdtoppm they are based and
  516. Xwhere to get them. 
  517. X
  518. X
  519. END_OF_FILE
  520.   if test 244 -ne `wc -c <'hpcdtoppm.0.6/ReadMe.NeXT'`; then
  521.     echo shar: \"'hpcdtoppm.0.6/ReadMe.NeXT'\" unpacked with wrong size!
  522.   fi
  523.   # end of 'hpcdtoppm.0.6/ReadMe.NeXT'
  524. fi
  525. if test -f 'hpcdtoppm.0.6/ReadMe.SGI' -a "${1}" != "-c" ; then 
  526.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/ReadMe.SGI'\"
  527. else
  528.   echo shar: Extracting \"'hpcdtoppm.0.6/ReadMe.SGI'\" \(345 characters\)
  529.   sed "s/^X//" >'hpcdtoppm.0.6/ReadMe.SGI' <<'END_OF_FILE'
  530. X
  531. XThere is a special version of hpcdtoppm with extensions for
  532. XSGI machines. The extensions are written by
  533. X
  534. X    Rodney Hoinkes
  535. X    Head of Design Applications
  536. X    Centre for Landscape Research
  537. X    University of Toronto
  538. X    Email: rodney@dgp.utoronto.ca
  539. X
  540. XThe SGI version is available via ftp at
  541. Xexplorer.dgp.toronto.edu (128.100.1.129) in pub/sgi/sgiphotocd .
  542. X
  543. X
  544. X
  545. END_OF_FILE
  546.   if test 345 -ne `wc -c <'hpcdtoppm.0.6/ReadMe.SGI'`; then
  547.     echo shar: \"'hpcdtoppm.0.6/ReadMe.SGI'\" unpacked with wrong size!
  548.   fi
  549.   # end of 'hpcdtoppm.0.6/ReadMe.SGI'
  550. fi
  551. if test -f 'hpcdtoppm.0.6/TODO' -a "${1}" != "-c" ; then 
  552.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/TODO'\"
  553. else
  554.   echo shar: Extracting \"'hpcdtoppm.0.6/TODO'\" \(285 characters\)
  555.   sed "s/^X//" >'hpcdtoppm.0.6/TODO' <<'END_OF_FILE'
  556. XThings I want to do when I find time:
  557. X
  558. X- Make the 64Base decoder read the images in real size,
  559. X  not always 4096x6144.
  560. X
  561. X- Better gamma correction procedures
  562. X
  563. X- Color conversion to YMC and YMCK for printer drivers
  564. X
  565. X- Driver for color printers
  566. X
  567. X- Better correction of reading errors
  568. X
  569. X
  570. X
  571. X
  572. END_OF_FILE
  573.   if test 285 -ne `wc -c <'hpcdtoppm.0.6/TODO'`; then
  574.     echo shar: \"'hpcdtoppm.0.6/TODO'\" unpacked with wrong size!
  575.   fi
  576.   # end of 'hpcdtoppm.0.6/TODO'
  577. fi
  578. if test -f 'hpcdtoppm.0.6/color.c' -a "${1}" != "-c" ; then 
  579.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/color.c'\"
  580. else
  581.   echo shar: Extracting \"'hpcdtoppm.0.6/color.c'\" \(4569 characters\)
  582.   sed "s/^X//" >'hpcdtoppm.0.6/color.c' <<'END_OF_FILE'
  583. X/* hpcdtoppm (Hadmut's pcdtoppm) v0.6
  584. X*  Copyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
  585. X*  Permission to use and distribute this software and its
  586. X*  documentation for noncommercial use and without fee is hereby granted,
  587. X*  provided that the above copyright notice appear in all copies and that
  588. X*  both that copyright notice and this permission notice appear in
  589. X*  supporting documentation. It is not allowed to sell this software in 
  590. X*  any way. This software is not public domain.
  591. X*/
  592. X
  593. X#include "hpcdtoppm.h"
  594. X
  595. Xextern sINT RGB_BitSh1,RGB_Maximum1;
  596. Xextern sINT RGB_F_LL;
  597. Xextern sINT RGB_F_C1,RGB_O_C1;
  598. Xextern sINT RGB_F_C2,RGB_O_C2;
  599. Xextern sINT RGB_F_G1,RGB_F_G2,RGB_O_G;
  600. Xextern uBYTE RGB_corr0[],RGB_corr1[],RGB_corr2[];
  601. X
  602. X
  603. Xstatic uBYTE *RGB_corr=0;
  604. Xstatic sINT T_L[256],T_R[256],T_G[256],T_g[256],T_B[256];
  605. X
  606. X#define slen 3072
  607. X
  608. X
  609. X
  610. Xstatic void initcorr(void)
  611. X { 
  612. X  switch(corrmode)
  613. X   {case C_LINEAR: RGB_corr=RGB_corr0; break;
  614. X    case C_DARK:   RGB_corr=RGB_corr1; break;
  615. X    case C_BRIGHT: RGB_corr=RGB_corr2; break;
  616. X    default: error(E_INTERN);
  617. X   }
  618. X }
  619. X
  620. X
  621. X
  622. Xstatic void initctable(void)
  623. X {sINT i;
  624. X  static sINT init=0;
  625. X
  626. X  if(init) return;
  627. X
  628. X  init=1;
  629. X
  630. X  initcorr();
  631. X
  632. X  for(i=0;i<256;i++)
  633. X   {  T_L[i] = i * RGB_F_LL;
  634. X      T_R[i] = i * RGB_F_C2 + RGB_O_C2;
  635. X      T_G[i] = i * RGB_F_G1;
  636. X      T_g[i] = i * RGB_F_G2 + RGB_O_G;
  637. X      T_B[i] = i * RGB_F_C1 + RGB_O_C1;      
  638. X   }
  639. X  
  640. X }
  641. X
  642. X
  643. Xstatic void ycctorgb(implane *l,implane *c1,implane *c2)
  644. X {dim x,y,w,h;
  645. X  uBYTE *pl,*pc1,*pc2;
  646. X  sINT red,green,blue;
  647. X  sINT L;
  648. X
  649. X  melde("ycctorgb\n");
  650. X  initctable();
  651. X
  652. X  w=l->iwidth;
  653. X  h=l->iheight;
  654. X
  655. X  for(y=0;y<h;y++)
  656. X   {
  657. X    pl =  l->im + y *  l->mwidth;
  658. X    pc1= c1->im + y * c1->mwidth;
  659. X    pc2= c2->im + y * c2->mwidth;
  660. X
  661. X    for(x=0;x<w;x++)
  662. X     {
  663. X      L    =  T_L[*pl]; 
  664. X      red  = (L + T_R[*pc2]             )>>RGB_BitSh1;
  665. X      green= (L + T_G[*pc1] + T_g[*pc2] )>>RGB_BitSh1; 
  666. X      blue = (L + T_B[*pc1]             )>>RGB_BitSh1;
  667. X
  668. X      red   = TRIF(red,  0,RGB_Maximum1,0,red,  RGB_Maximum1);
  669. X      green = TRIF(green,0,RGB_Maximum1,0,green,RGB_Maximum1);
  670. X      blue  = TRIF(blue ,0,RGB_Maximum1,0,blue, RGB_Maximum1);
  671. X
  672. X      *(pl++ )=RGB_corr[red]; 
  673. X      *(pc1++)=RGB_corr[green]; 
  674. X      *(pc2++)=RGB_corr[blue];
  675. X     }
  676. X   }
  677. X }
  678. X#undef BitShift
  679. X
  680. X
  681. X
  682. X
  683. X
  684. Xstatic void sharpit(implane *l)
  685. X {sINT x,y,h,w,mw,akk;
  686. X  uBYTE f1[slen],f2[slen],*old,*akt,*ptr,*work,*help,*optr=0;
  687. X
  688. X  melde("sharpit\n");
  689. X
  690. X  if((!l) || (!l->im)) error(E_INTERN);
  691. X  if(l->iwidth > slen) error(E_INTERN);
  692. X
  693. X  old=f1; akt=f2;
  694. X  h=l->iheight;
  695. X  w=l->iwidth;
  696. X  mw=l->mwidth;
  697. X
  698. X  for(y=1;y<h-1;y++)
  699. X   {
  700. X    ptr=l->im+ y*mw;
  701. X    optr=ptr-mw;
  702. X    work=akt;
  703. X
  704. X    *(work++)= *(ptr++);
  705. X    for(x=1;x<w-1;x++)
  706. X     {  akk = 5*((sINT)ptr[0])- ((sINT)ptr[1])  - ((sINT)ptr[-1]) 
  707. X                              - ((sINT)ptr[mw]) - ((sINT)ptr[-mw]);
  708. X        NORM(akk);
  709. X        *(work++)=akk;
  710. X        ptr++;
  711. X     }
  712. X
  713. X    *(work++)= *(ptr++);
  714. X
  715. X    if(y>1) 
  716. X      for(x=0;x<w;x++)
  717. X        optr[x] = old[x];
  718. X
  719. X    help=old;old=akt;akt=help;
  720. X     
  721. X   }
  722. X
  723. X
  724. X
  725. X  akt=optr+mw;
  726. X  for(x=0;x<w;x++)
  727. X    *(akt++) = *(old++);
  728. X }
  729. X
  730. X
  731. X
  732. X
  733. X
  734. X
  735. X
  736. Xstatic void initmtable(void)
  737. X {sINT i,h;
  738. X  static sINT init=0;
  739. X
  740. X  if(init) return;
  741. X
  742. X  init=1;
  743. X
  744. X  initcorr();
  745. X
  746. X  for(i=0;i<256;i++)
  747. X   {  h = (i * RGB_F_LL)>>RGB_BitSh1;
  748. X      h = TRIF(h,0,RGB_Maximum1,0,h,RGB_Maximum1);
  749. X      T_L[i]=RGB_corr[h];
  750. X   }
  751. X  
  752. X }
  753. X
  754. X
  755. Xstatic void monocorr(implane *l)
  756. X {dim x,y,w,h;
  757. X  uBYTE *ptr;
  758. X
  759. X  melde("monocorr\n");
  760. X  initmtable();
  761. X
  762. X  w=l->iwidth;
  763. X  h=l->iheight;
  764. X
  765. X  for(y=0;y<h;y++)
  766. X   {
  767. X    ptr=  l->im + y *  l->mwidth;
  768. X    for(x=0;x<w;x++,ptr++)
  769. X     { *ptr = T_L[*ptr]; 
  770. X     }
  771. X   }
  772. X }
  773. X
  774. X
  775. X
  776. X
  777. X
  778. X
  779. X
  780. Xvoid colconvert(sizeinfo *si,implane *l,implane *c1,implane *c2)
  781. X
  782. X#define w (si->rdhlen)
  783. X#define h (si->rdvlen)
  784. X
  785. X {
  786. X  melde("colconvert\n");
  787. X
  788. X    if((!l ) || ( l->iwidth != w ) || ( l->iheight != h) || (! l->im)) error(E_INTERN);
  789. X
  790. X  if(!monochrome)
  791. X   {
  792. X    if((!c1) || (c1->iwidth != w ) || (c1->iheight != h) || (!c1->im)) error(E_INTERN);
  793. X    if((!c2) || (c2->iwidth != w ) || (c2->iheight != h) || (!c2->im)) error(E_INTERN);
  794. X   }
  795. X
  796. X  if (do_crop)  cropit(si,l,c1,c2);
  797. X  else          shrink(si,l,c1,c2);
  798. X  if (do_sharp) sharpit(l);
  799. X
  800. X  switch (outfor)
  801. X   {
  802. X    /*  RGB-Conversion */
  803. X    case O_PS:
  804. X    case O_EPS:
  805. X    case O_PPM: ycctorgb(l,c1,c2);
  806. X                break;
  807. X
  808. X    /* Grayscale Conversion */
  809. X    case O_PSG:
  810. X    case O_EPSG:
  811. X    case O_PSD:
  812. X    case O_EPSD:
  813. X    case O_PGM: monocorr(l);
  814. X                break;
  815. X
  816. X    /* No Conversion */
  817. X    case O_YCC:
  818. X                break;
  819. X
  820. X    default: error(E_INTERN);
  821. X   }
  822. X#undef w
  823. X#undef h
  824. X }
  825. X
  826. X
  827. X
  828. END_OF_FILE
  829.   if test 4569 -ne `wc -c <'hpcdtoppm.0.6/color.c'`; then
  830.     echo shar: \"'hpcdtoppm.0.6/color.c'\" unpacked with wrong size!
  831.   fi
  832.   # end of 'hpcdtoppm.0.6/color.c'
  833. fi
  834. if test -f 'hpcdtoppm.0.6/config.h' -a "${1}" != "-c" ; then 
  835.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/config.h'\"
  836. else
  837.   echo shar: Extracting \"'hpcdtoppm.0.6/config.h'\" \(3990 characters\)
  838.   sed "s/^X//" >'hpcdtoppm.0.6/config.h' <<'END_OF_FILE'
  839. X/* hpcdtoppm (Hadmut's pcdtoppm) v0.6
  840. X*  Copyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
  841. X*  Permission to use and distribute this software and its
  842. X*  documentation for noncommercial use and without fee is hereby granted,
  843. X*  provided that the above copyright notice appear in all copies and that
  844. X*  both that copyright notice and this permission notice appear in
  845. X*  supporting documentation. It is not allowed to sell this software in 
  846. X*  any way. This software is not public domain.
  847. X*/
  848. X
  849. X
  850. X
  851. X/* define OWN_WRITE either here or by compiler-option if you don't want to use
  852. X   the pbmplus-routines for writing */
  853. X/* #define OWN_WRITE */
  854. X
  855. X
  856. X
  857. X/* define DEBUG for some debugging informations */
  858. X/* #define DEBUG */
  859. X
  860. X
  861. X/* define LONG_HELP or SHORT_HELP, if you want to have an options
  862. X   list if parameters are bad */
  863. X#define LONG_HELP
  864. X
  865. X
  866. X/* define DO_DECL_EXT for external declaration of system and library calls */
  867. X#define DO_DECL_EXT
  868. X
  869. X
  870. X/* define FASTHUFF for faster Huffman decoding with tables.
  871. X** this makes a little speedup, but needs about 768 KByte memory
  872. X*/
  873. X#define FASTHUFF
  874. X
  875. X
  876. X
  877. X#ifdef OWN_WRITE
  878. X/* If the own routines are used, this is the size of the buffer in bytes.
  879. X   You can shrink if needed. */
  880. X#define own_BUsize 50000
  881. X
  882. X/* The header for the ppm-files */
  883. X#define PPM_Header "P6\n%d %d\n255\n"
  884. X#define PGM_Header "P5\n%d %d\n255\n"
  885. X
  886. X
  887. X#endif
  888. X
  889. X
  890. X
  891. X/* fopen Parameters, for some systems (MS-DOS :-( ) you need "wb" and "rb" */
  892. X#define W_OP "w"
  893. X#define R_OP "r"
  894. X
  895. X
  896. X/* define SMALLNAMES if the filenames of PhotoCD have small letters on 
  897. X   your filesystem */
  898. X#define SMALLNAMES
  899. X
  900. X/* The separator between directory- and filenames */
  901. X#define DIRSEP '/'
  902. X
  903. X
  904. X
  905. X
  906. X
  907. X/* if you can't write to stdout in binary mode, you have to fdopen
  908. X   a FILE * in binary mode to stdout. This is important for system,
  909. X   where W_OP is something other than "w". Please define the
  910. X   Macro USE_FDOPEN in this case and check the instructions, where this
  911. X   macro is used.
  912. X*/
  913. X
  914. X/* #define USE_FDOPEN */
  915. X
  916. X
  917. X
  918. X
  919. X
  920. X
  921. X
  922. X
  923. X
  924. X/** Error detection **/
  925. X
  926. X#define error(x) eerror(x,__FILE__,__LINE__)
  927. X
  928. X
  929. X
  930. X/*
  931. X** Data Types
  932. X** Important: sBYTE must be a signed byte type !
  933. X** If your compiler doesn't understand "signed", remove it.
  934. X*/
  935. X
  936. X#ifndef sBYTE
  937. Xtypedef   signed char sBYTE;
  938. X#endif
  939. X
  940. Xtypedef unsigned char uBYTE;
  941. X
  942. X/* signed and unsigned 32-bit-integers 
  943. XsINT and uINT must at least have 32 bit. If you
  944. Xdon't have 32-bit-integers, take 64-bit and
  945. Xdefine the macro U_TOO_LONG !!!
  946. X
  947. XuINT and sINT must be suitable to the printf/scanf-format %d
  948. Xand %u and to the systemcalls as fread etc.
  949. X
  950. X*/
  951. X
  952. X#define uINT  unsigned int
  953. X#define sINT           int
  954. X/*
  955. X#define uLONG unsigned long
  956. X#define sLONG unsigned long
  957. X*/
  958. X/* #define U_TOO_LONG */
  959. X
  960. X
  961. X
  962. X
  963. X
  964. X
  965. Xtypedef uINT dim;
  966. Xtypedef sINT sdim;
  967. X
  968. X
  969. X
  970. X
  971. X/* Floating point data type and string for sscanf */
  972. X#define FLTPT double
  973. X#define SSFLTPT "%lf"
  974. X
  975. X
  976. X
  977. X
  978. X
  979. X
  980. X
  981. X/* Default taken when no size parameter given,
  982. X** C_DEFAULT depends on your taste and video-hardware,
  983. X*/
  984. X
  985. X#define S_DEFAULT S_Base16
  986. X#define O_DEFAULT O_PPM
  987. X#define C_DEFAULT C_LINEAR
  988. X#define T_DEFAULT T_AUTO
  989. X
  990. X
  991. X/* Background for contact sheet */
  992. X#define CONTLUM neutrLum
  993. X#define CONTCH1 neutrCh1
  994. X#define CONTCH2 neutrCh2
  995. X
  996. X
  997. X
  998. X
  999. X/* Maximum Black value of frame for cutting of the
  1000. X** frame. If MAX_BLACK is n, a frame is detected, when
  1001. X** all Luma values are within [ 0 .. (n-1) ]
  1002. X*/
  1003. X#define MAX_BLACK 1
  1004. X
  1005. X/* Default Postscript paper size
  1006. X** (German DIN A 4 )
  1007. X*/
  1008. X#define DEF_PAPER_LEFT    50.0
  1009. X#define DEF_PAPER_BOTTOM  50.0
  1010. X#define DEF_PAPER_WIDTH  500.0
  1011. X#define DEF_PAPER_HEIGHT 750.0
  1012. X#define DEF_DPI          300.0
  1013. X
  1014. X
  1015. X
  1016. X/* External Declarations */
  1017. X#ifdef DO_DECL_EXT
  1018. X
  1019. X/*extern void *malloc(unsigned);*/
  1020. Xextern int  sscanf(char *,char *,...);    
  1021. X
  1022. Xextern int  fprintf(FILE *,char *,...);
  1023. Xextern int  fclose(FILE *);
  1024. Xextern int  fseek(FILE *,long,int);
  1025. Xextern int  fread(void *,int,int,FILE *);
  1026. Xextern int  fwrite(void *,int,int,FILE *);
  1027. Xextern int  fputs(char *,FILE *);
  1028. Xextern int  fputc(char  ,FILE *);
  1029. Xextern int  fflush(FILE *);
  1030. X
  1031. X#endif
  1032. X
  1033. X
  1034. X
  1035. X
  1036. X
  1037. X
  1038. X
  1039. END_OF_FILE
  1040.   if test 3990 -ne `wc -c <'hpcdtoppm.0.6/config.h'`; then
  1041.     echo shar: \"'hpcdtoppm.0.6/config.h'\" unpacked with wrong size!
  1042.   fi
  1043.   # end of 'hpcdtoppm.0.6/config.h'
  1044. fi
  1045. if test -f 'hpcdtoppm.0.6/hpcdtoppm.h' -a "${1}" != "-c" ; then 
  1046.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/hpcdtoppm.h'\"
  1047. else
  1048.   echo shar: Extracting \"'hpcdtoppm.0.6/hpcdtoppm.h'\" \(5965 characters\)
  1049.   sed "s/^X//" >'hpcdtoppm.0.6/hpcdtoppm.h' <<'END_OF_FILE'
  1050. X/* hpcdtoppm (Hadmut's pcdtoppm) v0.6
  1051. X*  Copyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
  1052. X*  Permission to use and distribute this software and its
  1053. X*  documentation for noncommercial use and without fee is hereby granted,
  1054. X*  provided that the above copyright notice appear in all copies and that
  1055. X*  both that copyright notice and this permission notice appear in
  1056. X*  supporting documentation. It is not allowed to sell this software in 
  1057. X*  any way. This software is not public domain.
  1058. X*/
  1059. X
  1060. X
  1061. X#include <stdio.h>
  1062. X#include <string.h>
  1063. X#include <malloc.h>
  1064. X#include <sys/types.h>
  1065. X#include <ctype.h>
  1066. X#include "config.h"
  1067. X
  1068. X
  1069. X
  1070. X
  1071. X
  1072. X
  1073. X
  1074. X
  1075. X/* Format definitions */
  1076. X
  1077. X#define BaseW ((dim)768)
  1078. X#define BaseH ((dim)512)
  1079. X
  1080. X#define SECSIZE 0x800
  1081. X
  1082. X#define SeHead   2
  1083. X#define L_Head   (1+SeHead)
  1084. X
  1085. X#define SeBase16 18
  1086. X#define L_Base16 (1+SeBase16)
  1087. X
  1088. X#define SeBase4  72
  1089. X#define L_Base4  (1+SeBase4)
  1090. X
  1091. X#define SeBase   288
  1092. X#define L_Base   (1+SeBase)
  1093. X
  1094. X
  1095. X#define neutrLum 128
  1096. X#define neutrCh1 156
  1097. X#define neutrCh2 137
  1098. X
  1099. X
  1100. X
  1101. X
  1102. X
  1103. X
  1104. X
  1105. X/* Structures and definitions */
  1106. Xstruct _implane
  1107. X {dim  mwidth,mheight,
  1108. X       iwidth,iheight;
  1109. X  uBYTE *im,*mp;
  1110. X };
  1111. Xtypedef struct _implane implane;
  1112. X
  1113. X#define nullplane ((implane *) 0)
  1114. X
  1115. X
  1116. X
  1117. X
  1118. X
  1119. Xstruct _sizeinfo
  1120. X {dim w,h;  /* Image Resolution */
  1121. X  dim rdhoff,rdhlen, rdvoff, rdvlen; /* Size of Image in Memory */
  1122. X  dim imhoff,imhlen, imvoff, imvlen; /* Real Size of Image */
  1123. X };
  1124. Xtypedef struct _sizeinfo sizeinfo;
  1125. X
  1126. X
  1127. X
  1128. X
  1129. X/* Definitions for 64Base */
  1130. X
  1131. Xstruct file32 { uBYTE x1,x2,x3,x4;};
  1132. Xstruct file16 { uBYTE x1,x2;};
  1133. X#define FILE32(x) ( (((uINT)x.x1)<<24) | (((uINT)x.x2)<<16) | (((uINT)x.x3)<<8) | (uINT)x.x4 )
  1134. X#define FILE16(x) ( (((uINT)x.x1)<<8) | (uINT)x.x2 )
  1135. X
  1136. Xstruct ic_header {char ic_name[0x28];
  1137. X                  struct file16 val1;
  1138. X                  struct file16 val2;
  1139. X                  struct file32 off_descr;
  1140. X                  struct file32 off_fnames;
  1141. X                  struct file32 off_pointers;
  1142. X                  struct file32 off_huffman;
  1143. X                 };
  1144. X
  1145. Xstruct ic_descr {struct file16 len;
  1146. X                 uBYTE  color;
  1147. X                 uBYTE  fill;  /* Don't know */
  1148. X                 struct file16 width;
  1149. X                 struct file16 height;
  1150. X                 struct file16 offset;
  1151. X                 struct file32 length;
  1152. X                 struct file32 off_pointers;
  1153. X                 struct file32 off_huffman;
  1154. X                };
  1155. X
  1156. X
  1157. Xstruct ic_fname  {char fname[12];
  1158. X                  struct file32 size;
  1159. X                 };
  1160. X
  1161. Xstruct ic_entry {struct file16 fno;
  1162. X                 struct file32 offset;
  1163. X                };
  1164. X
  1165. X
  1166. X
  1167. Xenum   TURNS  { T_UNSPEC,T_NONE,T_RIGHT,T_LEFT,T_HEAD,T_AUTO };
  1168. Xenum   SIZES  { S_UNSPEC,S_Base16,S_Base4,S_Base,S_4Base,S_16Base,S_64Base,S_Over,S_Contact };
  1169. Xenum   OUTFOR { O_UNSPEC,O_PPM,O_PGM,O_YCC,O_PS,O_EPS,O_PSG,O_EPSG,O_PSD,O_EPSD };
  1170. Xenum   CORR   { C_UNSPEC,C_LINEAR,C_DARK,C_BRIGHT };
  1171. X
  1172. Xenum   ERRORS { E_NONE,E_READ,E_WRITE,E_INTERN,E_ARG,E_OPT,E_MEM,E_HUFF,
  1173. X                E_SEQ,E_SEQ1,E_SEQ2,E_SEQ3,E_SEQ4,E_SEQ5,E_SEQ6,E_SEQ7,E_POS,E_IMP,E_OVSKIP,
  1174. X                E_TAUTO,E_TCANT,E_SUBR,E_PRPAR,E_CONFIG,E_FOPEN };
  1175. X
  1176. X
  1177. X
  1178. X
  1179. X
  1180. X/**** Macros ****/
  1181. X
  1182. X
  1183. X
  1184. X#ifdef DEBUG
  1185. X#define RPRINT  {fprintf(stderr,"R-Position %x\n",bufpos);}
  1186. X#else
  1187. X#define RPRINT
  1188. X#endif
  1189. X
  1190. X#define melde(x) {if (do_melde) fprintf(stderr,x);}
  1191. X
  1192. X
  1193. X#define READBUF   READ(sbuffer,sizeof(sbuffer))
  1194. X#define EREADBUF {if(READBUF < 1) error(E_READ);}
  1195. X
  1196. X#define SKIP(p)  { if (SKIPn(p)) error(E_READ);}
  1197. X#define SKIPr(p) { if (SKIPn(p)) return(E_READ);}
  1198. X
  1199. X
  1200. X#define TRIF(x,u,o,a,b,c) ((x)<(u)? (a) : ( (x)>(o)?(c):(b)  ))
  1201. X#define xNORM(x) x=TRIF(x,0,255,0,x,255)
  1202. X#define NORM(x) { if(x<0) x=0; else if (x>255) x=255;}
  1203. X
  1204. X#ifndef MIN
  1205. X#define MIN(a,b) (((a) < (b)) ? (a) : (b))
  1206. X#endif
  1207. X
  1208. X
  1209. X
  1210. X
  1211. X
  1212. X
  1213. X
  1214. X
  1215. X/* main.c */
  1216. Xextern void         close_all(void);
  1217. X
  1218. Xextern char         *ppmname,*pcdname;
  1219. Xextern sINT         do_diff,do_info,do_sharp,do_overskip,monochrome;
  1220. Xextern sINT         do_melde,do_rep,do_crop;
  1221. Xextern sINT         flvert,flhori;
  1222. Xextern uBYTE        sbuffer[SECSIZE];
  1223. Xextern enum TURNS   turn;
  1224. Xextern enum SIZES   size;
  1225. Xextern enum OUTFOR  outfor;
  1226. Xextern enum CORR    corrmode;
  1227. X
  1228. Xextern void         SEEK(int);
  1229. Xextern int          SKIPn(int);
  1230. Xextern int          READ(uBYTE *,int);
  1231. Xextern sINT         bufpos;
  1232. X
  1233. X
  1234. X
  1235. X
  1236. X/* error.c */
  1237. Xextern void         eerror(enum ERRORS,char *, int);
  1238. X
  1239. X
  1240. X/* color.c */
  1241. Xextern void         colconvert(sizeinfo *,implane *,implane *,implane *);
  1242. X
  1243. X/* tools.c */
  1244. Xextern void         clearimpl(implane *,sINT);
  1245. Xextern void         halve(implane *);
  1246. Xextern void         interpolate(implane *);
  1247. Xextern sINT         Skip4Base(void);
  1248. Xextern void         planealloc(implane *,dim,dim);
  1249. Xextern void         pastein(implane *,dim,dim,dim,dim,implane *, enum TURNS);
  1250. Xextern void         cropit(sizeinfo *,implane *,implane *,implane *);
  1251. Xextern void         shrink(sizeinfo *,implane *,implane *,implane *);
  1252. Xextern void         typecheck(void);
  1253. X
  1254. X
  1255. X/* format.c */
  1256. Xextern void         readhqt(sINT);
  1257. Xextern void         readhqtx(sINT);
  1258. Xextern void         decode(sizeinfo *,int,implane *,implane *,implane *,sINT);
  1259. Xextern void         decodex(FILE **,int tag,struct ic_descr *,sizeinfo *,int,implane *,sINT);
  1260. Xextern enum ERRORS  readplain(sizeinfo *,int,implane *,implane *,implane *);
  1261. X
  1262. X
  1263. X
  1264. X
  1265. X
  1266. X/* Type definitions for output format drives, used in output.c and the drivers */
  1267. X
  1268. Xtypedef void (OUT1PL)(FILE *,dim,dim, uBYTE *,sdim,sdim);
  1269. Xtypedef void (OUT3PL)(FILE *,dim,dim, uBYTE *,sdim,sdim, uBYTE *,sdim,sdim, uBYTE *,sdim,sdim); 
  1270. X
  1271. X/* output.c */
  1272. Xextern void         writepicture(FILE *,sizeinfo *,implane *,implane *,implane *,enum TURNS);
  1273. Xextern void         druckeid(void);
  1274. X
  1275. X
  1276. X/* ppm.c */
  1277. Xextern OUT3PL       write_ppm;
  1278. Xextern OUT1PL       write_pgm;
  1279. X
  1280. X/* postscr.c */
  1281. Xextern OUT3PL       write_epsrgb,write_psrgb;
  1282. Xextern OUT1PL       write_epsgrey,write_psgrey,write_epsdith,write_psdith;
  1283. X
  1284. Xextern FLTPT        PAPER_LEFT,PAPER_BOTTOM,PAPER_WIDTH,PAPER_HEIGHT,PRINTER_XDPI,PRINTER_YDPI,PRINTER_FAK;
  1285. Xextern sINT         PSIZE_SET,DPI_SET,FAK_SET;
  1286. X
  1287. X
  1288. X
  1289. X
  1290. X
  1291. X
  1292. END_OF_FILE
  1293.   if test 5965 -ne `wc -c <'hpcdtoppm.0.6/hpcdtoppm.h'`; then
  1294.     echo shar: \"'hpcdtoppm.0.6/hpcdtoppm.h'\" unpacked with wrong size!
  1295.   fi
  1296.   # end of 'hpcdtoppm.0.6/hpcdtoppm.h'
  1297. fi
  1298. if test -f 'hpcdtoppm.0.6/hpcdtoppm.man' -a "${1}" != "-c" ; then 
  1299.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/hpcdtoppm.man'\"
  1300. else
  1301.   echo shar: Extracting \"'hpcdtoppm.0.6/hpcdtoppm.man'\" \(8628 characters\)
  1302.   sed "s/^X//" >'hpcdtoppm.0.6/hpcdtoppm.man' <<'END_OF_FILE'
  1303. X.ds Ps P\s-2OST\s+2S\s-2CRIPT\s+2
  1304. X.TH hpcdtoppm 1L "3 March 1994"
  1305. X.IX hpcdtoppm
  1306. X.SH NAME
  1307. Xhpcdtoppm \- convert a Photo-CD file into a portable bitmap file
  1308. X.SH SYNOPSIS
  1309. X.B hpcdtoppm
  1310. X.I infile
  1311. X.RB [ \-a ]
  1312. X.RB [{ \-C | \-0 | \-Overview | \-O }]
  1313. X.IR "file opt" ]
  1314. X.RB [ \-c0 ]
  1315. X.RB [ \-c- ]
  1316. X.RB [ \-c+ ]
  1317. X.RB [ \-crop ]
  1318. X.RB [ \-d ]
  1319. X.RB [ \-dpi
  1320. X.IR f ]
  1321. X.RB [ \-eps ]
  1322. X.RB [ \-epsd ]
  1323. X.RB [ \-epsg ]
  1324. X.RB [ \-fak
  1325. X.IR scale ]
  1326. X.RB [ \-hori ]
  1327. X.RB [ \-i ]
  1328. X.RB [ \-l ]
  1329. X.RB [ \-m ]
  1330. X.RB [ \-n ]
  1331. X.RB [ \-pb
  1332. X.IR pos ]
  1333. X.RB [ \-pgm ]
  1334. X.RB [ \-ph
  1335. X.IR height ]
  1336. X.RB [ \-pl
  1337. X.IR pos ]
  1338. X.RB [ \-pos ]
  1339. X.RB [ \-ppm ]
  1340. X.RB [ \-ps ]
  1341. X.RB [ \-psd ]
  1342. X.RB [ \-psg ]
  1343. X.RB [ \-pw
  1344. X.IR width ]
  1345. X.RB [ \-r ]
  1346. X.RB [ \-rep ]
  1347. X.RB [ \-S
  1348. X.IR "long short" ]
  1349. X.RB [ \-s ]
  1350. X.RB [ \-vert ]
  1351. X.RB [ -x ]
  1352. X.RB [ \-ycc ]
  1353. X.RB [ \-1 | \-Base/16
  1354. X.RI | \-128x192 ]
  1355. X.RB [ \-2 | \-Base/4
  1356. X.RI | \-256x384 ]
  1357. X.RB [ \-3 | \-Base
  1358. X.RI | \-512x768 ]
  1359. X.RB [ \-4 | \-4Base
  1360. X.RI | \-1024x1536 ]
  1361. X.RB [ \-5 | \-16Base
  1362. X.RI | \-2048x3072 ]
  1363. X.RB [ \-6 | \-64Base
  1364. X.RI | \-4096x6144 ]
  1365. X.RI [ outfile ]
  1366. X.SH DESCRIPTION
  1367. XThis program accepts Photo-CD image or overview file data from the specified
  1368. Xinput file,
  1369. X.I infile
  1370. X(or, if the resolution is lower than 64Base and the file argument is specified as
  1371. X.BR \- ,
  1372. Xfrom standard input),
  1373. Xand writes either Portable Bitmap Format or \*(Ps to the specified output file
  1374. X(or to standard output if no file is specified).
  1375. X.LP
  1376. XOn a standard Photo-CD,
  1377. Ximage files appear in
  1378. X.IR photo_cd/images ,
  1379. Xwhere they appear in files with names of the form
  1380. X.RI img nnnn.pcd ,
  1381. Xwhere
  1382. X.I nnnn
  1383. Xis a 4-digit-number.
  1384. XThe overview file appears in
  1385. X.IR photo_cd/overview.pcd .
  1386. X.LP
  1387. XPhoto-CD images are stored using as many as 6 different resolutions:
  1388. X.ta 1i 3i
  1389. X.nf
  1390. X    Format    Resolution
  1391. X    ------    ----------
  1392. X    64Base    4096x6144 (ProPhotoCD only)
  1393. X    16Base    2048x3072
  1394. X    4Base    1024x1536
  1395. X    Base    512x768
  1396. X    Base/4    256x384
  1397. X    Base/16    128x192
  1398. X.fi
  1399. X.LP
  1400. XThe overview file employs Base/16 format.
  1401. X.IX GIF
  1402. X.SH OPTIONS
  1403. XInvoking
  1404. X.I hpcdtoppm
  1405. Xwithout arguments produces a list of default values.
  1406. XNote that you can supply only one size option.
  1407. X.TP
  1408. X.B \-a
  1409. XAutomatically determine image orientation
  1410. X(this option is experimental,
  1411. Xand does not work for overview files).
  1412. X.TP
  1413. X{\fB\-C\fP | \fB\-0\fP | \fB\-Overview\fP | \fB\-O\fP } \fIfile opt\fP
  1414. XExtract all images from an overview file.
  1415. XThe mandatory
  1416. X.I file
  1417. Xargument is the name of a
  1418. X.I ppm
  1419. Xfile;
  1420. Xoutput files are named
  1421. X.IR filennnn ,
  1422. Xwhere
  1423. X.I nnnn
  1424. Xis a 4-digit number.
  1425. XOverview images are extracted in their original Base/16 format.
  1426. XThe value of
  1427. X.I opt
  1428. Xdetermines the orientation of the contact sheet image;
  1429. Xrecognized values are:
  1430. X.RS
  1431. X.TP
  1432. X.B n
  1433. XDo not rotate the image.
  1434. X.TP
  1435. X.B l
  1436. XRotate the picture counter-clockwise (portrait mode).
  1437. X.TP
  1438. X.B r
  1439. XRotate the picture clockwise (portrait mode).
  1440. X.RE
  1441. X.TP
  1442. X.B \-c0
  1443. XDo not correct (brighten or darken) the image.
  1444. X.TP
  1445. X.B \-c-
  1446. XDarken the image.
  1447. X.TP
  1448. X.B \-c+
  1449. XBrighten the image.
  1450. X.TP
  1451. X.B \-crop
  1452. XCut off the black frame which sometimes appears
  1453. Xat the image borders.
  1454. X.TP
  1455. X.B \-d
  1456. XShow only the decompressed difference rather than the complete image
  1457. X(applicable only to 4Base and 16Base images).
  1458. X.TP
  1459. X.B \-dpi res
  1460. XSet the printer resolution to
  1461. X.I res
  1462. Xfor dithered \*(Ps images. 
  1463. X.TP
  1464. X.B \-eps
  1465. XWrite a RGB Encapsulated \*(Ps color image.
  1466. X.TP
  1467. X.B \-epsd
  1468. XWrite a Floyd-Steinberg dithered image in Encapsulated \*(Ps.
  1469. X.TP
  1470. X.B \-epsg
  1471. XWrite a grayscale image in Encapsulated \*(Ps.
  1472. X.TP
  1473. X.B \-fak scale
  1474. XSet the scaling factor for dithered \*(Ps images to
  1475. X.IR scale . 
  1476. X.TP
  1477. X.B \-hori
  1478. XFlip the image horizontally.
  1479. X.TP
  1480. X.B \-i
  1481. XSend information from an image file header to standard error.
  1482. X.TP
  1483. X.B \-l
  1484. XRotate the picture counter-clockwise (portrait mode).
  1485. X.TP
  1486. X.B \-m
  1487. XWrite messages about the phases of decoding to standard error.
  1488. X.TP
  1489. X.B \-n
  1490. XDo not rotate the image.
  1491. X.TP
  1492. X.B \-pb pos
  1493. XSet the bottom position of the \*(Ps image to
  1494. X.IR pos .
  1495. X.TP
  1496. X.B \-pgm
  1497. XWrite a
  1498. X.I pgm
  1499. X(grayscale) image.
  1500. X.TP
  1501. X.B \-ph height
  1502. XSet the height of the \*(Ps image to
  1503. X.IR height .
  1504. X.TP
  1505. X.B \-pl pos
  1506. XSet the leftmost position of the \*(Ps image to
  1507. X.IR pos .
  1508. X.TP
  1509. X.B \-pos
  1510. XPrint the relative starting position of the data for the current resolution.
  1511. X.TP
  1512. X.B \-ppm
  1513. XWrite a
  1514. X.I ppm
  1515. XRGB (color) image.
  1516. X.TP
  1517. X.B \-ps
  1518. XWrite a RGB \*(Ps color image.
  1519. X.TP
  1520. X.B \-psd
  1521. XWrite a Floyd-Steinberg dithered image in \*(Ps.
  1522. X.TP
  1523. X.B \-psg
  1524. XWrite a \*(Ps grayscale image.
  1525. X.TP
  1526. X.B \-pw width
  1527. XSet the width of the \*(Ps image to
  1528. X.IR width .
  1529. X.TP
  1530. X.B \-r
  1531. XRotate the picture clockwise (portrait mode).
  1532. X.TP
  1533. X.B \-rep
  1534. XTry to jump over reading errors in the Huffman code. 
  1535. X.TP
  1536. X.B \-S "long short"
  1537. XCut out a subrectangle with boundaries defined by the values:
  1538. X.RS
  1539. X.TP
  1540. X.I long
  1541. XFor the longer side of the image.
  1542. X.TP
  1543. X.I short
  1544. XFor the shorter side of the image.
  1545. X.RE
  1546. X.IP
  1547. Xwhere
  1548. X.I long
  1549. Xand
  1550. X.I short
  1551. Xtake one of two forms:
  1552. X.RS
  1553. X.TP
  1554. X.B a\-b
  1555. XCut from position
  1556. X.I a
  1557. Xto position
  1558. X.IR b .
  1559. X.TP
  1560. X.B a+b
  1561. XStarting at offset
  1562. X.IR a ,
  1563. Xcut a length of
  1564. X.IR b .
  1565. X.RE
  1566. X.IP
  1567. Xand where
  1568. X.I a
  1569. Xand
  1570. X.I b
  1571. Xare either integers representing pixel locations,
  1572. Xor floating point values over the range [0.0 ... 1.0],
  1573. Xrepresenting the fraction of the length of a side.
  1574. X.TP
  1575. X.B \-s
  1576. XApply a simple sharpness operator to the luminosity channel.
  1577. X.TP
  1578. X.B \-vert
  1579. XFlip the image vertically.
  1580. X.TP
  1581. X.B -x
  1582. XOverskip Mode (applicable to Base/16, Base/4, Base and 4Base).
  1583. XIn Photo-CD images the luminosity channel is stored in full resolution,
  1584. Xthe two chromaticity channels are stored in half resolution only and have
  1585. Xto be interpolated.
  1586. XIn Overskip Mode,
  1587. Xthe chromaticity channels of the next higher resolution are
  1588. Xtaken instead of interpolating.
  1589. XTo see the difference,
  1590. Xgenerate one
  1591. X.I ppm
  1592. Xwith and one
  1593. X.I ppm
  1594. Xwithout this flag.
  1595. XUse
  1596. X.IR pnmarith (1L)
  1597. Xto generate the difference image of these two images.
  1598. XCall
  1599. X.IR ppmhist (1L)
  1600. Xfor this difference or show it with
  1601. X.IR xv (1L)
  1602. X(push the
  1603. X.B HistEq
  1604. Xbutton in the color editor).
  1605. X.TP
  1606. X.B \-ycc
  1607. XWrite the image in
  1608. X.I ppm 
  1609. XYCC format.
  1610. X.TP
  1611. X.BR \-1 | \-Base/16 | \-128x192
  1612. XExtract the Base/16 image.
  1613. X.TP
  1614. X.B \-2 | \-Base/4 | \-256x384
  1615. XExtract the Base/4 image.
  1616. X.TP
  1617. X.B \-3 | \-Base | \-512x768
  1618. XExtract the Base image.
  1619. X.TP
  1620. X.B \-4 | \-4Base | \-1024x1536
  1621. XExtract the 4Base image.
  1622. X.TP
  1623. X.B \-5 | \-16Base | \-2048x3072
  1624. XExtract the 16Base image.
  1625. X.TP
  1626. X.B \-6 | \-64Base | \-4096x6144
  1627. XExtract the 64Base image. This resolution can be extracted from
  1628. XProPhotoCD images only. The path of the 64Base extension files is
  1629. Xderived from the path to the image file. This means that it doesn't work
  1630. Xon stdin an the directory structure must be the very same as on the
  1631. XProPhotoCD.
  1632. X.SH "POSTSCRIPT OUTPUT"
  1633. XFor \*(Ps output (options
  1634. X.BR \-ps ,
  1635. X.BR \-eps ,
  1636. X.BR \-psg ,
  1637. X.BR \-epsg ,
  1638. X.BR \-psd ,
  1639. X.BR \-epsg )
  1640. Xyou can define both the resolution and placement of the image.
  1641. XBoth size and position are specified in points (1/72 inch).
  1642. X.LP
  1643. XThe position of the image
  1644. X(where the origin is assumed to be at the lower left corner of the page)
  1645. Xis controlled by the
  1646. X.B \-pl
  1647. Xand
  1648. X.B \-pb
  1649. Xoptions (applicable at all resolutions).
  1650. X.LP
  1651. XThe size of color and grayscale images is changed with the
  1652. X.B \-pw
  1653. Xand
  1654. X.B \-ph
  1655. Xoptions.
  1656. XEvery image pixel is mapped onto one \*(Ps pixel.
  1657. X.LP
  1658. XThere are three modes of control for dithered \*(Ps:
  1659. X.TP
  1660. XImage size
  1661. X.RB ( \-pw
  1662. Xand
  1663. X.BR -ph )
  1664. X.TP
  1665. XPrinter resolution
  1666. X.RB ( \-dpi )
  1667. X.TP
  1668. XScaling factor
  1669. X.RB ( \-fak )
  1670. X.LP
  1671. XThese three factors are interdependent,
  1672. Xhence no more then two can be specified simultaneously.
  1673. XUsing
  1674. X.B \-dpi
  1675. Xand the
  1676. X.BR \-pw / \-ph
  1677. Xoptions together often yields pleasing results.
  1678. XEven using the default values for these options will
  1679. Xproduce results differing from those obtained without use of the options.
  1680. X.SH BUGS
  1681. XThe program ignores read protection.
  1682. X.LP
  1683. XThe
  1684. X.B \-i
  1685. Xoption is not working correctly.
  1686. X.LP
  1687. XAvailable information obout the Photo-CD format is vague;
  1688. Xthis program was developed by trial-and-error after staring at hex-dumps.
  1689. XPlease send bugs reports and patches to the author.
  1690. X.SH "SEE ALSO"
  1691. Xpnmarith(1L),
  1692. Xppm(5L),
  1693. Xppmhist(1L),
  1694. Xppmquant(1L),
  1695. Xppmtopgm(1L),
  1696. Xppmtorgb3(1L),
  1697. Xxv(1L)
  1698. X.SH VERSION
  1699. XThe name
  1700. X.I hpcdtoppm
  1701. Xstands for "Hadmut's pcdtoppm,"
  1702. Xto make it distinguishable in the event that someone else is building
  1703. Xa similar application and naming it
  1704. X.IR pcdtoppm .
  1705. XThis is version 0.6.
  1706. X.SH AUTHOR
  1707. XCopyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
  1708. XThis software is not public domain.
  1709. XPermission to use and distribute this software and its
  1710. Xdocumentation for noncommercial use and without fee is hereby granted,
  1711. Xprovided that the above copyright notice appear in all copies and that
  1712. Xboth that copyright notice and this permission notice appear in
  1713. Xsupporting documentation.
  1714. XThis software may not be sold or used for profit-making activities.
  1715. X.LP
  1716. XManual page extensively modified by R. P. C. Rodgers (rodgers@nlm.nih.gov).
  1717. X.\" end of document
  1718. X
  1719. END_OF_FILE
  1720.   if test 8628 -ne `wc -c <'hpcdtoppm.0.6/hpcdtoppm.man'`; then
  1721.     echo shar: \"'hpcdtoppm.0.6/hpcdtoppm.man'\" unpacked with wrong size!
  1722.   fi
  1723.   # end of 'hpcdtoppm.0.6/hpcdtoppm.man'
  1724. fi
  1725. if test -f 'hpcdtoppm.0.6/pcdindex' -a "${1}" != "-c" ; then 
  1726.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/pcdindex'\"
  1727. else
  1728.   echo shar: Extracting \"'hpcdtoppm.0.6/pcdindex'\" \(4832 characters\)
  1729.   sed "s/^X//" >'hpcdtoppm.0.6/pcdindex' <<'END_OF_FILE'
  1730. X#!/bin/csh -f
  1731. X#
  1732. X# pcdindex - generate a single PPM file from a PCD overview file
  1733. X#
  1734. X# This script assumes that the PBMPLUS and hpcdtoppm software
  1735. X# packages are installed, and that /tmp has enough space
  1736. X# (worst case 150Kbyte per image).
  1737. X# Based on pnmindex (PBMPLUS), which was written by Jef Poskanzer,
  1738. X# this script makes also use of hpcdtoppm, written by Hadmut Danisch.
  1739. X#
  1740. X# A similar result can be achieved by using "hpcdtoppm -Overview"
  1741. X# followed by "pnmindex -black" on the generated PPM images.
  1742. X# This shell just makes it more convenient and transparent to
  1743. X# convert from one PCD to one PPM overview file.
  1744. X#
  1745. X# Additional options (compared to pnmindex) are -maxwidth and
  1746. X# -font <font>. See "man pbmtext" on how to create your own font.
  1747. X#
  1748. X# Pieter S. van der Meulen, 1992.
  1749. X
  1750. X# You may want to change the default values in the next 6 lines:
  1751. Xset maxwidth=1152    # maximum width of the index image
  1752. Xset size=192        # make the images about this big
  1753. Xset across=6        # show this many images per row
  1754. Xset colors="noquant"    # maximum amount of colors or noquant (no quantization)
  1755. Xset back="-black"    # default background color
  1756. Xset font=" "        # default font or none (pbmtext's internal font)
  1757. X
  1758. X# Parse the options
  1759. Xwhile ( 1 )
  1760. X    switch ( "$1" )
  1761. X
  1762. X    case -m*:
  1763. X    if ( $#argv < 2 ) goto usage
  1764. X    set maxwidth="$2"
  1765. X    shift
  1766. X    shift
  1767. X    breaksw
  1768. X
  1769. X    case -s*:
  1770. X    if ( $#argv < 2 ) goto usage
  1771. X    set size="$2"
  1772. X    shift
  1773. X    shift
  1774. X    breaksw
  1775. X
  1776. X    case -a*:
  1777. X    if ( $#argv < 2 ) goto usage
  1778. X    set across="$2"
  1779. X    shift
  1780. X    shift
  1781. X    breaksw
  1782. X
  1783. X    case -c*:
  1784. X    set colors="$2"
  1785. X    shift
  1786. X    shift
  1787. X    breaksw
  1788. X
  1789. X    case -f*:
  1790. X    set font="-font $2"
  1791. X    shift
  1792. X    shift
  1793. X    breaksw
  1794. X
  1795. X    case -b*:
  1796. X    set back="-black"
  1797. X    shift
  1798. X    breaksw
  1799. X
  1800. X    case -w*:
  1801. X    set back="-white"
  1802. X    shift
  1803. X    breaksw
  1804. X
  1805. X    case -*:
  1806. X    echo "$0 : Unknown option $1"
  1807. X    echo " "
  1808. X    goto usage
  1809. X    breaksw
  1810. X
  1811. X    default:
  1812. X    break
  1813. X    breaksw
  1814. X
  1815. X    endsw
  1816. Xend
  1817. X
  1818. Xif ( $#argv == 0 ) then
  1819. X    goto usage
  1820. Xendif
  1821. X
  1822. Xset tmpfile=/tmp/pi.tmp.$$
  1823. Xrm -f $tmpfile
  1824. Xtouch /tmp/img0001 # Avoid complaints about non matching
  1825. Xrm -f /tmp/img*
  1826. X
  1827. Xset rowfiles=()
  1828. Xset imagefiles=()
  1829. X@ row = 1
  1830. X@ col = 1
  1831. X@ width = $size
  1832. X
  1833. X# Convert the PCD overview file to many PPM images
  1834. Xif (-f $1) then
  1835. X    hpcdtoppm -Overview $1 /tmp/img
  1836. Xelse
  1837. X    echo "$0 : Could not access $1"
  1838. X    echo " "
  1839. X    goto usage
  1840. Xendif
  1841. X
  1842. Xforeach i ( /tmp/img* )
  1843. X
  1844. Xif (-f $i) then
  1845. X    set description=`pnmfile $i`
  1846. X    if ( $description[4] <= $size && $description[6] <= $size ) then
  1847. X    cat $i > $tmpfile
  1848. X    else
  1849. X        if ( $colors =~ n* ) then
  1850. X        pnmscale -quiet -xysize $size $size $i > $tmpfile
  1851. X        else
  1852. X        pnmscale -quiet -xysize $size $size $i | ppmquant -quiet $colors > $tmpfile
  1853. X        endif
  1854. X    endif
  1855. X    set imagefile=/tmp/pi.${row}.${col}.$$
  1856. X    rm -f $imagefile
  1857. X    set ttext=$i:t
  1858. X    if ( "$back" == "-white" ) then
  1859. X    pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2| pnmcat $back -tb $tmpfile - > $imagefile
  1860. X    else
  1861. X    pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2 | pnminvert | pnmcat $back -tb $tmpfile - > $imagefile
  1862. X    endif
  1863. X    rm -f $tmpfile
  1864. X    set description=`pnmfile $imagefile`
  1865. X    @ width += $description[4]
  1866. X    set imagefiles=( $imagefiles $imagefile )
  1867. X
  1868. X    if (( $col >= $across ) || ( $width > $maxwidth)) then
  1869. X    set rowfile=/tmp/pi.${row}.$$
  1870. X    rm -f $rowfile
  1871. X    if ( $colors =~ n* ) then
  1872. X        pnmcat $back -lr -jbottom $imagefiles > $rowfile
  1873. X    else
  1874. X        pnmcat $back -lr -jbottom $imagefiles | ppmquant -quiet $colors > $rowfile
  1875. X    endif
  1876. X    rm -f $imagefiles
  1877. X    set imagefiles=()
  1878. X    set rowfiles=( $rowfiles $rowfile )
  1879. X    @ col = 1
  1880. X    @ row += 1
  1881. X    @ width = $size
  1882. X    else
  1883. X    @ col += 1
  1884. X    endif
  1885. Xendif
  1886. X
  1887. Xend
  1888. X
  1889. Xif ( $#imagefiles > 0 ) then
  1890. X    set rowfile=/tmp/pi.${row}.$$
  1891. X    rm -f $rowfile
  1892. X    if ( $colors =~ n* ) then
  1893. X    pnmcat $back -lr -jbottom $imagefiles > $rowfile
  1894. X    else
  1895. X    pnmcat $back -lr -jbottom $imagefiles | ppmquant -quiet $colors > $rowfile
  1896. X    endif
  1897. X    rm -f $imagefiles
  1898. X    set rowfiles=( $rowfiles $rowfile )
  1899. Xendif
  1900. X
  1901. Xif ( $#rowfiles == 1 ) then
  1902. X    cat $rowfiles
  1903. Xelse
  1904. X    if ( $colors =~ n* ) then
  1905. X    pnmcat $back -tb $rowfiles
  1906. X    else
  1907. X    pnmcat $back -tb $rowfiles | ppmquant -quiet $colors
  1908. X    endif
  1909. Xendif
  1910. Xrm -f $rowfiles
  1911. Xrm -f /tmp/img*
  1912. X
  1913. Xexit 0
  1914. X
  1915. Xusage:
  1916. X    echo "Usage: $0 [-m W] [-s S] [-a A] [-c N|n] [-f F] [-b|-w] <overview.pcd>"
  1917. X    echo " with"
  1918. X    echo "    W = maximum width of the result image    (default: $maxwidth)"
  1919. X    echo "    S = maximum size of each of the images    (default: $size)"
  1920. X    echo "    A = maximum number of images across    (default: $across)"
  1921. X    echo "    N = maximum number of colors or noquant    (default: $colors)"
  1922. X    echo -n "    F = font to be used for annotation      (default: "
  1923. X    if ( "$font" == " " ) then
  1924. X    echo "internal font)"
  1925. X    else
  1926. X    echo "$font)"
  1927. X    endif
  1928. X    echo "    -b/-w = black/white background color    (default: $back)"
  1929. X    echo " "
  1930. X    echo " e.g.: $0 -m 768 -s 96 -f smallfont.pbm overview.pcd > overview.ppm"
  1931. X    echo " or  : $0 /cdrom/photo_cd/overview.pcd | cjpeg > overview.jpg"
  1932. Xexit 1
  1933. X
  1934. X
  1935. END_OF_FILE
  1936.   if test 4832 -ne `wc -c <'hpcdtoppm.0.6/pcdindex'`; then
  1937.     echo shar: \"'hpcdtoppm.0.6/pcdindex'\" unpacked with wrong size!
  1938.   fi
  1939.   chmod +x 'hpcdtoppm.0.6/pcdindex'
  1940.   # end of 'hpcdtoppm.0.6/pcdindex'
  1941. fi
  1942. if test -f 'hpcdtoppm.0.6/tools.c' -a "${1}" != "-c" ; then 
  1943.   echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/tools.c'\"
  1944. else
  1945.   echo shar: Extracting \"'hpcdtoppm.0.6/tools.c'\" \(8937 characters\)
  1946.   sed "s/^X//" >'hpcdtoppm.0.6/tools.c' <<'END_OF_FILE'
  1947. X/* hpcdtoppm (Hadmut's pcdtoppm) v0.6
  1948. X*  Copyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
  1949. X*  Permission to use and distribute this software and its
  1950. X*  documentation for noncommercial use and without fee is hereby granted,
  1951. X*  provided that the above copyright notice appear in all copies and that
  1952. X*  both that copyright notice and this permission notice appear in
  1953. X*  supporting documentation. It is not allowed to sell this software in 
  1954. X*  any way. This software is not public domain.
  1955. X*/
  1956. X
  1957. X#include "hpcdtoppm.h"
  1958. X
  1959. X
  1960. Xvoid clearimpl(implane *l,sINT n)
  1961. X{ dim x,y;
  1962. X  uBYTE *ptr;
  1963. X
  1964. X  ptr=l->im;
  1965. X  for (x=0;x<l->mwidth;x++)
  1966. X    for (y=0; y<l->mheight;y++)
  1967. X      *(ptr++)=n;
  1968. X}
  1969. X
  1970. X
  1971. X
  1972. X
  1973. Xvoid halve(implane *p)
  1974. X {dim w,h,x,y;
  1975. X  uBYTE *optr,*nptr;
  1976. X
  1977. X  melde("halve\n");
  1978. X  if ((!p) || (!p->im)) error(E_INTERN);
  1979. X
  1980. X  w=p->iwidth/=2;      
  1981. X  h=p->iheight/=2;     
  1982. X
  1983. X
  1984. X  for(y=0;y<h;y++)
  1985. X   {
  1986. X    nptr=(p->im) +   y*(p->mwidth);
  1987. X    optr=(p->im) + 2*y*(p->mwidth);
  1988. X
  1989. X    for(x=0;x<w;x++,nptr++,optr+=2)
  1990. X     { *nptr = *optr;
  1991. X     }
  1992. X
  1993. X   }
  1994. X
  1995. X }
  1996. X
  1997. X
  1998. X
  1999. X
  2000. X
  2001. X
  2002. X
  2003. Xvoid interpolate(implane *p)
  2004. X {dim w,h,x,y,yi;
  2005. X  uBYTE *optr,*nptr,*uptr;
  2006. X
  2007. X  melde("interpolate\n");
  2008. X  if ((!p) || (!p->im)) error(E_INTERN);
  2009. X
  2010. X  w=p->iwidth;
  2011. X  h=p->iheight;
  2012. X
  2013. X  if(p->mwidth  < 2*w ) error(E_INTERN);
  2014. X  if(p->mheight < 2*h ) error(E_INTERN);
  2015. X
  2016. X
  2017. X  p->iwidth=2*w;
  2018. X  p->iheight=2*h;
  2019. X
  2020. X
  2021. X  for(y=0;y<h;y++)
  2022. X   {yi=h-1-y;
  2023. X    optr=p->im+  yi*p->mwidth + (w-1);
  2024. X    nptr=p->im+2*yi*p->mwidth + (2*w - 2);
  2025. X
  2026. X    nptr[0]=nptr[1]=optr[0];
  2027. X
  2028. X    for(x=1;x<w;x++)
  2029. X     { optr--; nptr-=2;
  2030. X       nptr[0]=optr[0];
  2031. X       nptr[1]=(((sINT)optr[0])+((sINT)optr[1])+1)>>1;
  2032. X     }
  2033. X    }
  2034. X
  2035. X  for(y=0;y<h-1;y++)
  2036. X   {optr=p->im + 2*y*p->mwidth;
  2037. X    nptr=optr+p->mwidth;
  2038. X    uptr=nptr+p->mwidth;
  2039. X
  2040. X    for(x=0;x<w-1;x++)
  2041. X     {
  2042. X      nptr[0]=(((sINT)optr[0])+((sINT)uptr[0])+1)>>1;
  2043. X      nptr[1]=(((sINT)optr[0])+((sINT)optr[2])+((sINT)uptr[0])+((sINT)uptr[2])+2)>>2;
  2044. X      nptr+=2; optr+=2; uptr+=2;
  2045. X     }
  2046. X    *(nptr++)=(((sINT)*(optr++))+((sINT)*(uptr++))+1)>>1;
  2047. X    *(nptr++)=(((sINT)*(optr++))+((sINT)*(uptr++))+1)>>1;
  2048. X   }
  2049. X
  2050. X
  2051. X  optr=p->im + (2*h-2)*p->mwidth;
  2052. X  nptr=p->im + (2*h-1)*p->mwidth;
  2053. X  for(x=0;x<w;x++)
  2054. X   { *(nptr++) = *(optr++);  *(nptr++) = *(optr++); }
  2055. X
  2056. X }
  2057. X
  2058. X
  2059. X
  2060. X
  2061. Xstatic sINT testbegin(void)
  2062. X {sINT i,j;
  2063. X  for(i=j=0;i<32;i++)
  2064. X    if(sbuffer[i]==0xff) j++;
  2065. X
  2066. X  return (j>30);
  2067. X  
  2068. X }
  2069. X
  2070. X
  2071. XsINT Skip4Base(void)
  2072. X {sINT cd_offset,cd_offhelp;
  2073. X  
  2074. X  cd_offset = L_Head + L_Base16 + L_Base4 + L_Base ;
  2075. X  SEEK(cd_offset+3);          
  2076. X  EREADBUF;    
  2077. X  cd_offhelp=((((sINT)sbuffer[510])<<8)|sbuffer[511]) + 1;
  2078. X
  2079. X  cd_offset+=cd_offhelp;
  2080. X
  2081. X  SEEK(cd_offset);
  2082. X  EREADBUF;
  2083. X  while(!testbegin())
  2084. X   {cd_offset++;
  2085. X    EREADBUF;
  2086. X   }
  2087. X  return cd_offset;
  2088. X }
  2089. X
  2090. X
  2091. X
  2092. X
  2093. X
  2094. Xvoid planealloc(implane *p, dim width, dim height)
  2095. X {melde("planealloc\n");
  2096. X  p->iwidth=p->iheight=0;
  2097. X  p->mwidth=width;
  2098. X  p->mheight=height;
  2099. X
  2100. X  p->mp = ( p->im = ( uBYTE * ) malloc  (width*height*sizeof(uBYTE)) );
  2101. X  if(!(p->im)) error(E_MEM);
  2102. X }
  2103. X
  2104. X
  2105. Xstatic void pastequer(implane *gross,dim px,dim py,implane *klein)
  2106. X {dim x,y;
  2107. X  uBYTE *von,*nach;
  2108. X
  2109. X  if(px+klein->iwidth  > gross->iwidth)  error(E_INTERN);
  2110. X  if(py+klein->iheight > gross->iheight) error(E_INTERN);
  2111. X
  2112. X  for(y=0;y<klein->iheight;y++)
  2113. X   { von=klein->im + y * klein->mwidth;
  2114. X     nach=gross->im + (y+py) * gross->mwidth + px;
  2115. X     for(x=0;x<klein->iwidth;x++)
  2116. X        *(nach++)=*(von++);
  2117. X   }
  2118. X }
  2119. X
  2120. Xstatic void pastehead(implane *gross,dim px,dim py,implane *klein)
  2121. X {dim x,y;
  2122. X  uBYTE *von,*nach;
  2123. X
  2124. X  if(px+klein->iwidth  > gross->iwidth)  error(E_INTERN);
  2125. X  if(py+klein->iheight > gross->iheight) error(E_INTERN);
  2126. X
  2127. X  for(y=0;y<klein->iheight;y++)
  2128. X   { von= klein->im + (klein->iheight-1-y) * klein->mwidth + (klein->iwidth - 1);
  2129. X     nach=gross->im + (y+py) * gross->mwidth + px;
  2130. X     for(x=0;x<klein->iwidth;x++)
  2131. X        *(nach++)=*(von--);
  2132. X   }
  2133. X }
  2134. X
  2135. Xstatic void pastelinks(implane *gross,dim px,dim py,implane *klein)
  2136. X {dim x,y;
  2137. X  uBYTE *von,*nach;
  2138. X
  2139. X  if(px+klein->iheight > gross->iwidth)  error(E_INTERN);
  2140. X  if(py+klein->iwidth  > gross->iheight) error(E_INTERN);
  2141. X
  2142. X  for(y=0;y<klein->iwidth;y++)
  2143. X   { von=klein->im + klein->iwidth - 1 - y;
  2144. X     nach=gross->im + (y+py) * gross->mwidth + px;
  2145. X     for(x=0;x<klein->iheight;x++,von+=klein->mwidth)
  2146. X        *(nach++)=*(von);
  2147. X   }
  2148. X }
  2149. Xstatic void pasterechts(implane *gross,dim px,dim py,implane *klein)
  2150. X {dim x,y;
  2151. X  uBYTE *von,*nach;
  2152. X
  2153. X  if(px+klein->iheight > gross->iwidth)  error(E_INTERN);
  2154. X  if(py+klein->iwidth  > gross->iheight) error(E_INTERN);
  2155. X
  2156. X  for(y=0;y<klein->iwidth;y++)
  2157. X   { von=klein->im + (klein->iheight-1)*klein->mwidth + y;
  2158. X     nach=gross->im + (y+py) * gross->mwidth + px;
  2159. X     for(x=0;x<klein->iheight;x++,von-=klein->mwidth)
  2160. X        *(nach++)=*(von);
  2161. X   }
  2162. X }
  2163. X
  2164. X
  2165. Xvoid pastein(implane *gross,
  2166. X             dim xpos,dim xw,
  2167. X             dim ypos,dim yh,
  2168. X             implane *klein, enum TURNS ori)
  2169. X {
  2170. X  switch (ori)
  2171. X   {
  2172. X    case T_NONE: pastequer(gross,xpos+(xw-klein->iwidth)/2,ypos+(yh-klein->iheight)/2,klein);
  2173. X                 break;
  2174. X    case T_LEFT: pastelinks(gross,xpos+(xw-klein->iheight)/2,ypos+(yh-klein->iwidth)/2,klein);
  2175. X                 break;
  2176. X    case T_RIGHT:pasterechts(gross,xpos+(xw-klein->iheight)/2,ypos+(yh-klein->iwidth)/2,klein);
  2177. X                 break;
  2178. X    case T_HEAD: pastehead(gross,xpos+(xw-klein->iwidth)/2,ypos+(yh-klein->iheight)/2,klein);
  2179. X                 break;
  2180. X    case T_AUTO:
  2181. X    default: error(E_INTERN);
  2182. X   }
  2183. X }
  2184. X
  2185. X
  2186. X
  2187. X
  2188. X#define cro(p,d) {if(p) {p->im+=d*p->mwidth; p->iheight-=d;}}
  2189. X#define cru(p,d) {if(p) {p->iheight-=d;}}
  2190. X#define crl(p,d) {if(p) {p->im+=d; p->iwidth-=d;}}
  2191. X#define crr(p,d) {if(p) {p->iwidth-=d;}}
  2192. X
  2193. Xvoid cropit(sizeinfo *si,implane *l,implane *c1,implane *c2)
  2194. X {dim x,y,s,w,h;
  2195. X  sINT nl,nr,no,nu;
  2196. X
  2197. X  uBYTE *ptr;
  2198. X
  2199. X  melde("crop\n");
  2200. X
  2201. X  if(si->imvlen || si->imhlen) error(E_INTERN);
  2202. X  w=si->rdhlen;
  2203. X  h=si->rdvlen;
  2204. X
  2205. X  if((!l) || (l->iwidth != w) || (l->iheight != h)) error(E_INTERN);
  2206. X  
  2207. X  if(!monochrome)
  2208. X   {if((!c1) || (c1->iwidth != w) || (c1->iheight != h)) error(E_INTERN);
  2209. X    if((!c2) || (c2->iwidth != w) || (c2->iheight != h)) error(E_INTERN);
  2210. X   }
  2211. X
  2212. X
  2213. X  for(y=0,no=0;y<h;y++,no++)
  2214. X   {for(x=0,ptr=(l->im)+y*(l->mwidth); x<w && (*ptr)<MAX_BLACK ;x++,ptr++);
  2215. X    if(x<w) break;
  2216. X   }
  2217. X  cro(l ,no);
  2218. X  cro(c1,no);
  2219. X  cro(c2,no);
  2220. X  h-=no;
  2221. X
  2222. X
  2223. X  for(y=h-1,nu=0;y;y--,nu++)
  2224. X   {for(x=0,ptr=(l->im)+y*(l->mwidth); x<w && (*ptr)<MAX_BLACK ;x++,ptr++);
  2225. X    if(x<w) break;
  2226. X   }
  2227. X  cru(l ,nu);
  2228. X  cru(c1,nu);
  2229. X  cru(c2,nu);
  2230. X  h-=nu;
  2231. X
  2232. X
  2233. X  s=l->mwidth;
  2234. X
  2235. X  for(x=0,nl=0;x<w;x++,nl++)
  2236. X   {for(y=0,ptr=(l->im)+x; y<h && (*ptr)<MAX_BLACK ; y++, ptr+=s);
  2237. X    if(y<h) break;
  2238. X   }
  2239. X  crl(l ,nl);
  2240. X  crl(c1,nl);
  2241. X  crl(c2,nl);
  2242. X  w-=nl;
  2243. X  
  2244. X
  2245. X  for(x=w-1,nr=0;x;x--,nr++)
  2246. X   {for(y=0,ptr=(l->im)+x; y<h && (*ptr)<MAX_BLACK ; y++, ptr+=s);
  2247. X    if(y<h) break;
  2248. X   }
  2249. X  crr(l ,nr);
  2250. X  crr(c1,nr);
  2251. X  crr(c2,nr);
  2252. X  w-=nr;
  2253. X  
  2254. X  if (do_melde) 
  2255. X   {
  2256. X    if (no || nu || nr || nl )
  2257. X      fprintf(stderr,"Cut off %d top, %d bottom, %d left, %d right,  new size is %dx%d\n",
  2258. X              no,nu,nl,nr,w,h);
  2259. X    else
  2260. X      fprintf(stderr,"Nothing cut off\n");
  2261. X   }
  2262. X
  2263. X  si->imvlen=h;
  2264. X  si->imhlen=w;
  2265. X }
  2266. X
  2267. X
  2268. X
  2269. X
  2270. X
  2271. X
  2272. X
  2273. X
  2274. X
  2275. X
  2276. X
  2277. X
  2278. X
  2279. X
  2280. X
  2281. Xvoid shrink(sizeinfo *si,implane *l,implane *c1,implane *c2)
  2282. X {dim w,h;
  2283. X
  2284. X  melde("shrink\n");
  2285. X
  2286. X  w=si->rdhlen;
  2287. X  h=si->rdvlen;
  2288. X
  2289. X  if((!l) || (l->iwidth != w) || (l->iheight != h)) error(E_INTERN);
  2290. X  
  2291. X  if(!monochrome)
  2292. X   {if((!c1) || (c1->iwidth != w) || (c1->iheight != h)) error(E_INTERN);
  2293. X    if((!c2) || (c2->iwidth != w) || (c2->iheight != h)) error(E_INTERN);
  2294. X   }
  2295. X
  2296. X  if((!si->imvlen) && (!si->imhlen))  /* no subrectangle given */
  2297. X   {si->imvlen=si->rdvlen;
  2298. X    si->imhlen=si->rdhlen;
  2299. X    return;
  2300. X   }
  2301. X
  2302. X  if (si->imvlen>h || si->imvlen<1 )       error(E_INTERN);
  2303. X  if (si->imvoff> si->rdvlen - si->imvlen) error(E_INTERN);
  2304. X
  2305. X  if (si->imhlen>w || si->imhlen<1 ) error(E_INTERN);
  2306. X  if (si->imhoff> si->rdhlen - si->imhlen) error(E_INTERN);
  2307. X
  2308. X  cro(l ,si->imvoff);
  2309. X  cro(c1,si->imvoff);
  2310. X  cro(c2,si->imvoff);
  2311. X
  2312. X  cru(l ,si->rdvlen - si->imvoff - si->imvlen);
  2313. X  cru(c1,si->rdvlen - si->imvoff - si->imvlen);
  2314. X  cru(c2,si->rdvlen - si->imvoff - si->imvlen);
  2315. X  
  2316. X  crl(l ,si->imhoff);
  2317. X  crl(c1,si->imhoff);
  2318. X  crl(c2,si->imhoff);
  2319. X
  2320. X  crr(l ,si->rdhlen - si->imhoff - si->imhlen);
  2321. X  crr(c1,si->rdhlen - si->imhoff - si->imhlen);
  2322. X  crr(c2,si->rdhlen - si->imhoff - si->imhlen);
  2323. X  
  2324. X
  2325. X }
  2326. X
  2327. X
  2328. X
  2329. X/* Test Data types for their size an whether they 
  2330. X   are signed / unsigned */
  2331. X
  2332. Xvoid typecheck(void)
  2333. X { sBYTE sbyte;
  2334. X   uBYTE ubyte;
  2335. X   sINT  sint;
  2336. X   uINT  uint;
  2337. X
  2338. X
  2339. X   if(sizeof(sBYTE) != 1) error(E_CONFIG);
  2340. X   sbyte=126; sbyte++; sbyte++;
  2341. X   if(sbyte > 126 ) error(E_CONFIG);
  2342. X
  2343. X   if(sizeof(uBYTE) != 1) error(E_CONFIG);
  2344. X   ubyte=126; ubyte++; ubyte++;
  2345. X   if(ubyte < 126 ) error(E_CONFIG);
  2346. X
  2347. X#ifdef U_TOO_LONG
  2348. X   if(sizeof(sINT) < 4) error(E_CONFIG);
  2349. X   if(sizeof(uINT) < 4) error(E_CONFIG);
  2350. X#else
  2351. X   if(sizeof(sINT) != 4) error(E_CONFIG);
  2352. X   if(sizeof(uINT) != 4) error(E_CONFIG);
  2353. X#endif
  2354. X
  2355. X   sint=1; sint--; sint--;
  2356. X   if(sint>1) error(E_CONFIG);
  2357. X
  2358. X   uint=1; uint--; uint--;
  2359. X   if(uint<1) error(E_CONFIG);
  2360. X
  2361. X }
  2362. X
  2363. END_OF_FILE
  2364.   if test 8937 -ne `wc -c <'hpcdtoppm.0.6/tools.c'`; then
  2365.     echo shar: \"'hpcdtoppm.0.6/tools.c'\" unpacked with wrong size!
  2366.   fi
  2367.   # end of 'hpcdtoppm.0.6/tools.c'
  2368. fi
  2369. echo shar: End of archive 3 \(of 3\).
  2370. cp /dev/null ark3isdone
  2371. MISSING=""
  2372. for I in 1 2 3 ; do
  2373.     if test ! -f ark${I}isdone ; then
  2374.     MISSING="${MISSING} ${I}"
  2375.     fi
  2376. done
  2377. if test "${MISSING}" = "" ; then
  2378.     echo You have unpacked all 3 archives.
  2379.     rm -f ark[1-9]isdone
  2380. else
  2381.     echo You still must unpack the following archives:
  2382.     echo "        " ${MISSING}
  2383. fi
  2384. exit 0
  2385. exit 0 # Just in case...
  2386.