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: PowerPC System Software /
Chapter 2 - Mixed Mode Manager / Mixed Mode Manager Reference
Constants


Procedure Information

The Mixed Mode Manager uses a long word of type ProcInfoType to encode a routine's procedure information, which contains essential information about the calling conventions and other features of a routine. These values specify

See "Specifying Procedure Information" beginning on page 2-14 for a description of the general structure of a routine's procedure information. The Mixed Mode Manager provides a number of constants that you can use to specify the procedure information.

The following constants are used to specify the size (in bytes) of a value encoded in a routine's procedure information.

enum {
   /*size codes*/
   kNoByteCode                   = 0,
   kOneByteCode                  = 1,
   kTwoByteCode                  = 2,
   kFourByteCode                 = 3
};
Constant descriptions

kNoByteCode
The value occupies no bytes.
kOneByteCode
The value occupies 1 byte.
kTwoByteCode
The value occupies 2 bytes.
kFourByteCode
The value occupies 4 bytes.
The offsets to fields and the widths of the fields within a value of type ProcInfoType are defined by constants:

/*offsets to and widths of procedure information fields*/
#define kCallingConventionPhase                       0
#define kCallingConventionWidth                       4
#define kResultSizePhase                              kCallingConventionWidth
#define kResultSizeWidth                              2
#define kResultSizeMask                               0x30
#define kStackParameterPhase                          6
#define kStackParameterWidth                          2
#define kRegisterResultLocationPhase                  \
                           (kCallingConventionWidth + kResultSizeWidth)
#define kRegisterResultLocationWidth                  5
#define kRegisterParameterPhase                       \
                           (kCallingConventionWidth + kResultSizeWidth + \
                              kRegisterResultLocationWidth)
#define kRegisterParameterWidth                       5
#define kRegisterParameterWhichPhase                  2
#define kRegisterParameterSizePhase                   0
#define kDispatchedSelectorSizeWidth                  2
#define kDispatchedSelectorSizePhase                  \
                           (kCallingConventionWidth + kResultSizeWidth)
#define kDispatchedParameterPhase                     \
                           (kCallingConventionWidth + kResultSizeWidth + \
                              kDispatchedSelectorSizeWidth)
Constant descriptions

kCallingConventionPhase
The offset from the least significant bit in the procedure information to the calling convention information.
kCallingConventionWidth
The number of bits in the procedure information that encode the calling convention information.
kResultSizePhase
The offset from the least significant bit in the procedure information to the function result size information.
kResultSizeWidth
The number of bits in the procedure information that encode the function result size information.
kResultSizeMask
A mask for the bits in the procedure information that encode the function result size information.
kStackParameterPhase
The offset from the least significant bit in the procedure information to the stack parameter information.
kStackParameterWidth
The number of bits in the procedure information that encode the size of a stack-based parameter.
kRegisterResultLocationPhase
The offset from the least significant bit in the procedure information to the result register information.
kRegisterResultLocationWidth
The number of bits in the procedure information that encode which register the result will be stored in.
kRegisterParameterPhase
The offset from the least significant bit in the procedure information to the register parameter information.
kRegisterParameterWidth
The number of bits in the procedure information that encode the information about a register-based parameter.
kRegisterParameterWhichPhase
The offset from the beginning of a register parameter information field to the encoded register.
kRegisterParameterSizePhase
The offset from the beginning of a register parameter information field to the encoded size of the parameter.
kDispatchedSelectorSizeWidth
The number of bits in the procedure information that encode the size of a routine-dispatching selector.
kDispatchedSelectorSizePhase
The offset from the least significant bit in the procedure information to the selector size information of a routine that is dispatched though a selector.
kDispatchedParameterPhase
The offset from the least significant bit in the procedure information to the parameter information of a routine that is dispatched though a selector.
The following constants are used to specify a routine's calling conventions:

enum {
   /*calling conventions*/
   kPascalStackBased                   = (CallingConventionType)0,
   kCStackBased                        = (CallingConventionType)1,
   kRegisterBased                      = (CallingConventionType)2,
   kThinkCStackBased                   = (CallingConventionType)5,
   kD0DispatchedPascalStackBased       = (CallingConventionType)8,
   kD0DispatchedCStackBased            = (CallingConventionType)9,
   kD1DispatchedPascalStackBased       = (CallingConventionType)12,
   kStackDispatchedPascalStackBased    = (CallingConventionType)14,
   kSpecialCase                        = (CallingConventionType)15
};
Constant descriptions

kPascalStackBased
The routine follows normal Pascal calling conventions.
kCStackBased
The routine follows the C calling conventions employed by the MPW development environment.
kRegisterBased
The parameters are passed in registers.
kThinkCStackBased
The routine follows the C calling conventions employed by the THINK C software development environment. Arguments are passed on the stack from right to left, and a result is returned in register D0. All arguments occupy an even number of bytes on
the stack. An argument having the size of a char is passed in the high-order byte. You should always provide function prototypes; failure to do so may cause THINK C to generate code that is incompatible with this parameter-passing convention.
kD0DispatchedPascalStackBased
The parameters are passed on the stack according to Pascal conventions, and the routine selector is passed in register D0.
kD0DispatchedCStackBased
The parameters are passed on the stack according to C conventions, and the routine selector is passed in register D0.
kD1DispatchedPascalStackBased
The parameters are passed on the stack according to Pascal conventions, and the routine selector is passed in register D1.
kStackDispatchedPascalStackBased
The routine selector and the parameters are passed on the stack.
kSpecialCase
The routine is a special case. You can use the following constants to specify a special case.
enum {
   /*special cases*/
   kSpecialCaseHighHook          = 0,
   kSpecialCaseCaretHook         = kSpecialCaseHighHook,
   kSpecialCaseEOLHook           = 1,
   kSpecialCaseWidthHook         = 2,
   kSpecialCaseNWidthHook        = 3,
   kSpecialCaseTextWidthHook     = kSpecialCaseWidthHook,
   kSpecialCaseDrawHook          = 4,
   kSpecialCaseHitTestHook       = 5,
   kSpecialCaseTEFindWord        = 6,
   kSpecialCaseProtocolHandler   = 7,
   kSpecialCaseSocketListener    = 8,
   kSpecialCaseTERecalc          = 9,
   kSpecialCaseTEDoText          = 10,
   kSpecialCaseGNEFilterProc     = 11,
   kSpecialCaseMBarHook          = 12
};
Constant descriptions

