Subversion Repositories filter_foundry

Rev

Rev 193 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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