/*--------------------------------------
    Foundation General Library

    Marc Wolfgram,  6/ 8/93 22:49:43
*/

#include <foundation.h>
                                /*    1 2 3 4 5 6 7 8 9 0 1 2  */
extern fResDataRec      ~P0;    /*  9 w w l   h   w p          */
extern fResData2Rec     ~P1;    /*  7 w w l   l   w            */
extern fResRefRec       ~P2;    /*  5 w w l   w                */
extern fResNameRec      ~P3;    /*  6 w w l   p                */
extern fResLinkRec      ~P4;    /* 12 w w h   w l   w l   w w  */
extern fLoadFileRec     ~P5;    /* 11 w h   l   l   l   l      */
extern fPrivateDataRec  ~P6;    /* 12 w p   l   w h   w w l    */
extern fResConverterRec ~P7;    /*  5 w w l   w                */
extern fResCopyRec      ~P8;    /* 11 w w l   l   w w w p      */
extern fMarqueeRec      ~P9;    /*  6 w w p   h                */
extern fColorRec        ~P10;   /* 12 w P   w w w w l   w h    */

segment "_FDNGENLIB"

void fAddPrivateData2(pBlockPtr)
{
    FSTACK(26,pBlockPtr)
}

long fAddResource2(word type, long id, handle data, word attr, word fid, char *name)
{
    ~P0.pCount = 4;
    ~P0.resType = type;
    ~P0.resID = id;
    ~P0.resData = data;
    ~P0.special = attr;
    if (fid) {
        ~P0.pCount = 5;
        ~P0.resFileID = fid;
    }
    if (name && name[0]) {
        ~P0.pCount = 6;
        ~P0.resName = name;
    }

    FSTACK(1,&P0)
    return ~P0.resID;
}

/*

void fBuildLinkHand2(pBlockPtr) FSTACK(11,pBlockPtr)
void fColorPalette2(pBlockPtr) FSTACK(39,pBlockPtr)
void fCopyResource2(pBlockPtr) FSTACK(25,pBlockPtr)
void fCountResources2(pBlockPtr) FSTACK(18,pBlockPtr)
void fDetachResource2(pBlockPtr) FSTACK(5,pBlockPtr)
void fDisposeLinkHand2(pBlockPtr) FSTACK(28,pBlockPtr)
void fExtendLinkHand2(pBlockPtr) FSTACK(10,pBlockPtr)
void fFindHostLink2(pBlockPtr) FSTACK(36,pBlockPtr)
void fGetEditorStatus2(pBlockPtr) FSTACK(33,pBlockPtr)
void fGetIndResource2(pBlockPtr) FSTACK(19,pBlockPtr)
void fGetPrivateData2(pBlockPtr) FSTACK(15,pBlockPtr)

*/

word fGetResourceAttr2(word type, long id, word fid)
{
    ~P0.pCount = 4;
    ~P0.resType = type;
    ~P0.resID = id;
    if (fid) {
        ~P0.pCount = 5;
        ~P0.resFileID = fid;
    }

    FSTACK(22,&P0)

    return ~P0.special;
}
/*
void fGetResourceName2(pBlockPtr) FSTACK(8,pBlockPtr)
void fGetResourceSize2(pBlockPtr) FSTACK(20,pBlockPtr)
void fGetStdTypeName2(pBlockPtr) FSTACK(7,pBlockPtr)
void fGetWindowTitle2(pBlockPtr) FSTACK(29,pBlockPtr)
void fLoadFileData2(pBlockPtr) FSTACK(13,pBlockPtr)
*/
handle fLoadResource2(word type, long id, handle data, word *state, word fid, char *name)
{
    ~P0.pCount = 4;
    ~P0.resType = type;
    ~P0.resID = id;
    if (fid) {
        ~P0.pCount = 5;
        ~P0.resFileID = fid;
    }
    if (name) {
        ~P0.pCount = 6;
        ~P0.resName = name;
    }

    FSTACK(3,&P0)

    if (state)
        *state = ~P0.special;

    return ~P0.resData;
}

/*

void fLoadScrap2(pBlockPtr) FSTACK(31,pBlockPtr)
void fMarquee2(pBlockPtr) FSTACK(38,pBlockPtr)
void fQueryLinkHand2(pBlockPtr) FSTACK(12,pBlockPtr)
void fRelPrivateData2(pBlockPtr) FSTACK(27,pBlockPtr)
void fReleaseResource2(pBlockPtr) FSTACK(4,pBlockPtr)
void fRemoveResource2(pBlockPtr) FSTACK(2,pBlockPtr)
void fRequestEdit2(pBlockPtr) FSTACK(14,pBlockPtr)
void fResourceConverter2(pBlockPtr) FSTACK(24,pBlockPtr)
void fSaveScrap2(pBlockPtr) FSTACK(32,pBlockPtr)
void fSelectorMenu2(pBlockPtr) FSTACK(35,pBlockPtr)
void fSelectorRequest2(pBlockPtr) FSTACK(34,pBlockPtr)
void fSetPrivateData2(pBlockPtr) FSTACK(16,pBlockPtr)
void fSetResourceAttr2(pBlockPtr) FSTACK(23,pBlockPtr)
void fSetResourceID2(pBlockPtr) FSTACK(21,pBlockPtr)
void fSetResourceName2(pBlockPtr) FSTACK(9,pBlockPtr)
void fSpecialMagic2(pBlockPtr) FSTACK(30,pBlockPtr)
void fUniqueResourceID2(pBlockPtr) FSTACK(17,pBlockPtr)
void fWriteResource2(pBlockPtr) FSTACK(6,pBlockPtr)
*/
