home *** CD-ROM | disk | FTP | other *** search
- From: ewhac@well.UUCP (Leo L. Schwab)
- Subject: Biased Comments on the IFF Library in comp.binaries.amiga.
- Date: 20 Nov 88 11:22:15 GMT
- Organization: Catholic High School Girls In Trouble.
- Keywords: IFF, library, my ego
-
- Quote: "Boo! We changed 'Coke' again! Bleah! Bleah!" -- Binkley's Closet
-
-
- [ The exact value of PI is 3.141592654^#&&@%~r{_^?^MNO CARRIER ]
-
- Recently, Bob Page posted an IFF library written by a gentleman in
- Switzerland. Since Stu Ferguson and I have been working dilligently on just
- such a beast (Stu more than I), I grabbed it and took a look at it, trying
- as hard as I could to keep my bruised ego out of the way. Having done this,
- I have some hopefully pertinent comments to make.
-
-
- Overview
- --------
-
- I'm sure his motivation for writing this library was the same as our
- motivation: The currently available tools for manipulating IFF files are
- sadly inadaquete. EA's code sucks dead badgers through steel conduit, and
- Jim Kent's code -- while a vast improvement -- isn't nearly general enough
- to address all the irritating aspects of IFF.
-
- Up 'til now, the way to deal with these little irritating details of
- IFF has been to ignore them. Since everyone has, so far, been ignoring the
- same details (like LIST's and CAT's), we've been getting by pretty well.
- However, I would hazard a guess that 90% of all non-EA based IFF readers
- will toss their cookies if, instead of being handed a FORM.ILBM, they were
- handed a FORM.SHAK with embedded FORM.ILBM's.
-
- Therefore, our goal -- Stu's and mine -- was to create a set of
- routines that would make the manipulation of IFF files simple. We wished to
- make in particular the handling of FORM.ILBM's easier. We also wished to
- comply rigidly with all the rules, both explicit and implicit, of IFF.
-
- This has not been easy. We're currently on our second pass of the
- library, and we might go for a third before a general Alpha release. A
- recent conference with some AmiGuys helped to highlight some areas of
- uncertainty, and also clarify some periphery issues.
-
- As a result of this, we think we have an approach which will make
- dealing with IFF files simpler, and will also more or less automatically
- enforce all the rules of IFF for you, saving you from the headache.
-
- And now that the sales pitch is out of the way...
-
-
- The Swiss IFF Library
- ---------------------
-
- I've given the library documentation a very thoughtful glance.
- Curiously enough, he appears to have implemented a couple of concepts we hit
- upon as well. He also has a couple of neat ideas which we may plagiarize.
- However, I believe the major shortcoming in this library is that it makes
- too many assumptions.
-
- One feature of his code is that, if it encounters a FORM.8SVX, it
- will automatically load it into CHIP RAM for you. This is a decision that,
- by rights, should be made by the client program. If I'm loading a sample
- into RAM for Fourier analysis, and I happen to have 32-bit RAM hanging off
- my 75 MHz 68030, I'll want to load it in there rather than the slower CHIP
- RAM.
-
- His code also appears to be tuned to dealing with FORM.ILBM's.
- Because of this specific tuning, the library may not be well-suited to other
- applications. Of course, this supposition would have to be verified by
- someone actually trying it.
-
- Even with this tuning towards FORM.ILBM's, the code, from what I
- can gather, is making poor assumptions about the layout of a FORM.ILBM;
- namely, that the BMHD always comes first. (I assume this is what the
- library is doing based on the sample C source enclosed with it.) This
- is not the case; the ILBM spec does not specify that the BMHD must come
- first. In fact, it specifically says that BMHD, CMAP, CAMG, CRNG, and
- other ILBM chunks can appear in *any* order. The only thing you're
- guaranteed is that the BODY will come last.
-
- In general, I feel that his code is trying to do too much for the
- client application. It is taking too much control from the programmer and
- hiding it in the library. While this makes the general case easier to
- program for, the special cases become difficult or impossible to code for
- under this scheme.
-
- Also, his iff.h file is highly unusual. It has assembly code in it.
-
-
- Closing
- -------
-
- The code is not useless, however. There is a fair piece of utility
- to be found in his library. The bitmap packer/unpacker is worth a lot (am I
- the only person who hates reading and writing run-length-encoding
- programs?). And, as I said, for 90% of the cases you'll encounter, it's
- perfectly useable for dealing with FORM.ILBM's.
-
- However, I would consider it an academic curiosity, and would not
- recommend using it in anything "real". If you're looking for something that
- observes all the rules and is still relatively easy to use, then please be a
- bit more patient; Stu's and my library will be available Real Soon Now.
-
- Realize, of course, that all the above comments come from a guy
- who's going to have a "competing product" on the market very soon. Grains
- of salt, and all that...
-
- _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
- Leo L. Schwab -- The Guy in The Cape INET: well!ewhac@ucbvax.Berkeley.EDU
- \_ -_ Recumbent Bikes: UUCP: pacbell > !{well,unicom}!ewhac
- O----^o The Only Way To Fly. hplabs / (pronounced "AE-wack")
- "Work FOR? I don't work FOR anybody! I'm just having fun." -- The Doctor
-
- ============================================================================
-
- From: lel@wuphys.UUCP (Lyle E. Levine)
- Subject: Re: IFF.LIBRARY
- Date: 5 Dec 88 03:20:41 GMT
- Organization: Physics Dept., Washington U. in St. Louis
-
-
- In article <62827UH2@PSUVM> UH2@PSUVM.BITNET (Lee Sailer) writes:
- >I will cede to Leo that the recently distributed iff.library is not
- >the ultimate word on iff, but it would do exacly what I need IF I used
- >Manx and not Lattice 4.01. So, I am gonna try to Lattice-ify it.
- >
- > Will the lattice supplied asm handle that simple piece of asm source,
- >or do I have to change some of the mnemonics, or add some magic at the
- >beginning or end, or ???
-
- Sorry I took so long on this one. A two week vacation can do wonders
- for generating a huge backlog of USENET articles! The easiest way
- to Lattice-ify this stuff is to replace the #asm code with some
- Lattice #pragma statements. The correct statements are:
-
- #pragma libcall IFFBase OpenIFF 1e 801
- #pragma libcall IFFBase CloseIFF 24 901
- #pragma libcall IFFBase FindChunk 2a 0902
- #pragma libcall IFFBase GetBMHD 30 901
- #pragma libcall IFFBase GetColorTab 36 8902
- #pragma libcall IFFBase DecodePic 3c 8902
- #pragma libcall IFFBase SaveBitMap 42 0A9804
- #pragma libcall IFFBase SaveClip 48 43210A9808
- #pragma libcall IFFBase IffError 4e 00
- #pragma libcall IFFBase GetViewModes 54 901
-
-
- > thanks
-
- You're very welcome. :^)
-
- P.S. Has anyone gotten FindChunk() to work? If so, how about a
- witto hint?
-
- P.P.S. The IFF loader is FAST!!!
-
-
- ==========
- 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
-
- ============================================================================
-
- From: lel@wuphys.UUCP (Lyle E. Levine)
- Subject: Re: IFF.LIBRARY
- Date: 5 Dec 88 06:01:36 GMT
- Organization: Physics Dept., Washington U. in St. Louis
-
-
- In article <587@wuphys.UUCP> lel@wuphys.UUCP (Lyle E. Levine) writes:
- >
- >P.S. Has anyone gotten FindChunk() to work? If so, how about a
- >witto hint?
-
- Nevermind! I just got it to work. To clear up any future
- confusion, the arguments are FindChunk(ifffile,chunkname).
- chunkname is a packed ASCII (ULONG). Thus, 'CRNG' is
- 0x43524e47. This is because 'C' = 0x43, 'R' = 0x52, etc...
- Hope this helps someone!
-
-
- ==========
- 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
-
- ============================================================================
-
- From: mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer)
- Subject: Re: IFF.LIBRARY
- Date: 6 Dec 88 02:53:42 GMT
- Organization: Missionaria Phonibalonica
-
-
- 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 ***************/
-
- APTR OpenIFF(char *);
- void CloseIFF(APTR);
- struct Chunk *FindChunk(APTR, char *);
- struct BitMapHeader *GetBMHD(APTR);
- LONG GetColorTab(APTR, UWORD *);
- BOOL DecodePic(APTR, struct BitMap *);
- BOOL SaveBitMap(char *, struct BitMap *, UWORD *, long);
- BOOL SaveClip(char *, struct BitMap *, UWORD *, int, int, int, int, int);
- LONG IffError(void);
-
-
- /************** F U N C T I O N P R A G M A S ***************/
-
- #ifndef NOPRAGMA
- #pragma libcall IFFBase OpenIFF 1e 801
- #pragma libcall IFFBase CloseIFF 24 901
- #pragma libcall IFFBase FindChunk 2a 0902
- #pragma libcall IFFBase GetBMHD 30 901
- #pragma libcall IFFBase GetColorTab 36 8902
- #pragma libcall IFFBase DecodePic 3c 8902
- #pragma libcall IFFBase SaveBitMap 42 0A9804
- #pragma libcall IFFBase SaveClip 48 43210A9808
- #pragma libcall IFFBase IffError 4e 00
- #pragma libcall IFFBase GetViewModes 54 901
- #endif
-
-
- Finally, for those who want it, here's the assembler interface for
- Lattice. Just asm it, copy the library into lib: as lib.o, and then
- link it with programs that need the iff.library (assuming you compiled
- with NOPRAGMA defined).
-
-
- ; asm interface to iff.library
- csect text
-
- ; Pointer to the library, supplied by the caller
- xref _IFFBase
-
- xdef _OpenIFF
- _OpenIFF: move.l 4(sp),a0
- move.l _IFFBase,a6
- jmp -30(a6)
-
- xdef _CloseIFF
- _CloseIFF: move.l 4(sp),a1
- move.l _IFFBase,a6
- jmp -36(a6)
-
- xdef _FindChunk
- _FindChunk: move.l 4(sp),a1
- move.l 8(sp),d0
- move.l _IFFBase,a6
- jmp -42(a6)
-
- xdef _GetBMHD
- _GetBMHD: move.l 4(sp),a1
- move.l _IFFBase,a6
- jmp -48(a6)
-
- xdef _GetColorTab
- _GetColorTab: move.l 4(sp),a1
- move.l 8(sp),a0
- move.l _IFFBase,a6
- jmp -54(a6)
-
- xdef _DecodePic
- _DecodePic: move.l 4(sp),a1
- move.l 8(sp),a0
- move.l _IFFBase,a6
- jmp -60(a6)
-
- xdef _SaveBitMap
- _SaveBitMap: move.l a2,-(sp)
- movem.l 8(sp),a0/a1/a2
- move.l 20(sp),d0
- move.l _IFFBase,a6
- jsr -66(a6)
- move.l (sp)+,a2
- rts
-
- xdef _SaveClip
- _SaveClip: movem.l d4/a2,-(sp)
- movem.l 24(sp),d0-d4
- movem.l 12(sp),a0-a2
- move.l _IFFBase,a6
- jsr -72(a6)
- movem.l (sp)+,d4/a2
- rts
-
- xdef _IffError
- _IffError: move.l _IFFBase,a6
- jmp -78(a6)
-
- xdef _GetViewModes
- _GetViewModes: move.l 4(sp),a1
- move.l _IFFBase,a6
- jmp -84(a6)
-
- end
-
-
- <mike
-
- --
- I know the world is flat. Mike Meyer
- Don't try tell me that it's round. mwm@berkeley.edu
- I know the world stands still. ucbvax!mwm
- Don't try to make it turn around. mwm@ucbjade.BITNET
-
- ============================================================================
-
- From: mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer)
- Subject: Re: IFF.LIBRARY
- Date: 6 Dec 88 02:56:35 GMT
- Organization: Missionaria Phonibalonica
-
-
- Whoops - I made a major mistake. The prototype for SaveClipRect should
- be filled out with 'long', not 'int'. That way, if you compile with 16
- bit ints, the compiler will still push longs for you - and not
- complain when you give it longs.
-
- <mike
- --
- ICUROK2C, ICUROK2. Mike Meyer
- ICUROK2C, ICWR2. mwm@berkeley.edu
- URAQT, I WANT U2. ucbvax!mwm
- OO2EZ, I WANT U2. mwm@ucbjade.BITNET
-
- ============================================================================
-
- From: lel@wuphys.UUCP (Lyle E. Levine)
- Subject: Re: IFF.LIBRARY
- Date: 8 Dec 88 07:20:12 GMT
- Organization: Physics Dept., Washington U. in St. Louis
-
-
- 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
-
- ============================================================================
-
- To: uts.amdahl.com!kim
- Subject: Christian Weber?
- Date: Thu, 22 Dec 88 13:46:26 EST
- From: barrett@cs.jhu.edu
-
-
- Hi Kim:
-
- Since you submitted the "IFF library" to the Amiga source archives,
- I am writing to you. I would like to send a bug report to Christian A.
- Weber, the author of the IFF library. He did not include his mailing
- address in his program.
-
- If there is a way to forward e-mail to him, could you forward
- this letter? If not, perhaps you can tell me how to get in touch with
- him. Otherwise... never mind!
-
- Thanks so much.
-
- Dan
-
- ------------------------------ cut here -----------------------------------
-
- Dear Mr. Weber:
-
- I have found a problem in your IFF library, version 15.3. The
- following sequence of commands illustrates the problem.
-
- 1> copy iff.library LIBS:
- 1> grabbit
- 1> ShowIff grabbit.pic
-
- (Picture gets shown just fine.)
-
- (Now hit ^C. ShowIff ends.)
-
- 1> ShowIff grabbit.pic
- Copy the iff.library to your LIBS: directory!
- 1>
-
- In other words, the iff.library gets "lost" if I hit ^C. This might be
- a problem with ShowIFF and not the iff.library, but I wanted you to be
- aware of it.
-
- Thanks for a great product!
-
- Dan
-
- #############################################################################
- # Dan Barrett barrett@cs.jhu.edu (128.220.13.4) ARPA #
- # Dept. of Computer Science, Johns Hopkins University, Baltimore, MD 21218 #
- #############################################################################
-
- ----------------------------- end of letter ------------------------------
-