Important: The information in this document is obsolete and should not be used for new development.
Figures, Tables, and Listings
Chapter 1 Gestalt Manager 1-1Listing 1-1 Determining whether Gestalt is available 1-5
Listing 1-2 Calling Gestalt and checking its result code 1-6
Listing 1-3 Interpreting a Gestalt attributes response 1-10
Table 1-1 Gestalt selector suffixes and their meanings 1-10
Listing 1-4 Defining a simple Gestalt selector function 1-11
Listing 1-5 Installing a new Gestalt selector 1-12
Chapter 2 System Error Handler 2-1
Figure 2-1 The system startup alert box 2-4
Figure 2-2 The system startup alert box when extensions have been disabled 2-4
Figure 2-3 The system error alert box 2-5
Table 2-1 System error IDs 2-7
Figure 2-4 Handling of a nonfatal system error in System 7 2-12
Listing 2-1 A simple resume procedure 2-12
Figure 2-5 The structure of a system error alert table 2-16
Figure 2-6 The structure of an alert definition 2-17
Figure 2-7 The structure of a text definition 2-18
Figure 2-8 The structure of an icon definition 2-18
Figure 2-9 The structure of a procedure definition 2-19
Figure 2-10 The structure of a button definition 2-20
Figure 2-11 The structure of a button-title definition 2-21
Chapter 3 Mathematical and Logical Utilities 3-1
Figure 3-1 A byte set to 109 ($6D) 3-4
Table 3-1 Converting hexadecimal digits to binary values 3-5
Figure 3-2 A word set to $3AD4 3-6
Figure 3-3 A long word set to $C24DAF2F 3-6
Figure 3-4 Bit-numbering schemes 3-8
Figure 3-5 The
Fixed
data type 3-11Figure 3-6 The
Fract
data type 3-12Figure 3-7 Some slope and line equivalencies using the conventions of the angle-slope conversion routines 3-13
Listing 3-1 Testing bits 3-14
Figure 3-8 A sample word (in MC680x0 notation) 3-15
Listing 3-2 Determining whether a handle is purgeable using the
BitTst
function 3-15Figure 3-9 The
BitAnd
,BitOr
, andBitXor
functions 3-16Figure 3-10 The
BitNot
andBitShift
functions 3-17Listing 3-3 Packing data to a resource 3-20
Listing 3-4 Decompressing data from a packed resource 3-21
Listing 3-5 Seeding the pseudo-random number generator 3-22
Listing 3-6 A simple way of obtaining a large random integer from a range
of pseudo-random numbers 3-23Listing 3-7 Obtaining a pseudo random integer from a small range of numbers 3-23
Listing 3-8 Obtaining a pseudo-random long integer 3-24
Table 3-2 Routines for fixed-point data types 3-26
Chapter 4 Date, Time, and Measurement Utilities 4-1
Figure 4-1 The Date & Time control panel 4-7
Figure 4-2 The Map control panel 4-7
Figure 4-3 The numeric-format resource (resource type 'it10') 4-8
Listing 4-1 Getting the current date and time with the GetDateTime procedure 4-10
Listing 4-2 Getting the current date and time with the GetTime procedure 4-10
Listing 4-3 Changing the current date and time with the SetDateTime function 4-11
Listing 4-4 Changing the current date and time with the SetTime function 4-11
Listing 4-5 Manipulating date-time information 4-13
Listing 4-6 Calculating the 300th day of the year 4-15
Listing 4-7 Computing the day of the week 4-16
Table 4-1 Equivalent dates in the Gregorian, Arabic CLC, and Jewish calendars 4-17
Table 4-2 Values for the dayOfYear and weekOfYear fields for the date 1 Muharram 1414 and equivalent values in the Gregorian calendar 4-17
Table 4-3 Comparison of settings in fields of the long date-time record for Arabic CLC, Gregorian, and Jewish calendars 4-18
Listing 4-8 Converting latitude and longitude to Fract values 4-19
Listing 4-9 Getting gmtDelta 4-20
Listing 4-10 Setting gmtDelta 4-21
Listing 4-11 Getting the current units of measurement 4-21
Listing 4-12 Timing an event using the Microseconds procedure 4-22
Table 4-4 Renamed and relocated routines 4-33
Chapter 5 Control Panel Extensions 5-1
Figure 5-1 A control panel with a panel 5-4
Figure 5-2 Panel-selection pop-up menu in a control panel 5-5
Listing 5-1 A component resource for a control panel extension 5-9
Listing 5-2 Handling Component Manager request codes 5-10
Listing 5-3 Responding to the get-item list request 5-14
Listing 5-4 Responding to the install request 5-15
Listing 5-5 Responding to an item-select request 5-16
Listing 5-6 Responding to an event-select request 5-18
Figure 6-1 An operating-system queue 6-4
Figure 6-2 The format of a queue header 6-5
Figure 6-3 The format of a queue element 6-6
Table 6-1 Operating-system queue types 6-7
Figure 6-4 Formats of a vertical retrace queue element and a notification queue element 6-8
Listing 6-1 Searching for drives in the drive queue 6-9
Table 6-2 Installation routines for operating-system queue elements 6-10
Listing 6-2 Using the Enqueue procedure to add a bank customer to a teller queue 6-11
Listing 6-3 Using Dequeue to remove the first customer in the bank-teller queue 6-12
Table 6-3 Removal routines for operating-system elements 6-12
Chapter 7 Parameter RAM Utilities 7-1
Figure 7-1 Interaction between parameter RAM and low memory 7-4
Figure 7-2 The format of the system parameter record 7-5
Table 7-1 Default values for parameter RAM (for U.S. system software) 7-7
Figure 8-1 How the CPU processes A-line instructions 8-4
Figure 8-2 Trap dispatch tables 8-5
Figure 8-3 Accessing the FillRect procedure 8-6
Figure 8-4 Augmenting the FillRect procedure with a single patch 8-7
Figure 8-5 A-line instruction format 8-10
Figure 8-6 Exception stack frame (on Macintosh computers with a MC68020 microprocessor or greater) 8-10
Figure 8-7 An A-line instruction for an Operating System routine 8-11
Figure 8-8 The stack on entry to an Operating System routine 8-12
Figure 8-9 An A-line instruction for a Toolbox routine 8-15
Figure 8-10 Stack when entering a Toolbox routine 8-15
Figure 8-11 Pascal calling convention 8-17
Figure 8-12 C calling convention 8-17
Table 8-1 Toolbox parameter-passing conventions 8-18
Table 8-2 Conventions for returning results from Toolbox functions 8-19
Listing 8-1 Determining if a system software routine is available 8-22
Listing 8-2 Determining whether WaitNextEvent and Gestalt are available 8-23
Listing 8-3 Patching the SysBeep Operating System procedure 8-23
Listing 8-4 Jumping to the next routine in the daisy chain 8-24
Listing 8-5 Installing a patch 8-24
Listing 9-1 The MySampleINIT system extension 9-11
Figure 9-1 The default system extension icon 9-14
Figure 9-2 Typical resources for a system extension 9-16
Chapter 10 Package Manager 10-1
Table 10-1 The standard Macintosh packages 10-3