home *** CD-ROM | disk | FTP | other *** search
Modula Implementation | 1997-01-15 | 1.8 KB | 54 lines | [TEXT/3PRM] |
- implementation module scrap;
-
- import StdArray;
- import mac_types;
-
- NoScrapErr :== -100; // desk scrap isn't initialized
- NoTypeErr :== -102; // no data of the requested type
-
- ScrapSize :== 2400; // $960 (Long) size in bytes of desk scrap
- ScrapHandle :== 2404; // $964 (Long) handle to desk scrap in memory
- ScrapCount :== 2408; // $968 (Word) count changed by ZeroScrap
- ScrapState :== 2410; // $96A (Word) tells where desk scrap is
- ScrapName :== 2412; // $96C (String256) pointer to scrap filename (preceded by length byte)
-
- TextResourceType :== 0x54455854; // 'TEXT'
- PictResourceType :== 0x50494354; // 'PICT'
-
-
- PutScrapText :: !{#Char} !Toolbox -> (!Int,!Toolbox);
- PutScrapText sourceText tb = PutScrapText1 (size sourceText) TextResourceType sourceText tb;
-
- PutScrapText1 :: !Int !Int !{#Char} !Toolbox -> (!Int,!Toolbox);
- PutScrapText1 length theType sourceText tb = code (length=D0,theType=D1,sourceText=U,tb=U)(r=D0,z=Z){
- instruction 0x38B70008 | addi r5,r23,8
- call .PutScrap
- }
- /*
- PutScrap :: !{#Char} !Int !Int -> Int;
- PutScrap string resource_type t = code (string=U,resource_type=D1,t=U)(r=D0){
- instruction 0x38B70008 | addi r5,r23,8
- instruction 0x80770004 | lwz r3,4(r23)
- call .PutScrap
- }
- */
-
- // Previous type: ZeroScrap :: Int;
- // No name conversion
- ZeroScrap :: !Toolbox -> (!Int,!Toolbox);
- ZeroScrap tb = code (tb=U)(r=D0,z=Z){
- call .ZeroScrap
- }
-
- // Previous type: GetScrap :: !Handle !Int -> (!Int,!Int,!Toolbox);
- // No name conversion
- GetScrap :: !Handle !Int !Toolbox -> (!Int,!Int,!Toolbox);
- GetScrap handle resource_type tb = code (handle=D0,resource_type=R4O0D2D1,tb=U)(r=D0,offset=L,t=Z){
- call .GetScrap
- }
-
- PutScrap :: !Int !Int !Ptr !Toolbox -> (!Int,!Toolbox);
- PutScrap length theType source tb = code (length=D0,theType=D1,source=D3,tb=U)(r=D0,z=Z){
- call .PutScrap
- };
-