home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 519b.lha / FZIFF / iff.h < prev    next >
C/C++ Source or Header  |  1991-06-09  |  2KB  |  75 lines

  1. #ifndef IFF_H
  2. #define IFF_H
  3. /*----------------------------------------------------------------------*/
  4. /* IFF.H  defs for IFF-85 Interchange Format Files.                1/22/86 */
  5. /*                                                                        */
  6. /* By Jerry Morrison and Steve Shaw, Electronic Arts.                    */
  7. /* This software is in the public domain.                                */
  8. /*----------------------------------------------------------------------*/
  9.  
  10. /* mods by Karl Lehenbauer, 1987, 1988 */
  11.  
  12. #ifndef LIBRARIES_DOS_H
  13. #include "libraries/dos.h"
  14. #endif
  15.  
  16. typedef LONG ID;
  17.  
  18. /* Four-character IDentifier builder.*/
  19. #define MakeID(a,b,c,d)  ( (LONG)(a)<<24L | (LONG)(b)<<16L | (c)<<8 | (d) )
  20.  
  21. /* Standard group IDs.  A chunk with one of these IDs contains a
  22.    SubTypeID followed by zero or more chunks.*/
  23. #define ID_FORM MakeID('F','O','R','M')
  24. #define ID_PROP MakeID('P','R','O','P')
  25. #define ID_LIST MakeID('L','I','S','T')
  26. #define ID_CAT  MakeID('C','A','T',' ')
  27. #define ID_FILLER MakeID(' ',' ',' ',' ')
  28. #define ID_FNAM MakeID('F','N','A','M')
  29. #define ID_MISC MakeID('M','I','S','C')
  30.  
  31. /* The IDs "FOR1".."FOR9", "LIS1".."LIS9", & "CAT1".."CAT9" are reserved
  32.  * for future standardization.*/
  33.  
  34. /* ---------- Chunk ----------------------------------------------------*/
  35.  
  36. /* All chunks start with a type ID and a count of the data bytes that 
  37.    follow--the chunk's "logicl size" or "data size". If that number is odd,
  38.    a 0 pad byte is written, too. */
  39.  
  40. typedef struct {
  41.     ID      ckID;
  42.     LONG  ckSize;
  43.     } ChunkHeader;
  44.  
  45. typedef struct {
  46.     ID      ckID;
  47.     LONG  ckSize;
  48.     UBYTE ckData[ 1 /*REALLY: ckSize*/ ];
  49.     } Chunk;
  50.  
  51. /* define the maximum reasonable chunk size - the real max is around 2^32,
  52.  * but we need some reasonability limit to check for */
  53. #define MAXCHUNKSIZE 900000
  54.  
  55. /* The Grouping chunks (LIST, FORM, PROP, & CAT) contain concatenations of
  56.  * chunks after a subtype ID that identifies the content chunks.
  57.  * "FORM type XXXX", "LIST of FORM type XXXX", "PROPerties associated
  58.  * with FORM type XXXX", or "conCATenation of XXXX".*/
  59. typedef struct {
  60.     ID      ckID;
  61.     LONG  ckSize;    /* this ckSize includes "grpSubID".*/
  62.     ID    grpSubID;
  63.     } GroupHeader;
  64.  
  65. typedef struct {
  66.     ID      ckID;
  67.     LONG  ckSize;
  68.     ID    grpSubID;
  69.     UBYTE grpData[ 1 /*REALLY: ckSize-sizeof(grpSubID)*/ ];
  70.     } GroupChunk;
  71.  
  72.  
  73. #endif IFF_H
  74.  
  75.