Package Name: types
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Extensions; use Interfaces.C.Extensions;
with System; use System; with Unchecked_Conversion;
package Types is
--
-- File: Types.h
--
-- Contains: Basic Macintosh data types.
--
-- Version: Technology: System 7.5
-- Package: Universal Interfaces 2.1 in ÒMPW LatestÓ on ETO #18
--
-- Copyright: © 1984-1995 by Apple Computer, Inc.
-- All rights reserved.
--
nil : constant Address := Null_Address;
subtype Byte is unsigned_char;
type Byte_Ptr is Access Byte;
type Byte_Vec_1 is array (0 .. 0) of Byte;
type Byte_Vec_2 is array (0 .. 1) of Byte;
subtype SignedByte is signed_char;
type QDPtr is Access SignedByte;
type QDHandle is Access QDPtr;
subtype UInt8 is Byte;
type UInt8_Ptr is Access UInt8;
type UInt8_Vec_1 is array (0 .. 0) of UInt8;
type UInt8_Vec_3 is array (0 .. 2) of UInt8;
type UInt8_Vec_4 is array (0 .. 3) of UInt8;
type UInt8_Vec_8 is array (0 .. 7) of UInt8;
type UInt8_Vec_12 is array (0 .. 11) of UInt8;
type UInt8_Vec_16 is array (0 .. 15) of UInt8;
type UInt8_Vec_24 is array (0 .. 23) of UInt8;
type UInt8_Vec_70 is array (0 .. 69) of UInt8;
type UInt8_Vec_144 is array (0 .. 143) of UInt8;
type UInt8_Vec_220 is array (0 .. 219) of UInt8;
type UInt8_Vec_249 is array (0 .. 248) of UInt8;
type UInt8_Vec_296 is array (0 .. 295) of UInt8;
subtype SInt8 is SignedByte;
type SInt8_Vec_1 is array (0 .. 0) of SInt8;
type SInt8_Vec_2 is array (0 .. 1) of SInt8;
type SInt8_Vec_3 is array (0 .. 2) of SInt8;
type SInt8_Vec_12 is array (0 .. 11) of SInt8;
type SInt8_Vec_32 is array (0 .. 31) of SInt8;
type SInt8_Vec_40 is array (0 .. 39) of SInt8;
type SInt8_Vec_99 is array (0 .. 98) of SInt8;
type SInt8_Vec_116 is array (0 .. 115) of SInt8;
subtype UInt16 is unsigned_short;
type UInt16_Vec_8 is array (0 .. 7) of UInt16;
subtype SInt16 is Short_Integer;
subtype UInt32 is unsigned_long;
type UInt32_Vec_4 is array (0 .. 3) of UInt32;
subtype SInt32 is Integer;
subtype UniChar is UInt16;
type Ptr is Access Character;
type Ptr_Vec_8 is array (0 .. 7) of Ptr;
type Handle is Access Ptr; -- pointer to a master pointer
type Handle_Ptr is Access Handle;
type Handle_Vec_16 is array (0 .. 15) of Handle;
type QueryListHandle is Access Handle_Ptr;
type Handle_Vec_1 is array (0 .. 0) of Handle;
type Handle_Vec_256 is array (0 .. 255) of Handle;
subtype Fixed is Long_Integer;
type Fixed_Vec_3 is array (0 .. 2) of Fixed;
type Fixed_Vec_3_Vec_3 is array (0 .. 2) of Fixed_Vec_3;
type Fixed_Vec_256 is array (0 .. 255) of Fixed;
type FixedPtr is Access Fixed;
subtype Fract is Long_Integer;
type FractPtr is Access Fract;
type Short_Integer_Vec_4 is array (0 .. 3) of Short_Integer;
-- Note: on PowerPC extended is undefined.
-- on 68K when mc68881 is on, extended is 96 bits.
-- when mc68881 is off, extended is 80 bits.
-- Some old toolbox routines require an 80 bit extended so we define extended80
type extended80 is
record
exp : Short_Integer;
man : Short_Integer_Vec_4;
end record;
type Short_Integer_Vec_2 is array (0 .. 1) of Short_Integer;
type extended96 is
record
exp : Short_Integer_Vec_2;
man : Short_Integer_Vec_4;
end record;
-- Note: float_t and double_t are "natural" computational types
-- (i.e.the compiler/processor can most easily do floating point
-- operations with that type.)
-- on PowerPC, double = 64-bit which is fastest. float = 32-bit
subtype float_t is Float;
subtype double_t is Long_Float;
type wide is
record
hi : SInt32;
lo : UInt32;
end record;
type WidePtr is Access wide;
type UnsignedWide is
record
hi : UInt32;
lo : UInt32;
end record;
type UnsignedWide_Vec_32 is array (0 .. 31) of UnsignedWide;
type UnsignedWidePtr is Access UnsignedWide;
subtype Boolean is unsigned_char;
subtype VHSelect is SInt8;
type ProcPtr is access function return Long_Integer;
type ProcHandle is Access ProcPtr;
type Register68kProcPtr is Access procedure ;
subtype RDFlagsType is UInt8;
subtype ProcInfoType is unsigned_long;
subtype ISAType is SInt8;
subtype RoutineFlagsType is unsigned_short;
type RoutineRecord is
record
procInfo : ProcInfoType; -- calling conventions
reserved1 : SInt8; -- Must be 0
ISA : ISAType; -- Instruction Set Architecture
routineFlags : RoutineFlagsType; -- Flags for each routine
procDescriptor : ProcPtr; -- Where is the thing weÕre calling?
reserved2 : unsigned_long; -- Must be 0
selector : unsigned_long; -- For dispatched routines, the selector
end record;
type RoutineRecordPtr is Access RoutineRecord;
type RoutineRecordHandle is Access RoutineRecordPtr;
type RoutineRecord_Vec_1 is array (0 .. 0) of RoutineRecord;
type RoutineDescriptor is
record
goMixedModeTrap : unsigned_short; -- Our A-Trap
version : SInt8; -- Current Routine Descriptor version
routineDescriptorFlags : RDFlagsType; -- Routine Descriptor Flags
reserved1 : unsigned_long; -- Unused, must be zero
reserved2 : UInt8; -- Unused, must be zero
selectorInfo : UInt8; -- If a dispatched routine, calling convention, else 0
routineCount : Short_Integer; -- Number of routines in this RD
routineRecords : RoutineRecord_Vec_1; -- The individual routines
end record;
type RoutineDescriptorPtr is Access RoutineDescriptor;
type RoutineDescriptorHandle is Access RoutineDescriptorPtr;
type UniversalProcPtr is Access RoutineDescriptor;
type UniversalProcPtr_Ptr is Access UniversalProcPtr;
type UniversalProcHandle is Access RoutineDescriptorPtr;
type PString is array (Natural range <>) of aliased Character;
subtype Str255 is PString (0 .. 255);
subtype Str63 is PString (0 .. 63);
subtype Str32 is PString (0 .. 32);
subtype Str31 is PString (0 .. 31);
subtype Str27 is PString (0 .. 27);
subtype Str15 is PString (0 .. 15);
type Str31_Vec_4 is array (0 .. 3) of Str31;
type Str15_Vec_12 is array (0 .. 11) of Str15;
type Str15_Vec_7 is array (0 .. 6) of Str15;
type StringPtr is access all Str255;
type StringHandle is Access StringPtr;
subtype OSErr is Short_Integer;
subtype ScriptCode is Short_Integer;
subtype LangCode is Short_Integer;
subtype Style is unsigned_char;
subtype FourCharCode is String (1..4);
subtype OSType is Long_Integer;
type OSType_Vec_1 is array (0 .. 0) of OSType;
type OSType_Vec_4 is array (0 .. 3) of OSType;
type OSType_Vec_64 is array (0 .. 63) of OSType;
type TypesBlockPtr is Access OSType;
subtype ResType is OSType;
type ResTypePtr is Access ResType;
function ToRes is new Unchecked_Conversion (FourCharCode, OSType);
type Point is
record
v : Short_Integer;
h : Short_Integer;
end record;
pragma Convention (C_Pass_By_Copy, Point); -- pass 'in Point' by copy
type Point_Vec_1 is array (0 .. 0) of Point;
type PointPtr is Access Point;
type Rect is
record
top : Short_Integer;
left : Short_Integer;
bottom : Short_Integer;
right : Short_Integer;
end record;
type TPRect is Access Rect;
-- Numeric version part of 'vers' resource
type NumVersion is
record
majorRev : UInt8; -- 1st part of version number in BC
minorAndBugRev : UInt8; -- 2nd & 3rd part of version number share a byt
stage : UInt8; -- stage code: dev, alpha, beta, fina
nonRelRev : UInt8; -- revision level of non-released versio
end record;
-- 'vers' resource format
type VersRec is
record
numericVersion : NumVersion; -- encoded version numbe
countryCode : Short_Integer; -- country code from intl utilitie
shortVersion : Str255; -- version number string - worst cas
reserved : Str255; -- longMessage string packed after shortVersio
end record;
type VersRecPtr is Access VersRec;
type VersRecHndl is Access VersRecPtr;
type OpaqueRef is new opaque_structure_def;
type KernelID is Access OpaqueRef;
subtype OSStatus is SInt32;
subtype LogicalAddress is Void_Ptr;
--
-- Who implements what debugger functions:
--
-- Name MacsBug SADE Macintosh Debugger
-- ---------- ----------- ------- -----------------------------
-- Debugger yes no InterfaceLib maps to DebugStr
-- DebugStr yes no yes
-- Debugger68k yes no InterfaceLib maps to DebugStr
-- DebugStr68k yes no InterfaceLib maps to DebugStr
-- debugstr yes no InterfaceLib maps to DebugStr
-- SysBreak no, for SADE yes InterfaceLib maps to SysError
-- SysBreakStr no, for SADE yes InterfaceLib maps to SysError
-- SysBreakFunc no, for SADE yes InterfaceLib maps to SysError
--
--
procedure Debugger;
pragma Import (C, Debugger, "Debugger", "Debugger");
procedure DebugStr
(debuggerMsg : access Str255);
pragma Import (C, DebugStr, "DebugStr", "DebugStr");
procedure Debugger68k;
pragma Import (C, Debugger68k, "Debugger68k", "Debugger68k");
procedure DebugStr68k
(debuggerMsg : access Str255);
pragma Import (C, DebugStr68k, "DebugStr68k", "DebugStr68k");
procedure SysBreak;
pragma Import (C, SysBreak, "SysBreak", "SysBreak");
procedure SysBreakStr
(debuggerMsg : access Str255);
pragma Import (C, SysBreakStr, "SysBreakStr", "SysBreakStr");
procedure SysBreakFunc
(debuggerMsg : access Str255);
pragma Import (C, SysBreakFunc, "SysBreakFunc", "SysBreakFunc");
procedure debugstr
(debuggerMsg : in String);
end Types;