/* APCNames.h */

#ifdef AMIGA
#include <exec/types.h>
#else
typedef long            LONG;
typedef unsigned long   ULONG;
typedef short           WORD;
typedef unsigned short  UWORD;
typedef char            BYTE;
typedef unsigned char   UBYTE;
#ifndef TRUE
#define TRUE  1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL  0L
#endif
#endif

/*-------------------------------------------------------------------
**  Macintosh uses 4-byte IDs for identifying the file type and the
**  application which created the document.
**  Some frequently used IDs are provided here.
**-------------------------------------------------------------------
*/

#define MAKE_ID(C1,C2,C3,C4) ((C1<<24)|(C2<<16)|(C3<<8)|C4)

#define TYPE_TEXT  MAKE_ID('T','E','X','T')
#define TYPE_PNTG  MAKE_ID('P','N','T','G')

#define CREATOR_UNKNOWN  MAKE_ID('?','?','?','?')

#define CREATOR_TTXT     MAKE_ID('t','t','x','t')  /*TeachText*/
#define CREATOR_MPNT     MAKE_ID('M','P','N','T')  /*MacPaint*/
#define CREATOR_BBEDIT   MAKE_ID('R','*','c','h')  /*BBEdit*/
#define CREATOR_THINK    MAKE_ID('P','J','M','M')  /*THINK Pascal*/


/*-------------------------------------------------------------------
**  Each APCINFO.DAT file consists of several records denoting
**  disk or file entries. Each record has a length of 80 bytes.
**  The first record always denotes a disk entry, all subsequent
**  records are file entries.
**  After each 12 entries there are 64 bytes with undefined contents.
**-------------------------------------------------------------------
*/

#define APC_ENTRY_SIZE  sizeof(union APCEntry)
#define APC_PAD_SIZE    0x40

union APCEntry {

  UBYTE    ae_Data[80];

  struct DiskEntry {
    UBYTE  de_Length;        /*length of disk name*/
    UBYTE  de_Pad[79];       /*disk name and other data*/
  } de;

  struct FileEntry {
    UBYTE  fe_Length;        /*length of file name*/
    char   fe_Name[31];      /*file name characters*/
    ULONG  fe_Type;          /*Macintosh type ID*/
    ULONG  fe_Creator;       /*Macintosh creator ID*/
    UBYTE  fe_Pad1[23];      /*undocumented data*/
    UBYTE  fe_Flags;         /*file visible <=> 0 (?)*/
    char   fe_MSDOSName[8];  /*file name padded with blanks*/
    char   fe_MSDOSExt[3];   /*extension padded with blanks*/
    UBYTE  fe_Pad2[5];       /*always zero*/
  } fe;

};
