Package Name: constants_and_types
-- =============================================================================
-- File : constants_and_types.ads =
-- Project : AMAF =
-- Version : 1.2.1 =
-- Author : M. A. van der Lugt =
-- =
-- Copyright 1996 Marinus A. van der Lugt =
-- =
-- History : =
-- ----------------------------------------------------------------------------=
-- =============================================================================
-- Ada packages
with unchecked_conversion ;
with unchecked_deallocation ;
with interfaces.c ;
-- MacOS Bindings
with Types ;
-- =============================================================================
package Constants_And_Types is
-- =============================================================================
package IC renames interfaces.C ;
-- Basic definitions
type Natural_2 is mod 2 ** 2 ; for Natural_2'size use 2 ;
type Natural_4 is mod 2 ** 4 ; for Natural_4'size use 4 ;
type Natural_8 is mod 2 ** 8 ; for Natural_8'size use 8 ;
type Natural_16 is mod 2 ** 16 ; for Natural_16'size use 16 ;
type Natural_32 is mod 2 ** 32 ; for Natural_32'size use 32 ;
subtype Byte is Natural_8 ;
subtype Word is Natural_16 ;
subtype Long_Word is Natural_32 ;
type Integer_8 is range -128 .. 127 ; for Integer_8'size use 8 ;
subtype Integer_16 is short_integer ;
subtype Integer_32 is integer ;
type Two_Bytes is
record
MSB : Natural_8 ;
LSB : Natural_8 ;
end record ;
for Two_Bytes'size use 16 ;
type Four_Bytes is
record
HH_Byte : Natural_8 ;
HL_Byte : Natural_8 ;
LH_Byte : Natural_8 ;
LL_Byte : Natural_8 ;
end record ;
for Four_Bytes'size use 32 ;
type Two_Words is
record
MSW : Natural_16 ;
LSW : Natural_16 ;
end record ;
for Two_Words'size use 32 ;
type Natural_8_1D_Array is array (integer range <>) of Natural_8 ;
type Natural_16_1D_Array is array (integer range <>) of Natural_16 ;
function To_Four_Bytes is new unchecked_conversion (IC.unsigned_long, Four_Bytes) ;
function To_Four_Bytes is new unchecked_conversion (Types.UInt32, Four_Bytes) ;
function To_Natural_16 is new unchecked_conversion (short_integer, Natural_16) ;
function To_Natural_16 is new unchecked_conversion (Types.UInt16, Natural_16) ;
function To_Natural_32 is new unchecked_conversion (long_integer, Natural_32) ;
function To_Natural_32 is new unchecked_conversion (IC.unsigned_long, Natural_32 ) ;
function To_Natural_32 is new unchecked_conversion (Types.UInt32, Natural_32) ;
type String_Ptr is access all string ;
procedure Free is new unchecked_deallocation (string, String_Ptr) ;
-- Menubar resource definitions.
Menubar_Resource_ID : constant := 128 ;
Apple_Menu_ID : constant := 128 ;
File_Menu_ID : constant := 129 ;
Quit_File_Menu_Item : constant := 1 ;
-- Default size for any window derived from the window object.
Default_Window_Rectangle : constant Types.Rect := (40, 2, 200, 340) ;
-- Default minimum and maximum window size for a document window.
Default_Min_Max_Window_Size : constant Types.Rect :=
(64, 64, Integer_16'last, Integer_16'last) ;
-- Note : a maxsize of 65535 pixels will crash the operation GrowWindow.
-- (This is an error in the 'Inside Macintosh: Toolbox essentials'.)
-- Size of the command fifo. That buffer is used to store commands that the
-- application sends to itself.
Command_Fifo_Size : constant := 100 ;
end Constants_And_Types ;