home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / macutils.lzh / MACUTILS / MACUNPACK / cpt.h < prev    next >
Text File  |  1995-09-18  |  2KB  |  94 lines

  1. #define C_SIGNATURE    0
  2. #define C_VOLUME       1
  3. #define C_XMAGIC       2
  4. #define C_IOFFSET      4
  5. #define CPTHDRSIZE     8
  6.  
  7. #define C_HDRCRC       0
  8. #define C_ENTRIES      4
  9. #define C_COMMENT      6
  10. #define CPTHDR2SIZE    7
  11.  
  12. #define CHDRSIZE       (CPTHDRSIZE+CPTHDR2SIZE)
  13.  
  14. #define F_FNAME          0
  15. #define F_FOLDER        32
  16. #define F_FOLDERSIZE    33
  17. #define F_VOLUME        35
  18. #define F_FILEPOS       36
  19. #define F_FTYPE         40
  20. #define F_CREATOR       44
  21. #define F_CREATIONDATE  48
  22. #define F_MODDATE       52
  23. #define F_FNDRFLAGS     56
  24. #define F_FILECRC       58
  25. #define F_CPTFLAG       62
  26. #define F_RSRCLENGTH    64
  27. #define F_DATALENGTH    68
  28. #define F_COMPRLENGTH   72
  29. #define F_COMPDLENGTH   76
  30. #define FILEHDRSIZE     80
  31.  
  32. typedef long    OSType;
  33.  
  34. typedef struct cptHdr {            /* 8 bytes */
  35.     unsigned char    signature;    /* = 1 -- for verification */
  36.     unsigned char    volume;        /* for multi-file archives */
  37.     unsigned short    xmagic;        /* verification multi-file consistency*/
  38.     unsigned long    offset;        /* index offset */
  39. /* The following are really in header2 at offset */
  40.     unsigned long    hdrcrc;        /* header crc */
  41.     unsigned short    entries;    /* number of index entries */
  42.     unsigned char    commentsize;    /* number of bytes comment that follow*/
  43. };
  44.  
  45. typedef struct fileHdr {        /* 78 bytes */
  46.     unsigned char    fName[32];    /* a STR32 */
  47.     unsigned char    folder;        /* set to 1 if a folder */
  48.     unsigned short    foldersize;    /* number of entries in folder */
  49.     unsigned char    volume;        /* for multi-file archives */
  50.     unsigned long    filepos;    /* position of data in file */
  51.     OSType    fType;            /* file type */
  52.     OSType    fCreator;        /* er... */
  53.     unsigned long    creationDate;
  54.     unsigned long    modDate;    /* !restored-compat w/backup prgms */
  55.     unsigned short FndrFlags;    /* copy of Finder flags.  For our
  56.                         purposes, we can clear:
  57.                         busy,onDesk */
  58.     unsigned long    fileCRC;    /* crc on file */
  59.     unsigned short    cptFlag;    /* cpt flags */
  60.     unsigned long    rsrcLength;    /* decompressed lengths */
  61.     unsigned long    dataLength;
  62.     unsigned long    compRLength;    /* compressed lengths */
  63.     unsigned long    compDLength;
  64. };
  65.  
  66.  
  67. /* file format is:
  68.     cptArchiveHdr
  69.         file1data
  70.             file1RsrcFork
  71.             file1DataFork
  72.         file2data
  73.             file2RsrcFork
  74.             file2DataFork
  75.         .
  76.         .
  77.         .
  78.         fileNdata
  79.             fileNRsrcFork
  80.             fileNDataFork
  81.     cptIndex
  82. */
  83.  
  84.  
  85.  
  86. /* cpt flags */
  87. #define encryp    1    /* file is encrypted */
  88. #define crsrc    2    /* resource fork is compressed */
  89. #define cdata    4    /* data fork is compressed */
  90. /*      ????    8    /* unknown */
  91.  
  92. #define CIRCSIZE    8192
  93.  
  94.