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