kSpecialCaseHighHook
The routine follows the calling conventions documented in Inside Macintosh: Text; a rectangle is on the stack and a pointer is in register A3; no result is returned.
kSpecialCaseCaretHook
The routine follows the calling conventions documented in Inside Macintosh: Text; a rectangle is on the stack and a pointer is in register A3; no result is returned.
kSpecialCaseEOLHook
Parameters are passed to the routine in registers A3, A4, and D0, and output is returned in the Z flag of the Status Register. An EOLHook routine has these calling conventions.
kSpecialCaseWidthHook
Parameters are passed to the routine in registers A0, A3, A4, D0, and D1, and output is returned in register D1. A WIDTHHook routine has these calling conventions.
kSpecialCaseNWidthHook
Parameters are passed to the routine in registers A0, A2, A3, A4, D0, and D1, and output is returned in register D1. An nWIDTHHook routine has these calling conventions.
kSpecialCaseTextWidthHook
Parameters are passed to the routine in registers A0, A3, A4, D0, and D1, and output is returned in register D1. A TextWidthHook routine has these calling conventions.
kSpecialCaseDrawHook
Parameters are passed to the routine in registers A0, A3, A4, D0, and D1, and no result is returned. A DRAWHook routine has these calling conventions.
kSpecialCaseHitTestHook
Parameters are passed to the routine in registers A0, A3, A4, D0, D1, and D2, and output is returned in registers D0, D1, and D2. A HITTESTHook routine has these calling conventions.
kSpecialCaseTEFindWord
Parameters are passed to the routine in registers A3, A4, D0, and D2, and output is returned in registers D0 and D1. A TEFindWord hook has these calling conventions.
kSpecialCaseProtocolHandler
Parameters are passed to the routine in registers A0, A1, A2, A3, A4, and in the low-order word of register D1; output is returned in the Z flag of the Status Register. A protocol handler has these calling conventions.
kSpecialCaseSocketListener
Parameters are passed to the routine in registers A0, A1, A2, A3, A4, in the low-order byte of register D0, and in the low-order word of register D1; output is returned in the Z flag of the Status Register. A socket listener has these calling conventions.
kSpecialCaseTERecalc
Parameters are passed to the routine in registers A3 and D7, and output is returned in registers D2, D3, and D4. A TextEdit line-start recalculation routine has these calling conventions.
kSpecialCaseTEDoText
Parameters are passed to the routine in registers A3, D3, D4, and D7, and output is returned in registers A0 and D0. A TextEdit text-display, hit-test, and caret-positioning routine has these calling conventions.
kSpecialCaseGNEFilterProc
Parameters are passed to the routine in registers A1 and D0 and on the stack, and output is returned on the stack. A GetNextEvent filter procedure has these calling conventions.
kSpecialCaseMBarHook
Parameters are passed to the routine on the stack, and output is returned in register D0. A menu bar hook routine has these calling conventions.
For register-based routines, the registers are encoded in the routine's procedure information using these constants:

enum {
   /*680x0 registers*/
   kRegisterD0                   = 0,
   kRegisterD1                   = 1,
   kRegisterD2                   = 2,
   kRegisterD3                   = 3,
   kRegisterD4                   = 8,
   kRegisterD5                   = 9,
   kRegisterD6                   = 10,
   kRegisterD7                   = 11,
   kRegisterA0                   = 4,
   kRegisterA1                   = 5,
   kRegisterA2                   = 6,
   kRegisterA3                   = 7,
   kRegisterA4                   = 12,
   kRegisterA5                   = 13,
   kRegisterA6                   = 14,
   kCCRegisterCBit               = 16,
   kCCRegisterVBit               = 17,
   kCCRegisterZBit               = 18,
   kCCRegisterNBit               = 19,
   kCCRegisterXBit               = 20
};
Constant descriptions

kRegisterD0
Register D0.
kRegisterD1
Register D1.
kRegisterD2
Register D2.
kRegisterD3
Register D3.
kRegisterD4
Register D4.
kRegisterD5
Register D5.
kRegisterD6
Register D6.
kRegisterD7
Register D7.
kRegisterA0
Register A0.
kRegisterA1
Register A1.
kRegisterA2
Register A2.
kRegisterA3
Register A3.
kRegisterA4
Register A4.
kRegisterA5
Register A5.
kRegisterA6
Register A6.
kCCRegisterCBit
The C (carry) flag of the Status Register.
kCCRegisterVBit
The V (overflow) flag of the Status Register.
kCCRegisterZBit
The Z (zero) flag of the Status Register.
kCCRegisterNBit
The N (negative) flag of the Status Register.
kCCRegisterXBit
The X (extend) flag of the Status Register.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996