/*--------------------------------------
    Bundle.h (or insanity from another point of view)

    The Marx Bros... 10/19/91  0:56:56
*/

/* first define OneDoc Hell */

struct doc_1 {
    word    OneDocSize,
            OffsetToMatchFlags,
            NumResults,
            Priority;
    byte    parsePoint;
};
typedef struct doc_1 doc_1, *doc_1Ptr;

struct doc_2 {
    word    OneDocSize,
            OffsetToMatchFlags,
            NumResults,
            Priority;
    Long    rFinderPathID,
            reserved_2,
    byte    parsePoint;
};
typedef struct doc_2 doc_2, *doc_2Ptr;

struct doc_3 {
    word    OneDocSize,
            OffsetToMatchFlags,
            NumResults,
            Priority;
    Long    rFinderPathID,
            reserved_2,
            rIconID,
            reserved_3.
    byte    parsePoint;
};
typedef struct doc_3 doc_3, *doc_3Ptr;

struct doc_4 {
    word    OneDocSize,
            OffsetToMatchFlags,
            NumResults,
            Priority;
    Long    rFinderPathID,
            reserved_2,
            rIconID,
            reserved_3.
            SmallrIconID,
            reserved_4,
    byte    parsePoint;
};
typedef struct doc_4 doc_4, *doc_4Ptr;

struct doc_5 {
    word    OneDocSize,
            OffsetToMatchFlags,
            NumResults,
            Priority;
    Long    rFinderPathID,
            reserved_2,
            rIconID,
            reserved_3.
            SmallrIconID,
            reserved_4,
    char    DescStr[1];
};
typedef struct doc_4 doc_4, *doc_4Ptr;

/* grouped thusly to handle these deviants */

union OneDoc {
    doc_1 OneDoc1;
    doc_2 OneDoc2;
    doc_3 OneDoc3;
    doc_4 OneDoc4;
    doc_5 OneDoc5;
};
typedef union OneDoc OneDoc, *OneDocPtr;

/* now on to matchtype insanity */

struct match_1 {
    word    MatchTypeID,
            FileType;
    byte    parsePoint;
};
typedef struct match_1 match_1, *match_1Ptr;

struct match_2 {
    word    MatchTypeID;
    Long    AuxTypeMask,
            AuxTypeValue;
    byte    parsePoint;
};
typedef struct match_2 match_2, *match_2Ptr;

struct match_3 {
    word    MatchTypeID;
    char    FileName[1];
};
typedef struct match_3 match_3, *match_3Ptr;

struct match_4 {
    word    MatchTypeID,
    word    compareSpec;
    TimeRec time;
    byte    parsePoint;
};
typedef struct match_4 match_4, *match_4Ptr;

struct match_6 {
    word    MatchTypeID,
            mask,
            value;
    byte    parsePoint;
};
typedef struct match_6 match_6, *match_6Ptr;

struct match_7 {
    word    MatchTypeID;
    Long    mask,
            value;
    byte    parsePoint;
};
typedef struct match_7 match_7, *match_7Ptr;

struct match_8 {
    word    MatchTypeID,
            compareValue;
    byte    parsePoint;
};
typedef struct match_8 match_8, *match_8Ptr;

struct match_9 {
    word    MatchTypeID;
    char    string[4],
            parsePoint;
};
typedef struct match_9 match_9, *match_9Ptr;

struct match_b {
    word    MatchTypeID,
            compareValue;
    byte    parsePoint;
};
typedef struct match_8 match_8, *match_8Ptr;

    word    LocalAccessMask;
    word    LocalAccess;
    word    NetworkAccessMask;
    word    NetworkAccess;
    word    Extended;
    Long    HFSFileType;
    Long    HFSCreator;
    word    OptionListCount;
    Pointer OptionArrayPtr;

};
typedef struct fOneDocRec fOneDocRec, *fOneDocRecPtr, **fOneDocRecHndl;

/* tye all the matchfields into a pretty package */

union  matchfields {
    word    matchTypeID;
    match_1 matchFileType;
    match_2 matchAuxType;
    match_3 matchFileName;
    match_4 matchCreateDateTime;
    match_4 matchModDateTime;
    match_6 matchLocalAccess;
    match_7 matchNetworkAccess;
    match_8 matchExtended;
    match_9 matchHFSFileType;
    match_9 matchHFSCreator;
    match_b matchOptionList;
};
typedef union matchfields matchfields, *matchfieldsPtr;

/* last, the mother of all resources */

struct bundle {
    word    Version,
            OffsetToDocumentList;
    long    rIconID,
            rBundleID,
            reserved;
    word    Count;
    union   OneDoc DocList[1];
};
typedef struct bundle bundle, *bundlePtr, **bundleHndl;
