Rev 193 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
259 | daniel-mar | 1 | /*------------------------------------------------------------------------------ |
2 | # |
||
3 | # Macintosh Developer Technical Support |
||
4 | # |
||
5 | # Sample Control Panel Device and INIT Combination |
||
6 | # |
||
7 | # Program: INIT - CDEV |
||
8 | # File: SAGlobals.c - C Source |
||
9 | # |
||
10 | # Copyright © 1990 Apple Computer, Inc. |
||
11 | # All rights reserved. |
||
12 | # |
||
13 | ------------------------------------------------------------------------------*/ |
||
14 | |||
15 | #include <Memory.h> |
||
16 | #include <OSUtils.h> |
||
17 | #include "SAGlobals.h" |
||
18 | |||
19 | #define kAppParmsSize 32 |
||
20 | |||
21 | /* |
||
22 | !!! NOTE !!! |
||
23 | |||
24 | These routines are used to implement global variables in standalone code, |
||
25 | as per Technote #256. However, they have been modified here to allocate |
||
26 | the buffer space from a non-relocatable pointer rather than a relocatable |
||
27 | handle. ... since the best place for a |
||
28 | block of memory that isn't going to be moving is low in the heap, we |
||
29 | allocate the block with NewPtr. |
||
30 | */ |
||
31 | |||
32 | long A5Size (void); |
||
33 | /* prototype for routine in MacRuntime.o */ |
||
34 | |||
35 | void A5Init (Ptr myA5); |
||
36 | /* prototype for routine in MacRuntime.o */ |
||
37 | |||
38 | pascal void MakeA5World (A5RefType *A5Ref) { |
||
39 | DebugStr("\pMakeA5World"); |
||
40 | *A5Ref = NewPtr(A5Size()); |
||
41 | if ((long)*A5Ref) { |
||
42 | A5Init((Ptr)( (long)*A5Ref + A5Size() - kAppParmsSize)); |
||
43 | } |
||
44 | } |
||
45 | |||
46 | pascal long SetA5World (A5RefType A5Ref) { |
||
47 | return SetA5( (long)A5Ref + A5Size() - kAppParmsSize); |
||
48 | } |
||
49 | |||
50 | pascal void DisposeA5World (A5RefType A5Ref) { |
||
51 | DisposePtr((Ptr)A5Ref); |
||
52 | } |