Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 2 - Scrap Manager


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

0ScrapSizelongsize (in bytes) of the scrap
4ScrapHandlelonghandle to scrap
8ScrapCount2 bytesindicates whether the contents of the scrap have changed
10ScrapState2 bytesindicates state and location of scrap
12ScrapNamelongpointer to the filename of the scrap

Result Codes

noErr0No error
dskFulErr-34Disk full
ioErr-36I/O error
noScrapErr-100Scrap does not exist (not initialized)
noTypeErr-102No data of the requested scrap format type in scrap
memFullErr-108Not enough memory in heap zone

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996