Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!unmvax!ncar!ames!amdcad!sun!pitstop!sundc!seismo!uunet!wucs1!wuphys!lel
From: lel@wuphys.UUCP (Lyle E. Levine)
Newsgroups: comp.sys.amiga.tech
Subject: Re: IFF.LIBRARY
Message-ID: <602@wuphys.UUCP>
Date: 8 Dec 88 07:20:12 GMT
References: <62827UH2@PSUVM> <587@wuphys.UUCP> <17861@agate.BERKELEY.EDU>
Reply-To: lel@wuphys.UUCP (Lyle E. Levine)
Organization: Physics Dept., Washington U. in St. Louis
Lines: 49

In article <17861@agate.BERKELEY.EDU> mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) writes:
>
>I'd add a "#ifndef" around those pragmas. I also turned the function
>declarations into prototypes:
>
>
>/************** F U N C T I O N   D E C L A R A T I O N S ***************/
>
>struct Chunk *FindChunk(APTR, char *);
                               ^^^^^^
This is what is implied by the docs but it doesn't work this way.
It should be a (APTR, ULONG). The format used is packed ASCII.  
Thus:
 
   cname = 0x43524e47;       /* This is packed ASCII for 'CRNG' */
   CRNGstart = FindChunk(ifffile,cname);

/* 'C' = 0x43, 'R' = 0x52, 'N' = 0x4e, 'G' = 0x47 */

By the way, one gotcha: on the first calling, FindChunk returns a
pointer to the first chunk of the requested type. On subsequent
callings, it still returns a pointer to this SAME FIRST CHUNK!!!
Thus, if the file has > 1 'CRNG' chunk (as a common example),
FindChunk will NOT FIND ANY BUT THE FIRST!!!!!! Since OpenIFF()
reads the file into memory and FindChunk() gives a pointer to the
first chunk of the requested type, you can just change 'CRNG'
into say 'CRNF' in memory and call FindChunk() again to get the
next 'CRNG' chunk.  It's dirty but it works. UGH!!!!  Leo, I am
eagerly awaiting your library.  If it wasn't for the speed of the
loader in this one, I'd go back to my own routines. At least they
get the job done.

>
>
>/************** F U N C T I O N   P R A G M A S ***************/
>

Glad you liked my PRAGMAS :^)

*** PETS ***	Programmers Extraordinaire, Technically Supportive!

==========
IBM is a Division of Sirius Cybernetics Corporation
"their fundamental design flaws are completely hidden by their
superficial design flaws."  
			- "So Long And Thanks For All The Fish"

Lyle Levine: Paths -> ihnp4!wuphys!lel       Best way: (314)889-6379
		      uunet!wucs!wuphys!lel