Summary of the Scrap Manager
Pascal Summary
Constants
gestaltScrapMgrAttr = 'scra';{Gestalt selector for }
{ Scrap Mgr attributes}
gestaltScrapMgrTranslationAware = 0; {check this bit in the }
{ response parameter to see }
{ whether Scrap Mgr supports }
{ Translation Mgr}
Data Types
TYPE
ScrapStuff = {scrap information record}
RECORD
scrapSize: LongInt; {size (in bytes) of scrap}
scrapHandle: Handle; {handle to scrap}
scrapCount: Integer; {indicates whether the contents }
{ of the scrap have changed}
scrapState: Integer; {indicates state and location }
{ of scrap}
scrapName: StringPtr; {filename of the scrap}
END;
PScrapStuff = ^ScrapStuff; {pointer to a scrap information record}
Routines
Getting Information About the Scrap
FUNCTION InfoScrap : PScrapStuff;
Writing Information to the Scrap
FUNCTION ZeroScrap : LongInt;
FUNCTION PutScrap (length: LongInt; theType: ResType; source: Ptr)
: LongInt;
Reading Information From the Scrap
FUNCTION GetScrap (hDest: Handle; theType: ResType;
VAR offset: LongInt): LongInt;
Transferring Data Between the Scrap in Memory and the Scrap on Disk
FUNCTION UnloadScrap : LongInt;
FUNCTION LoadScrap : LongInt;
C Summary
enum {
#define gestaltScrapMgrAttr 'scra' /*Gestalt selector for */
/* Scrap Mgr attributes*/
gestaltScrapMgrTranslationAware = 0 /*check this bit in the */
/* response parameter to see */
/* whether Scrap Mgr supports */
/* Translation Mgr*/
};
Data Types
struct ScrapStuff { /*scrap information record*/
long scrapSize; /*size (in bytes) of scrap*/
Handle scrapHandle;/*handle to scrap*/
short scrapCount; /*indicates whether the contents */
/* of the scrap have changed*/
short scrapState; /*indicates state and location */
/* of scrap*/
StringPtr scrapName; /*filename of the scrap*/
};
typedef struct ScrapStuff ScrapStuff;
typedef ScrapStuff *PScrapStuff;
Routines
Getting Information About the Scrap
pascal PScrapStuff InfoScrap
(void);
Writing Information to the Scrap
pascal long ZeroScrap (void);
pascal long PutScrap (long length, ResType theType, Ptr source);
Reading Information From the Scrap
pascal long GetScrap (Handle hDest, ResType theType, long *offset);
Transferring Data Between the Scrap in Memory and the Scrap on Disk
pascal long UnloadScrap (void);
pascal long LoadScrap (void);
Assembly-Language Summary
Data Structures
Scrap Information Data Structure
| 0 | ScrapSize | long | size (in bytes) of the scrap |
| 4 | ScrapHandle | long | handle to scrap |
| 8 | ScrapCount | 2 bytes | indicates whether the contents of the scrap have changed |
| 10 | ScrapState | 2 bytes | indicates state and location of scrap |
| 12 | ScrapName | long | pointer to the filename of the scrap |
Result Codes
| noErr | 0 | No error |
| dskFulErr | -34 | Disk full |
| ioErr | -36 | I/O error |
| noScrapErr | -100 | Scrap does not exist (not initialized) |
| noTypeErr | -102 | No data of the requested scrap format type in scrap |
| memFullErr | -108 | Not enough memory in heap zone |